diff --git a/.eslintrc.json b/.eslintrc.json index 5c9dc72c7eb..7d2927c69ba 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,6 +1,7 @@ { "extends": [ "eslint:recommended", - "plugin:jsdoc/recommended"], + "plugin:jsdoc/recommended", + "plugin:diff/diff"], "parser": "@typescript-eslint/parser", "parserOptions": { diff --git a/.github/workflows/build-checks.yml b/.github/workflows/build-checks.yml index 67b2557c165..63cbb837b7b 100644 --- a/.github/workflows/build-checks.yml +++ b/.github/workflows/build-checks.yml @@ -112,6 +112,13 @@ jobs: working-directory: build - name: Set up problem matcher uses: ammaraskar/gcc-problem-matcher@0.2.0 + # Work around https://github.com/actions/runner-images/issues/8659 + - name: "Remove GCC 13 from runner image (workaround)" + shell: bash + run: | + sudo rm -f /etc/apt/sources.list.d/ubuntu-toolchain-r-ubuntu-test-jammy.list + sudo apt-get update + sudo apt-get install -y --allow-downgrades libc6=2.35-0ubuntu3.5 libc6-dev=2.35-0ubuntu3.5 libstdc++6=12.3.0-1ubuntu1~22.04 libgcc-s1=12.3.0-1ubuntu1~22.04 - name: Build # Do not abort on errors and build/check the whole project run: cmake --build . -j $(nproc) -- --keep-going diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f5852e2f053..8ac85a8be53 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -135,8 +135,8 @@ jobs: env: SCCACHE_VERSION: "0.3.0" # macOS codesigning - APPLE_CODESIGN_IDENTITY: 2C2B5D3EDCE82BA55E22E9A67F16F8D03E390870 - MACOS_CODESIGN_OPENSSL_PASSWORD: ${{ secrets.MACOS_CODESIGN_OPENSSL_PASSWORD }} + APPLE_CODESIGN_IDENTITY: EF241CF990A9BE5477438AEE1F308F76F33FD100 + MACOS_CODESIGN_CERTIFICATE_P12_BASE64: ${{ secrets.MACOS_CODESIGN_CERTIFICATE_P12_BASE64 }} MACOS_CODESIGN_CERTIFICATE_PASSWORD: ${{ secrets.MACOS_CODESIGN_CERTIFICATE_PASSWORD }} runs-on: ${{ matrix.os }} @@ -181,14 +181,23 @@ jobs: - name: "[macOS] Set up cmake" uses: jwlawson/actions-setup-cmake@v1.13 - # Ubuntu 22.04 should use the CMake version from the repos, and Visual - # Studio on Windows comes with its own CMake version anyway. + # Ubuntu 22.04 should use the CMake version from the repos. if: runner.os == 'macOS' with: # This should always match the minimum required version in # our CMakeLists.txt cmake-version: "3.19.x" + - name: "[Windows] Set up cmake" + uses: jwlawson/actions-setup-cmake@v1.13 + # Ubuntu 22.04 should use the CMake version from the repos. + if: runner.os == 'Windows' + with: + # This is a workaround for a SSL false positive in cmake 3.26.4 + # When downloading the manual. 3.21 is required for installing the + # ANGLE Dlls via IMPORTED_RUNTIME_ARTIFACTS + cmake-version: "3.21.x" + - name: "[Windows] Set up MSVC Developer Command Prompt" if: runner.os == 'Windows' uses: ilammy/msvc-dev-cmd@v1 @@ -212,13 +221,10 @@ jobs: - name: "[macOS] Import Apple code signing identity" id: apple_codesign - if: runner.os == 'macOS' && env.MACOS_CODESIGN_OPENSSL_PASSWORD != null && env.MACOS_CODESIGN_CERTIFICATE_PASSWORD != null + if: runner.os == 'macOS' && env.MACOS_CODESIGN_CERTIFICATE_P12_BASE64 != null && env.MACOS_CODESIGN_CERTIFICATE_PASSWORD != null run: | - # Decrypt the certificate - openssl enc -aes-256-cbc -d -md sha512 \ - -k "${MACOS_CODESIGN_OPENSSL_PASSWORD}" \ - -in /Users/runner/work/mixxx/mixxx/packaging/certificates/macos_developer_id_codesign_certificate.p12.enc \ - -out ~/certificate.p12 + # Decode the certificate + echo "${{ env.MACOS_CODESIGN_CERTIFICATE_P12_BASE64 }}" | base64 -d -o ~/certificate.p12 # Create a temporary keychain for the certificate and import it. security create-keychain -p mixxx Mixxx.keychain @@ -368,13 +374,12 @@ jobs: working-directory: build - name: "[macOS] Sign, Notarize, and Staple Package" - if: runner.os == 'macOS' && env.MACOS_CODESIGN_OPENSSL_PASSWORD != null && env.MACOS_CODESIGN_CERTIFICATE_PASSWORD != null && env.APPLE_APP_SPECIFIC_PASSWORD != null + if: runner.os == 'macOS' && env.MACOS_CODESIGN_CERTIFICATE_P12_BASE64 != null && env.MACOS_CODESIGN_CERTIFICATE_PASSWORD != null && env.APPLE_APP_SPECIFIC_PASSWORD != null run: packaging/macos/sign_notarize_staple.sh build/*.dmg env: - APPLE_ID_USERNAME: rryan@mixxx.org - APPLE_BUNDLE_ID: org.mixxx.mixxx + APPLE_ID_USERNAME: daschuer@mixxx.org APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.MACOS_NOTARIZATION_APP_SPECIFIC_PASSWORD }} - ASC_PROVIDER: FLYL4D545V + APPLE_TEAM_ID: JBLRSP95FC - name: "[Windows] Sign Package" if: runner.os == 'Windows' && env.WINDOWS_CODESIGN_CERTIFICATE_PATH != null && env.WINDOWS_CODESIGN_CERTIFICATE_PASSWORD != null @@ -477,6 +482,9 @@ jobs: name: "Update manifest file on download server" runs-on: ubuntu-latest needs: build + # Always run this job, even if one or more jobs from the `build` jobs + # fail to allow partial updates of the manifest. + if: always() steps: - name: "Check out repository" uses: actions/checkout@v4 @@ -501,6 +509,7 @@ jobs: export DEPLOY_PATH='snapshots/{git_branch}/manifest.json'; fi; python3 tools/deploy.py generate-manifest + --update --output-dir 'deploy/' --dest-path "${DEPLOY_PATH}" --dest-url 'https://downloads.mixxx.org' diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 796ac018574..8584592ca90 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -79,6 +79,7 @@ repos: - eslint-plugin-jsdoc@^v46.5.1 - "@typescript-eslint/eslint-plugin" - "@typescript-eslint/parser" + - eslint-plugin-diff@^2.0.3 - repo: local hooks: - id: clang-format diff --git a/CMakeLists.txt b/CMakeLists.txt index bbd1d806a60..dcacfc56607 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,7 @@ cmake_minimum_required(VERSION 3.16) +message(STATUS "CMAKE_VERSION: ${CMAKE_VERSION}") + # CMAKE_CXX_COMPILER_ID: Distinguish between "AppleClang" and "Clang" if(POLICY CMP0025) cmake_policy(SET CMP0025 NEW) @@ -128,6 +130,15 @@ if(NOT CMAKE_CONFIGURATION_TYPES) endif() option(QT6 "Build with Qt6" OFF) +if(QT6) + if (DEFINED ENV{GITHUB_ACTIONS}) + message("Running experimental Qt6 build for GitHub Actions") + else() + message(FATAL_ERROR + "Mixxx 2.4 does not fully support Qt6, use 2.5/main instead. " + "Qt6 support is available for CI checks only and requires the environment variable GITHUB_ACTIONS to be set.") + endif() +endif() option(QOPENGL "Use QOpenGLWindow based widget instead of QGLWidget" ON) if(QOPENGL) @@ -536,6 +547,21 @@ else() # without this compiler messages in `make` backend would be uncolored set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdiagnostics-color=${BUILD_COLORS}") endif() + if(NOT CMAKE_DISABLE_PRECOMPILE_HEADERS) + execute_process( + COMMAND "${CCACHE_EXECUTABLE}" "--get-config=sloppiness" + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" + OUTPUT_VARIABLE CCACHE_CONFIGURED_SLOPPINESS OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_QUIET) + if (NOT CCACHE_CONFIGURED_SLOPPINESS MATCHES "pch_defines" OR + NOT CCACHE_CONFIGURED_SLOPPINESS MATCHES "time_macros") + message(WARNING + "ccache: For use with precompiled headers, the setting \"sloppiness\" needs to " + "be set to \"pch_defines,time_macros\". This can be done via the environment variable " + "\"CCACHE_SLOPPINESS=pch_defines,time_macros\" or permanent via " + "\"ccache --set-config=sloppiness=pch_defines,time_macros\".") + endif() + endif() set( CMAKE_C_COMPILER_LAUNCHER "${CCACHE_EXECUTABLE}" ) set( CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_EXECUTABLE}" ) endif() @@ -947,6 +973,7 @@ add_library(mixxx-lib STATIC EXCLUDE_FROM_ALL src/musicbrainz/web/coverartarchiveimagetask.cpp src/musicbrainz/web/coverartarchivelinkstask.cpp src/musicbrainz/web/musicbrainzrecordingstask.cpp + src/nativeeventhandlerwin.cpp src/network/jsonwebtask.cpp src/network/networktask.cpp src/network/webtask.cpp @@ -1072,7 +1099,6 @@ add_library(mixxx-lib STATIC EXCLUDE_FROM_ALL src/util/db/dbconnectionpool.cpp src/util/db/dbconnectionpooled.cpp src/util/db/dbconnectionpooler.cpp - src/util/db/dbid.cpp src/util/db/fwdsqlquery.cpp src/util/db/fwdsqlqueryselectresult.cpp src/util/db/sqlite.cpp @@ -1395,6 +1421,7 @@ else() src/waveform/renderers/waveformrendererrgb.cpp src/waveform/renderers/waveformrenderersignalbase.cpp src/waveform/renderers/waveformrendermark.cpp + src/waveform/renderers/waveformrendermarkbase.cpp src/waveform/renderers/waveformrendermarkrange.cpp src/waveform/renderers/waveformsignalcolors.cpp src/waveform/renderers/waveformwidgetrenderer.cpp @@ -1428,6 +1455,7 @@ else() if(QOPENGL) target_sources(mixxx-lib PRIVATE src/shaders/endoftrackshader.cpp + src/shaders/patternshader.cpp src/shaders/rgbashader.cpp src/shaders/rgbshader.cpp src/shaders/shader.cpp @@ -1533,15 +1561,10 @@ if(GNU_GCC OR LLVM_CLANG) PROPERTY COMPILE_OPTIONS -Wno-unused-parameter -Wno-switch ) elseif(MSVC) - set_property( - SOURCE src/library/rekordbox/kaitaistructs/rekordbox_anlz.cpp - APPEND_STRING - PROPERTY COMPILE_OPTIONS /w - ) set_property( SOURCE src/library/rekordbox/kaitaistructs/rekordbox_pdb.cpp APPEND_STRING - PROPERTY COMPILE_OPTIONS /w + PROPERTY COMPILE_OPTIONS /wd4244 ) endif() @@ -1575,6 +1598,13 @@ if (INFO_VECTORIZE) endif() endif() +option(RELATIVE_MACRO_PATHS "Relativize __FILE__ paths" ON) +if(RELATIVE_MACRO_PATHS) + if(NOT MSVC) + target_compile_options(mixxx-lib PUBLIC "-fmacro-prefix-map=${CMAKE_SOURCE_DIR}=.") + endif() +endif() + option(WARNINGS_FATAL "Fail if compiler generates a warning" OFF) if(WARNINGS_FATAL) if(MSVC) @@ -1584,14 +1614,6 @@ if(WARNINGS_FATAL) endif() endif() -option(DEBUG_ASSERTIONS_FATAL "Fail if debug become true assertions" OFF) -if(DEBUG_ASSERTIONS_FATAL) - target_compile_definitions(mixxx-lib PUBLIC MIXXX_DEBUG_ASSERTIONS_FATAL MIXXX_DEBUG_ASSERTIONS_ENABLED) - if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug") - message(STATUS "DEBUG_ASSERT statements have been enabled because DEBUG_ASSERTIONS_FATAL is ON.") - endif() -endif() - target_compile_definitions(mixxx-lib PUBLIC "${CMAKE_SYSTEM_PROCESSOR}" $<$:MIXXX_BUILD_DEBUG> @@ -1660,7 +1682,7 @@ if(WIN32) target_compile_definitions(mixxx-lib PUBLIC WIN64) endif() - target_link_libraries(mixxx-lib PRIVATE shell32) + target_link_libraries(mixxx-lib PRIVATE comctl32 shell32) if(MSVC) target_link_options(mixxx-lib PUBLIC /entry:mainCRTStartup) @@ -2149,11 +2171,15 @@ if(DOWNLOAD_MANUAL AND NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/res/Mixxx-Manual. STATUS MANUAL_PDF_DOWNLOAD TLS_VERIFY ON ) - if(NOT MANUAL_PDF_DOWNLOAD EQUAL 0) - message(FATAL_ERROR "Manual PDF download failed. Either download it yourself " - "and move it to '${CMAKE_CURRENT_SOURCE_DIR}/res/Mixxx-Manual.pdf' or " - "reconfigure with -DDOWNLOAD_MANUAL=OFF to build without included " - "manual.") + list(GET MANUAL_PDF_DOWNLOAD 0 MANUAL_PDF_DOWNLOAD_ERROR) + if(NOT MANUAL_PDF_DOWNLOAD_ERROR EQUAL 0) + list(GET MANUAL_PDF_DOWNLOAD 1 MANUAL_PDF_DOWNLOAD_MESSGAE) + message(FATAL_ERROR "Manual PDF download failed with: " + "${MANUAL_PDF_DOWNLOAD_MESSGAE} Code: ${MANUAL_PDF_DOWNLOAD_ERROR}. " + "Either download it yourself and move it to " + "'${CMAKE_CURRENT_SOURCE_DIR}/res/Mixxx-Manual.pdf' or " + "reconfigure with -DDOWNLOAD_MANUAL=OFF to build without included " + "manual.") endif() file(RENAME "${CMAKE_CURRENT_BINARY_DIR}/res/Mixxx-Manual.pdf" "${CMAKE_CURRENT_SOURCE_DIR}/res/Mixxx-Manual.pdf") endif() @@ -2179,12 +2205,15 @@ if(GIT_COMMIT_DATE AND NOT GIT_COMMIT_DATE MATCHES "^[0-9]*-[0-9]*-[0-9]*T[0-9]* endif() add_custom_target(mixxx-gitinfo + # Note: We don't quote the paths in the command since CMake already inserts + # escapes (which, if quoted, lead to paths wrongly containing backslashes). + # See https://stackoverflow.com/questions/8925396/why-does-cmake-prefixes-spaces-with-backslashes-when-executing-a-command COMMAND ${CMAKE_COMMAND} - -DGIT_DESCRIBE="${GIT_DESCRIBE}" - -DGIT_COMMIT_DATE="${GIT_COMMIT_DATE}" - -DINPUT_FILE="${CMAKE_CURRENT_SOURCE_DIR}/src/gitinfo.h.in" - -DOUTPUT_FILE="${CMAKE_CURRENT_BINARY_DIR}/src/gitinfo.h" - -P "${CMAKE_CURRENT_SOURCE_DIR}/cmake/scripts/gitinfo.cmake" + -DGIT_DESCRIBE=${GIT_DESCRIBE} + -DGIT_COMMIT_DATE=${GIT_COMMIT_DATE} + -DINPUT_FILE=${CMAKE_CURRENT_SOURCE_DIR}/src/gitinfo.h.in + -DOUTPUT_FILE=${CMAKE_CURRENT_BINARY_DIR}/src/gitinfo.h + -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/scripts/gitinfo.cmake COMMENT "Update git version information in gitinfo.h" BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/src/gitinfo.h" WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" @@ -2275,7 +2304,7 @@ option(ENGINEPRIME "Support for library export to Denon Engine Prime" ON) if(ENGINEPRIME) # libdjinterop does not currently have a stable ABI, so we fetch sources for a specific tag, build here, and link # statically. This situation should be reviewed once libdjinterop hits version 1.x. - set(LIBDJINTEROP_VERSION 0.20.0) + set(LIBDJINTEROP_VERSION 0.20.1) # Look whether an existing installation of libdjinterop matches the required version. find_package(DjInterop ${LIBDJINTEROP_VERSION} EXACT CONFIG) if(NOT DjInterop_FOUND) @@ -2311,7 +2340,7 @@ if(ENGINEPRIME) URL "https://github.com/xsco/libdjinterop/archive/refs/tags/${LIBDJINTEROP_VERSION}.tar.gz" "https://launchpad.net/~xsco/+archive/ubuntu/djinterop/+sourcefiles/libdjinterop/${LIBDJINTEROP_VERSION}-0ubuntu1/libdjinterop_${LIBDJINTEROP_VERSION}.orig.tar.gz" - URL_HASH SHA256=0cf85b30629b59277437e2be7e8073c22797e8749920ba2dd5e72c21e14d68db + URL_HASH SHA256=69bdbd0e68f12858b79795a76a6023962f93f819ca36ea56a9d4680901865d13 DOWNLOAD_DIR "${CMAKE_CURRENT_BINARY_DIR}/downloads" DOWNLOAD_NAME "libdjinterop-${LIBDJINTEROP_VERSION}.tar.gz" INSTALL_DIR ${DJINTEROP_INSTALL_DIR} @@ -2325,7 +2354,7 @@ if(ENGINEPRIME) -DCMAKE_INSTALL_LIBDIR:PATH=lib -DCMAKE_MODULE_PATH:PATH=${CMAKE_MODULE_PATH} -$,D,U>CMAKE_TOOLCHAIN_FILE:PATH=${CMAKE_TOOLCHAIN_FILE} - -$,D,U>CMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT} + -$,D,U>CMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET} -$,D,U>CMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES} -DCMAKE_SYSTEM_PROCESSOR=${CMAKE_SYSTEM_PROCESSOR} -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME} @@ -2335,22 +2364,35 @@ if(ENGINEPRIME) EXCLUDE_FROM_ALL TRUE ) - # Assemble a library based on the external project. - add_library(mixxx-libdjinterop STATIC IMPORTED) - add_dependencies(mixxx-libdjinterop libdjinterop) - set(DJINTEROP_INCLUDE_DIR "${DJINTEROP_INSTALL_DIR}/include") - set(DJINTEROP_LIBRARY_PATH "${DJINTEROP_INSTALL_DIR}/${DJINTEROP_LIBRARY}") - set_target_properties(mixxx-libdjinterop PROPERTIES IMPORTED_LOCATION "${DJINTEROP_LIBRARY_PATH}") - target_include_directories(mixxx-lib PUBLIC ${DJINTEROP_INCLUDE_DIR}) - target_link_libraries(mixxx-lib PRIVATE mixxx-libdjinterop) - # Since we have built libdjinterop from sources as a static library, its # transitive dependencies are not automatically recognised. libdjinterop # depends on zlib and optionally sqlite3. If libdjinterop was configured # to depend on system SQLite, Mixxx will already have the dependency. # But it does not have zlib, so we explicitly add that here. find_package(ZLIB 1.2.8 REQUIRED) - target_link_libraries(mixxx-lib PRIVATE ${ZLIB_LIBRARIES}) + # The include folder needs to already exist, otherwise INTERFACE_INCLUDE_DIRECTORIES will not be propagated + file(MAKE_DIRECTORY "${DJINTEROP_INSTALL_DIR}/include") + + if(NOT CMAKE_GENERATOR STREQUAL "Ninja") + # Required for 'CMakeFiles/mixxx-lib_autogen_timestamp_deps' + # This tells 'make" that the libdjinterop is required for the djinterop library + # BUILD_BYPRODUCTS work for Ninja only, while this workaround does not work for Ninja on macOS + add_custom_command( + OUTPUT "${DJINTEROP_INSTALL_DIR}/${DJINTEROP_LIBRARY}" + DEPENDS libdjinterop + COMMAND echo libdjinterop installed + ) + endif() + + # Assemble a library based on the external project. + add_library(mixxx-libdjinterop STATIC IMPORTED) + set_target_properties(mixxx-libdjinterop PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${DJINTEROP_INSTALL_DIR}/include" + INTERFACE_LINK_LIBRARIES ZLIB::ZLIB + IMPORTED_LOCATION "${DJINTEROP_INSTALL_DIR}/${DJINTEROP_LIBRARY}" + ) + add_dependencies(mixxx-libdjinterop libdjinterop) + target_link_libraries(mixxx-lib PRIVATE mixxx-libdjinterop) endif() # Include conditional sources only required with Engine Prime export support. @@ -2422,7 +2464,7 @@ if(KEYFINDER) -DCMAKE_PREFIX_PATH=${PIPE_DELIMITED_CMAKE_PREFIX_PATH} -DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR} -$,D,U>CMAKE_TOOLCHAIN_FILE:PATH=${CMAKE_TOOLCHAIN_FILE} - -$,D,U>CMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT} + -$,D,U>CMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMEN_TARGET} -$,D,U>CMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES} -DCMAKE_SYSTEM_PROCESSOR=${CMAKE_SYSTEM_PROCESSOR} -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME} @@ -2640,6 +2682,17 @@ if(QT_EXTRA_COMPONENTS) qt_finalize_target(mixxx) endif() +option(DEBUG_ASSERTIONS_FATAL "Fail if debug become true assertions" OFF) +if(DEBUG_ASSERTIONS_FATAL) + target_compile_definitions(mixxx-lib PUBLIC MIXXX_DEBUG_ASSERTIONS_FATAL MIXXX_DEBUG_ASSERTIONS_ENABLED) + if(QML) + target_compile_definitions(mixxx-qml-lib PUBLIC MIXXX_DEBUG_ASSERTIONS_FATAL MIXXX_DEBUG_ASSERTIONS_ENABLED) + endif() + if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug") + message(STATUS "DEBUG_ASSERT statements have been enabled because DEBUG_ASSERTIONS_FATAL is ON.") + endif() +endif() + target_compile_definitions(mixxx-lib PUBLIC QT_TABLET_SUPPORT QT_USE_QSTRINGBUILDER) is_static_library(Qt_IS_STATIC Qt${QT_VERSION_MAJOR}::Core) if(Qt_IS_STATIC) @@ -2978,7 +3031,7 @@ if(COREAUDIO) src/sources/v1/legacyaudiosourceadapter.cpp lib/apple/CAStreamBasicDescription.cpp ) - target_compile_definitions(mixxx-lib PRIVATE __COREAUDIO__) + target_compile_definitions(mixxx-lib PUBLIC __COREAUDIO__) target_include_directories(mixxx-lib SYSTEM PUBLIC lib/apple) endif() @@ -2999,7 +3052,7 @@ if(FAAD) ) target_compile_definitions(mixxx-lib PUBLIC __FAAD__) if(MP4v2_FOUND) - target_compile_definitions(mixxx-lib PRIVATE __MP4V2__) + target_compile_definitions(mixxx-lib PUBLIC __MP4V2__) target_link_libraries(mixxx-lib PRIVATE MP4v2::MP4v2) else() target_link_libraries(mixxx-lib PRIVATE MP4::MP4) @@ -3366,14 +3419,6 @@ if(WAVPACK) target_link_libraries(mixxx-lib PRIVATE WavPack::wavpack) endif() -if (APPLOCAL_COMPONENT_DEFINED) - set(CPACK_COMPONENT_applocal_HIDDEN TRUE) - # In order to run Mixx from the build directory install applocal components - add_custom_command( - TARGET mixxx POST_BUILD - COMMAND "${CMAKE_COMMAND}" -DCOMPONENT=applocal -DCMAKE_INSTALL_PREFIX="${CMAKE_CURRENT_BINARY_DIR}" -P cmake_install.cmake) -endif() - # Configure file with build options file(RELATIVE_PATH MIXXX_INSTALL_DOCDIR_RELATIVE_TO_DATADIR "${CMAKE_INSTALL_PREFIX}/${MIXXX_INSTALL_DATADIR}" "${CMAKE_INSTALL_PREFIX}/${MIXXX_INSTALL_DOCDIR}") configure_file("${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.in" "${CMAKE_CURRENT_BINARY_DIR}/src/config.h" @ONLY) @@ -3427,7 +3472,7 @@ if (NOT CPACK_DEBIAN_PACKAGE_RELEASE) set(CPACK_DEBIAN_PACKAGE_RELEASE 1) endif() -set(CPACK_DEBIAN_DISTRIBUTION_RELEASES focal jammy kinetic lunar mantic) +set(CPACK_DEBIAN_DISTRIBUTION_RELEASES focal jammy lunar mantic noble) set(CPACK_DEBIAN_SOURCE_DIR ${CMAKE_SOURCE_DIR}) set(CPACK_DEBIAN_UPLOAD_PPA_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/packaging/CPackDebUploadPPA.cmake") set(CPACK_DEBIAN_INSTALL_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/packaging/CPackDebInstall.cmake") @@ -3448,6 +3493,17 @@ endif() include(CPack) +if (APPLOCAL_COMPONENT_DEFINED) + cpack_add_component(applocal + HIDDEN + REQUIRED) + + # In order to run Mixx from the build directory install applocal components + add_custom_command( + TARGET mixxx POST_BUILD + COMMAND "${CMAKE_COMMAND}" -DCOMPONENT=applocal -DCMAKE_INSTALL_PREFIX="${CMAKE_CURRENT_BINARY_DIR}" -P cmake_install.cmake) +endif() + if(APPLE AND MACOS_BUNDLE) set(BUNDLE_NAME "${MIXXX_INSTALL_PREFIX}") set(BUNDLE_DIRS "${CMAKE_PREFIX_PATH}/lib") diff --git a/README.md b/README.md index c3a14fd98d8..78277832a91 100644 --- a/README.md +++ b/README.md @@ -74,7 +74,7 @@ Mixxx is a vibrant community of hackers, DJs and artists. To keep track of development and community news: - Chat with us on [Zulip][zulip]. -- Follow us on [Twitter] and [Facebook]. +- Follow us on [Mastodon], [Twitter] and [Facebook]. - Subscribe to the [Mixxx Blog][blog]. - Post on the [Mixxx forums][discourse]. @@ -88,6 +88,7 @@ license. [download-testing]: https://mixxx.org/download/#testing [issues]: https://github.com/mixxxdj/mixxx/issues [fileabug]: https://github.com/mixxxdj/mixxx/issues/new/choose +[mastodon]: https://floss.social/@mixxx [twitter]: https://twitter.com/mixxxdj [facebook]: https://www.facebook.com/pages/Mixxx-DJ-Software/21723485212 [blog]: https://mixxx.org/news/ diff --git a/cmake/modules/BundleInstall.cmake.in b/cmake/modules/BundleInstall.cmake.in index 6e3217255f7..0c0d6884965 100644 --- a/cmake/modules/BundleInstall.cmake.in +++ b/cmake/modules/BundleInstall.cmake.in @@ -23,17 +23,24 @@ if(DEFINED APPLE_CODESIGN_IDENTITY AND DEFINED APPLE_CODESIGN_ENTITLEMENTS) message(STATUS "Ad-hoc signing bundle without hardened runtime") execute_process(COMMAND codesign --verbose=4 --deep --force + --entitlements "${APPLE_CODESIGN_ENTITLEMENTS}" --sign "${APPLE_CODESIGN_IDENTITY}" "${PATH_TO_SIGN}" + RESULT_VARIABLE CODESIGN_EXIT_CODE ) else() + message(STATUS "Signing bundle with hardened runtime and identity ${APPLE_CODESIGN_IDENTITY}") execute_process(COMMAND codesign --verbose=4 --deep --force --options runtime --entitlements "${APPLE_CODESIGN_ENTITLEMENTS}" --sign "${APPLE_CODESIGN_IDENTITY}" "${PATH_TO_SIGN}" + RESULT_VARIABLE CODESIGN_EXIT_CODE ) endif() + if(NOT CODESIGN_EXIT_CODE EQUAL 0) + message(FATAL_ERROR "Signing ${PATH_TO_SIGN} failed") + endif() endforeach() else() message(STATUS "Not signing bundle. Specify -DAPPLE_CODESIGN_IDENTITY and -DAPPLE_CODESIGN_ENTITLEMENTS to cmake before running cpack to sign") diff --git a/lib/reverb/Reverb.cc b/lib/reverb/Reverb.cc index 38daba6d24f..7e0bf2e56f6 100644 --- a/lib/reverb/Reverb.cc +++ b/lib/reverb/Reverb.cc @@ -43,9 +43,12 @@ 02111-1307, USA or point your web browser to http://www.gnu.org. */ +#include "Reverb.h" + +#include #include "basics.h" +#include "dsp/FPTruncateMode.h" -#include "Reverb.h" //#include "Descriptor.h" #if 0 diff --git a/lib/reverb/Reverb.h b/lib/reverb/Reverb.h index ac8821124ac..c0d428dc642 100644 --- a/lib/reverb/Reverb.h +++ b/lib/reverb/Reverb.h @@ -48,6 +48,7 @@ #define REVERB_H #include +#include // for M_PI #include "basics.h" #include "dsp/Delay.h" @@ -60,7 +61,7 @@ class Lattice : public DSP::Delay { public: - sample_t process (sample_t x, double d) + sample_t process (sample_t x, sample_t d) { sample_t y = get(); x -= d*y; @@ -125,8 +126,8 @@ class ModLattice void init (int n, int w) { - n0 = n; - width = w; + n0 = static_cast(n); + width = static_cast(w); delay.init (n + w); } @@ -136,9 +137,9 @@ class ModLattice } inline sample_t - process (sample_t x, double d) + process (sample_t x, sample_t d) { - sample_t y = delay.get_linear (n0 + width * lfo.get()); + sample_t y = delay.get_linear (n0 + width * static_cast(lfo.get())); x += d * y; delay.put (x); return y - d * x; /* note sign */ diff --git a/lib/reverb/basics.h b/lib/reverb/basics.h index bae7aa1daba..d825c48220a 100644 --- a/lib/reverb/basics.h +++ b/lib/reverb/basics.h @@ -1,3 +1,5 @@ +#pragma once + /* basics.h @@ -29,78 +31,14 @@ 02111-1307, USA or point your web browser to http://www.gnu.org. */ -#ifndef BASICS_H -#define BASICS_H - -#include - -#include -#include - -#include -#include - -#include -#include - -#include "util/types.h" -typedef CSAMPLE sample_t; - -// NOTE(rryan): 3/2014 Added these for the MSVC build. -#include -typedef qint8 int8; -typedef quint8 uint8; -typedef qint16 int16; -typedef quint16 uint16; -typedef qint32 int32; -typedef quint32 uint32; -typedef qint64 int64; -typedef quint64 uint64; - -#define MIN_GAIN 1e-6 /* -120 dB */ -/* smallest non-denormal 32 bit IEEE float is 1.18e-38 */ -#define NOISE_FLOOR 1e-20 /* -400 dB */ - -/* //////////////////////////////////////////////////////////////////////// */ +#include // for assert +#include // for uint32_t +typedef float sample_t; +typedef uint32_t uint32; typedef unsigned int uint; typedef unsigned long ulong; -/* prototype that takes a sample and yields a sample */ -typedef CSAMPLE (*clip_func_t) (CSAMPLE); - -#ifndef max -template X min (X x, Y y) { return x < (X)y ? x : (X)y; } -template X max (X x, Y y) { return x > (X)y ? x : (X)y; } -#endif /* ! max */ - -template -T clamp (T value, T lower, T upper) -{ - if (value < lower) return lower; - if (value > upper) return upper; - return value; -} - -// (timrae) change random() to rand() for MSVC support -static inline float frandom() { return (float) rand() / (float) RAND_MAX; } - -/* NB: also true if 0 */ -inline bool -is_denormal (float & f) -{ - int32 i = *((int32 *) &f); - return ((i & 0x7f800000) == 0); -} - -/* not used, check validity before using */ -inline bool -is_denormal (double & f) -{ - int64 i = *((int64 *) &f); - return ((i & 0x7fe0000000000000ll) == 0); -} - /* lovely algorithm from http://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2Float */ @@ -119,9 +57,3 @@ next_power_of_2 (uint n) return ++n; } -inline double db2lin (double db) { return pow(10, .05*db); } -inline double lin2db (double lin) { return 20*log10(lin); } - -/* //////////////////////////////////////////////////////////////////////// */ - -#endif /* BASICS_H */ diff --git a/lib/reverb/dsp/Delay.h b/lib/reverb/dsp/Delay.h index 791e8bfd030..d530fee58a1 100644 --- a/lib/reverb/dsp/Delay.h +++ b/lib/reverb/dsp/Delay.h @@ -32,6 +32,8 @@ #ifndef _DSP_DELAY_H_ #define _DSP_DELAY_H_ +#include // for memset + #include "util.h" #include "FPTruncateMode.h" @@ -102,12 +104,9 @@ class Delay sample_t x2 = (*this) [n + 2]; /* sample_t (32bit) quicker than double here */ - sample_t a = - (3 * (x0 - x1) - x_1 + x2) * .5; - sample_t b = - 2 * x1 + x_1 - (5 * x0 + x2) * .5; - sample_t c = - (x1 - x_1) * .5; + sample_t a = (3 * (x0 - x1) - x_1 + x2) * .5f; + sample_t b = 2 * x1 + x_1 - (5 * x0 + x2) * .5f; + sample_t c = (x1 - x_1) * .5f; return x0 + (((a * f) + b) * f + c) * f; } @@ -122,7 +121,7 @@ class MovingAverage void init (uint n) { this->Delay::init (n); - over_n = 1. / n; + over_n = 1.f / n; /* adjust write pointer so we have a full history of zeros */ write = (write + size + 1) & size; state = 0; diff --git a/lib/reverb/dsp/IIR1.h b/lib/reverb/dsp/IIR1.h index 0d945b3ffc6..5df8391f70b 100644 --- a/lib/reverb/dsp/IIR1.h +++ b/lib/reverb/dsp/IIR1.h @@ -36,7 +36,7 @@ class LP1 public: T a0, b1, y1; - LP1 (double d = 1.) + LP1 (T d = 1.) { set (d); y1 = 0.; diff --git a/packaging/certificates/macos_developer_id_codesign_certificate.p12.enc b/packaging/certificates/macos_developer_id_codesign_certificate.p12.enc deleted file mode 100644 index 63f2d0c33a7..00000000000 Binary files a/packaging/certificates/macos_developer_id_codesign_certificate.p12.enc and /dev/null differ diff --git a/packaging/macos/sign_notarize_staple.sh b/packaging/macos/sign_notarize_staple.sh index 5628abc1173..01eaadf4ffa 100755 --- a/packaging/macos/sign_notarize_staple.sh +++ b/packaging/macos/sign_notarize_staple.sh @@ -1,55 +1,38 @@ #!/bin/bash +set -e + DMG_FILE="${1}" [ -z "${DMG_FILE}" ] && echo "Pass DMG file name as first argument." >&2 && exit 1 -[ -z "${APPLE_CODESIGN_IDENTITY}" ] && echo "Please set the $APPLE_CODESIGN_IDENTITY env var." >&2 && exit 1 -[ -z "${APPLE_BUNDLE_ID}" ] && echo "Please set the $APPLE_BUNDLE_ID env var." >&2 && exit 1 -[ -z "${APPLE_ID_USERNAME}" ] && echo "Please set the $APPLE_ID_USERNAME env var." >&2 && exit 1 -[ -z "${APPLE_APP_SPECIFIC_PASSWORD}" ] && echo "Please set the $APPLE_APP_SPECIFIC_PASSWORD env var." >&2 && exit 1 -[ -z "${ASC_PROVIDER}" ] && echo "Please set the $ASC_PROVIDER env var." >&2 && exit 1 - -echo "Signing $DMG_FILE" -codesign --verbose=4 --options runtime \ - --sign "${APPLE_CODESIGN_IDENTITY}" "$(dirname "$0")/Mixxx.entitlements" "${DMG_FILE}" - -echo "Notarizing $DMG_FILE" -xcrun altool --notarize-app --primary-bundle-id "${APPLE_BUNDLE_ID}" --username "${APPLE_ID_USERNAME}" \ - --password "${APPLE_APP_SPECIFIC_PASSWORD}" --asc-provider "${ASC_PROVIDER}" --file "${DMG_FILE}" \ - --output-format xml > notarize_result.plist -UUID="$(/usr/libexec/PlistBuddy -c 'Print notarization-upload:RequestUUID' notarize_result.plist)" -echo "Notarization UUID: $UUID" -rm notarize_result.plist - -# Wait a few seconds to avoid "Could not find the RequestUUID." error -sleep 5 - -# wait for confirmation that notarization finished -while true; do - xcrun altool --notarization-info "$UUID" \ - --username "${APPLE_ID_USERNAME}" --password "${APPLE_APP_SPECIFIC_PASSWORD}" \ - --output-format xml > notarize_status.plist - - # shellcheck disable=SC2181 - if [ "$?" != "0" ]; then - echo "Notarization failed:" - cat notarize_status.plist - curl "$(/usr/libexec/PlistBuddy -c 'Print notarization-info:LogFileURL' notarize_status.plist)" - exit 1 - fi - - NOTARIZATION_STATUS="$(/usr/libexec/PlistBuddy -c 'Print notarization-info:Status' notarize_status.plist)" - if [ "${NOTARIZATION_STATUS}" == "in progress" ]; then - echo "Waiting another 10 seconds for notarization to complete" - sleep 10 - elif [ "${NOTARIZATION_STATUS}" == "success" ]; then - echo "Notarization succeeded" - break - else - echo "Notarization status: ${NOTARIZATION_STATUS}" - fi -done - -rm notarize_status.plist - -echo "Stapling $DMG_FILE" +[ -z "${APPLE_CODESIGN_IDENTITY}" ] && echo 'Please set the APPLE_CODESIGN_IDENTITY env var.' >&2 && exit 1 +[ -z "${APPLE_ID_USERNAME}" ] && echo 'Please set the APPLE_ID_USERNAME env var.' >&2 && exit 1 +[ -z "${APPLE_APP_SPECIFIC_PASSWORD}" ] && echo 'Please set the APPLE_APP_SPECIFIC_PASSWORD env var.' >&2 && exit 1 +[ -z "${APPLE_TEAM_ID}" ] && echo 'Please set the APPLE_TEAM_ID env var.' >&2 && exit 1 + +tmp_dir="$(mktemp -dt mixxx_notarize)" +# We want $tmp_dir to expand now, therefore we disable the check +# shellcheck disable=SC2064 +trap "rm -rf '$tmp_dir'" EXIT + +echo "==> Signing $DMG_FILE" +codesign --verbose=4 --sign "${APPLE_CODESIGN_IDENTITY}" "${DMG_FILE}" + + +echo "==> Notarizing $DMG_FILE" + +credentials=( + --apple-id "${APPLE_ID_USERNAME}" + --password "${APPLE_APP_SPECIFIC_PASSWORD}" + --team-id "${APPLE_TEAM_ID}" +) +submit_out="$tmp_dir/submit_out.txt" + +xcrun notarytool submit "${credentials[@]}" "${DMG_FILE}" 2>&1 | tee "$submit_out" +REQUEST_ID="$(grep -e " id: " "$submit_out" | grep -oE '([0-9a-f-]{36})'| head -n1)" +rm "$submit_out" +xcrun notarytool wait "$REQUEST_ID" "${credentials[@]}" --timeout 15m ||: +xcrun notarytool log "$REQUEST_ID" "${credentials[@]}" ||: +xcrun notarytool info "$REQUEST_ID" "${credentials[@]}" + +echo "==> Stapling $DMG_FILE" xcrun stapler staple -q "${DMG_FILE}" diff --git a/res/controllers/Akai-LPD8-RK-scripts.js b/res/controllers/Akai-LPD8-RK-scripts.js index 30165dbc105..45b4d5954ef 100644 --- a/res/controllers/Akai-LPD8-RK-scripts.js +++ b/res/controllers/Akai-LPD8-RK-scripts.js @@ -253,7 +253,7 @@ LPD8RK.init = function (id, debug) { // called when the device is opened & set u engine.softTakeover("[Sampler2]","rate",true); //set LED timer - LPD8RK.ledTimer = engine.beginTimer(LPD8RK.LEDinterval, "LPD8RK.setLeds()"); + LPD8RK.ledTimer = engine.beginTimer(LPD8RK.LEDinterval, LPD8RK.setLeds); }; LPD8RK.shutdown = function () { @@ -263,7 +263,7 @@ LPD8RK.shutdown = function () { LPD8RK.resetLEDTimer = function () { engine.stopTimer(LPD8RK.ledTimer); LPD8RK.setLeds() - LPD8RK.ledTimer = engine.beginTimer(LPD8RK.LEDinterval, "LPD8RK.setLeds()"); + LPD8RK.ledTimer = engine.beginTimer(LPD8RK.LEDinterval, LPD8RK.setLeds); }; LPD8RK.setLeds = function () { @@ -376,7 +376,7 @@ LPD8RK.reloopButton = function (channel, control, value, status, group) { engine.stopTimer(LPD8RK.reloopTimer); LPD8RK.loopbuttonDown=true; LPD8RK.doreloop=true; - LPD8RK.reloopTimer = engine.beginTimer(500, "LPD8RK.disablereloop()", true); + LPD8RK.reloopTimer = engine.beginTimer(500, LPD8RK.disablereloop, true); } else {//button was released LPD8RK.loopbuttonDown=false; if (LPD8RK.doreloop===true) {engine.setValue(group, "reloop_exit", 1);}; @@ -437,11 +437,11 @@ LPD8RK.hotcueBankDial = function (channel, control, value, status, group) { LPD8RK.oldHotcueBank=LPD8RK.hotcueBank; //set timer to clear old bank number after 500 msec, so bank indicator light will light up engine.stopTimer(LPD8RK.oldbanktimer); - LPD8RK.oldbanktimer = engine.beginTimer(500, "LPD8RK.resetOldBank()", true); + LPD8RK.oldbanktimer = engine.beginTimer(500, LPD8RK.resetOldBank, true); //set timer to restart LED updates in 500 msec engine.stopTimer(LPD8RK.LEDPauseTimer); - LPD8RK.LEDPauseTimer = engine.beginTimer(LPD8RK.LEDinterval, "LPD8RK.resetLEDTimer()", true); + LPD8RK.LEDPauseTimer = engine.beginTimer(LPD8RK.LEDinterval, LPD8RK.resetLEDTimer, true); }; LPD8RK.looplenDial = function (channel, control, value, status, group) { diff --git a/res/controllers/American-Audio-VMS2-scripts.js b/res/controllers/American-Audio-VMS2-scripts.js index cbed294a067..8224dfd1fe9 100644 --- a/res/controllers/American-Audio-VMS2-scripts.js +++ b/res/controllers/American-Audio-VMS2-scripts.js @@ -323,7 +323,7 @@ VMS2.playlight = function(value, group, control) { deck.Buttons.Pause.setLed(LedState.on); // start a fancy blink timer deck.switchPlaylightOff = true; - deck.playTimer = engine.beginTimer(500,"VMS2.playlightflash(\""+group+"\")"); + deck.playTimer = engine.beginTimer(500,()=>VMS2.playlightflash(group)); } }; diff --git a/res/controllers/Behringer-BCD3000-Advanced-scripts.js b/res/controllers/Behringer-BCD3000-Advanced-scripts.js index f86503f1e8b..40a93bdd096 100644 --- a/res/controllers/Behringer-BCD3000-Advanced-scripts.js +++ b/res/controllers/Behringer-BCD3000-Advanced-scripts.js @@ -75,7 +75,7 @@ BehringerBCD3000.jogWheel = function (channel, control, value, status, group) { scratchValue = (value - 0x40); engine.scratchEnable(deck + 1, 100, 33+1/3, 1.0/8, (1.0/8)/32); engine.scratchTick(deck + 1, scratchValue); - BehringerBCD3000.scratchTimer[deck] = engine.beginTimer(20, "BehringerBCD3000.stopScratch(" + deck + ")", true); + BehringerBCD3000.scratchTimer[deck] = engine.beginTimer(20, ()=>BehringerBCD3000.stopScratch(deck), true); } else if (BehringerBCD3000.onKey) { if (value > 0x40){ diff --git a/res/controllers/Behringer-CMDStudio4a-scripts.js b/res/controllers/Behringer-CMDStudio4a-scripts.js index 2fc79f1003c..1fa284cff52 100644 --- a/res/controllers/Behringer-CMDStudio4a-scripts.js +++ b/res/controllers/Behringer-CMDStudio4a-scripts.js @@ -211,7 +211,7 @@ BehringerCMDStudio4a.hotcue = function (channel, control, value, status, group) // https://github.com/mixxxdj/mixxx/issues/8456 // Changed timer from 50 to 100 after the pathology of this // bug was explained in the bug report. - engine.beginTimer(100, function() { engine.setValue(group, "slip_enabled", 1); }, 1); + engine.beginTimer(100, () => engine.setValue(group, "slip_enabled", 1), 1); } } } else { diff --git a/res/controllers/Behringer-Extension-scripts.js b/res/controllers/Behringer-Extension-scripts.js index f2901042905..f83d6dd45d4 100644 --- a/res/controllers/Behringer-Extension-scripts.js +++ b/res/controllers/Behringer-Extension-scripts.js @@ -239,12 +239,11 @@ isEnabled: function() { return this.id !== 0; }, start: function() { this.reset(); - var timer = this; - this.id = engine.beginTimer(this.timeout, function() { - if (timer.oneShot) { - timer.disable(); + this.id = engine.beginTimer(this.timeout, () => { + if (this.oneShot) { + this.disable(); } - timer.action.call(timer.owner); + this.action.call(this.owner); }, this.oneShot); }, reset: function() { diff --git a/res/controllers/DJ-Tech-CDJ-101-scripts.js b/res/controllers/DJ-Tech-CDJ-101-scripts.js index 9d09e7a5c06..daea57c3718 100644 --- a/res/controllers/DJ-Tech-CDJ-101-scripts.js +++ b/res/controllers/DJ-Tech-CDJ-101-scripts.js @@ -188,7 +188,7 @@ DJTechCDJ101.jogtouch = function(channel, control, value, status, group) } else { DJTechCDJ101.outer2inner = true; - DJTechCDJ101.scratch_timer = engine.beginTimer(DJTechCDJ101.scratch_timeout, 'DJTechCDJ101.finishScratch(' + deck + ', true)'); + DJTechCDJ101.scratch_timer = engine.beginTimer(DJTechCDJ101.scratch_timeout, () => DJTechCDJ101.finishScratch(deck, true)); } } } diff --git a/res/controllers/DJ-Tech-Kontrol-One-scripts.js b/res/controllers/DJ-Tech-Kontrol-One-scripts.js index ee7d1cd1083..20dacb610b0 100644 --- a/res/controllers/DJ-Tech-Kontrol-One-scripts.js +++ b/res/controllers/DJ-Tech-Kontrol-One-scripts.js @@ -68,7 +68,7 @@ KONTROL1.mod["s"]={state:"o",timer:false,doshift:true}; KONTROL1.init = function init(id, debug) { // called when the device is opened & set up if (KONTROL1.debug>2){print("##function: "+KONTROL1.getFunctionName())}; KONTROL1.updateLEDs(); - if(KONTROL1.disableFlash!==true)KONTROL1.ledTimer = engine.beginTimer(1000, "KONTROL1.doLEDs()");//set timer for LED indicator flashes + if(KONTROL1.disableFlash!==true)KONTROL1.ledTimer = engine.beginTimer(1000, KONTROL1.doLEDs);//set timer for LED indicator flashes engine.connectControl("[Channel1]", "volume", "KONTROL1.testconnect"); }; @@ -113,7 +113,7 @@ KONTROL1.knobPress = function knobPress(knobnum){ //{state:"o",timer:false,dobankswitch:true}; KONTROL1.modPress(knobnum);//turn mod on engine.stopTimer(KONTROL1.mod[knobnum]["timer"]);//kill any previous timer - KONTROL1.mod[knobnum]["timer"]=engine.beginTimer(KONTROL1.modTimeout, "KONTROL1.disableBankSwitch('"+knobnum+"')", true); + KONTROL1.mod[knobnum]["timer"]=engine.beginTimer(KONTROL1.modTimeout, () => KONTROL1.disableBankSwitch(knobnum), true); } KONTROL1.knobRelease = function knobRelease(knobnum){ @@ -145,7 +145,7 @@ KONTROL1.shiftPress = function shiftPress(){ var knobnum="s"; KONTROL1.modPress(knobnum);//turn mod on engine.stopTimer(KONTROL1.mod[knobnum]["timer"]);//kill any previous timer - KONTROL1.mod[knobnum]["timer"]=engine.beginTimer(500, "KONTROL1.disableShiftSwitch('"+knobnum+"')", true); + KONTROL1.mod[knobnum]["timer"]=engine.beginTimer(500, () => KONTROL1.disableShiftSwitch(knobnum), true); } KONTROL1.shiftRelease = function shiftRelease(){ @@ -198,7 +198,7 @@ KONTROL1.modRelease = function modRelease(knobnum){ KONTROL1.doLEDs = function doLEDs() { if (KONTROL1.debug>2){print("##function: "+KONTROL1.getFunctionName())}; engine.stopTimer(KONTROL1.flashTimer); - KONTROL1.flashTimer=engine.beginTimer(30, "KONTROL1.bankIndicators()"); + KONTROL1.flashTimer=engine.beginTimer(30, KONTROL1.bankIndicators); return; }; @@ -589,7 +589,7 @@ KONTROL1.cueClear = function cueClear(cue, control, deck){//clear hotcue - OR mo if(engine.getValue(group, "hotcue_"+cue+"_enabled")!=true){//hotcue not set - prepare to move next hotcue pressed to this button KONTROL1.cueMoveToNum=cue; engine.stopTimer(KONTROL1.cueMoveIndicator); - KONTROL1.cueMoveIndicator=engine.beginTimer(100, "KONTROL1.cueMoveIndicatorLEDs("+control+")");//start timer for LED indicator flasher showing the button we're moving to + KONTROL1.cueMoveIndicator=engine.beginTimer(100, () => KONTROL1.cueMoveIndicatorLEDs(control));//start timer for LED indicator flasher showing the button we're moving to return true; } @@ -881,7 +881,7 @@ KONTROL1.loopIn = function loopIn(value, deck) { if (value>0){//button was pressed KONTROL1.loopinbuttonDown=true; KONTROL1.doloopin=true; - KONTROL1.loopinbuttonTimer = engine.beginTimer(500, "KONTROL1.disableloopin()", true); + KONTROL1.loopinbuttonTimer = engine.beginTimer(500, KONTROL1.disableloopin, true); } else {//button was released KONTROL1.loopinbuttonDown=false; if (KONTROL1.doloopin===true) {engine.setValue(group, "loop_in", 1);engine.setValue(group, "loop_in", 0);}; @@ -900,7 +900,7 @@ KONTROL1.loopOut = function loopOut(value, deck) { if (value>0){//button was pressed KONTROL1.loopoutbuttonDown=true; KONTROL1.doloopout=true; - KONTROL1.loopoutbuttonTimer = engine.beginTimer(500, "KONTROL1.disableloopout()", true); + KONTROL1.loopoutbuttonTimer = engine.beginTimer(500, KONTROL1.disableloopout, true); } else {//button was released KONTROL1.loopoutbuttonDown=false; if (KONTROL1.doloopout===true) {engine.setValue(group, "loop_out", 1);}; @@ -1307,7 +1307,7 @@ KONTROL1.test = function test(channel, control, value, status, group) { }; - //KONTROL1.ledTimer = engine.beginTimer(250, "KONTROL1.testflash()"); + //KONTROL1.ledTimer = engine.beginTimer(250, KONTROL1.testflash); //midi.sendShortMsg(status, ctrl, state); //engine.stopTimer(KONTROL1.ledTimer); diff --git a/res/controllers/DJ-Tech-i-Mix-Reload-scripts.js b/res/controllers/DJ-Tech-i-Mix-Reload-scripts.js index 4cf1dbf5f9f..60fd662ab20 100644 --- a/res/controllers/DJ-Tech-i-Mix-Reload-scripts.js +++ b/res/controllers/DJ-Tech-i-Mix-Reload-scripts.js @@ -84,7 +84,7 @@ DJTechiMixReload.init = function(ID) DJTechiMixReload.setbutton["[Channel2]"] = false; DJTechiMixReload.allleadson(); - engine.beginTimer(4000,"DJTechiMixReload.allleadsoff()",true); + engine.beginTimer(4000, DJTechiMixReload.allleadsoff ,true); for(var deck = 1; deck <= 2; deck++){ engine.connectControl("[Channel" + deck + "]","play","DJTechiMixReload.deck" + deck + "play"); engine.connectControl("[Channel" + deck + "]","cue_default","DJTechiMixReload.deck" + deck + "cue"); diff --git a/res/controllers/Denon-DN-SC2000.midi.js b/res/controllers/Denon-DN-SC2000.midi.js index f2cef7139f1..0f54089d030 100644 --- a/res/controllers/Denon-DN-SC2000.midi.js +++ b/res/controllers/Denon-DN-SC2000.midi.js @@ -60,7 +60,7 @@ DenonDNSC2000.newValue = function(currentVal,min,max,increment,ticksCount) { DenonDNSC2000.flanger = function (midino, control, value, status, group) { DenonDNSC2000.toggleBinaryValue(group,'flanger'); - engine.beginTimer(100, 'DenonDNSC2000.handleFlangerLed("'+group+'")', true); + engine.beginTimer(100, ()=>DenonDNSC2000.handleFlangerLed(group), true); } DenonDNSC2000.changeDepth = function (midino, control, value, status, group) { @@ -100,7 +100,7 @@ DenonDNSC2000.loadSelectedTrack = function (midino, control, value, status, grou } else { engine.setValue(group, 'LoadSelectedTrack', 1); - engine.beginTimer(1500, 'DenonDNSC2000.handleLeds("'+group+'")', true); + engine.beginTimer(1500, ()=>DenonDNSC2000.handleLeds(group), true); } } @@ -170,7 +170,7 @@ DenonDNSC2000.hotcue = function(cueIndex, group, value, shift) { else engine.setValue(group, 'hotcue_' + cueIndex + '_clear',1); } - engine.beginTimer(100, 'DenonDNSC2000.handleLoopAndHotcuesLeds("'+group+'")', true); + engine.beginTimer(100, ()=>DenonDNSC2000.handleLoopAndHotcuesLeds(group), true); } DenonDNSC2000.loopIn = function(group, value, shift) { @@ -179,7 +179,7 @@ DenonDNSC2000.loopIn = function(group, value, shift) { } else engine.setValue(group, 'loop_in', 1); - engine.beginTimer(100, 'DenonDNSC2000.handleLoopAndHotcuesLeds("'+group+'")', true); + engine.beginTimer(100, ()=>DenonDNSC2000.handleLoopAndHotcuesLeds(group), true); } DenonDNSC2000.loopOut = function(group, value, shift) { @@ -190,7 +190,7 @@ DenonDNSC2000.loopOut = function(group, value, shift) { } else engine.setValue(group, 'loop_out', 1); - engine.beginTimer(100, 'DenonDNSC2000.handleLoopAndHotcuesLeds("'+group+'")', true); + engine.beginTimer(100, ()=>DenonDNSC2000.handleLoopAndHotcuesLeds(group), true); } DenonDNSC2000.reloop = function(group, value, shift) { @@ -221,7 +221,7 @@ DenonDNSC2000.reloop = function(group, value, shift) { engine.setValue(group, 'reloop_exit', 1); } } - engine.beginTimer(100, 'DenonDNSC2000.handleLoopAndHotcuesLeds("'+group+'")', true); + engine.beginTimer(100, ()=>DenonDNSC2000.handleLoopAndHotcuesLeds(group), true); } DenonDNSC2000.resizeLoop = function(midino, control, value, status, group) { @@ -267,7 +267,7 @@ DenonDNSC2000.resizeLoop = function(midino, control, value, status, group) { newLoopOutPosition = Math.max(0,newLoopOutPosition - newLoopOutPosition % 2); engine.setValue(group, 'loop_end_position', newLoopOutPosition); } - engine.beginTimer(100, 'DenonDNSC2000.handleLoopAndHotcuesLeds("'+group+'")', true); + engine.beginTimer(100, ()=>DenonDNSC2000.handleLoopAndHotcuesLeds(group), true); } DenonDNSC2000.moveLoopLeft = function(midino, control, value, status, group) { @@ -311,7 +311,7 @@ DenonDNSC2000.play = function (midino, control, value, status, group) { DenonDNSC2000.toggleBinaryValue(group,'play'); } } - engine.beginTimer(100, 'DenonDNSC2000.handlePlayLed("'+group+'")', true); + engine.beginTimer(100, ()=>DenonDNSC2000.handlePlayLed(group), true); } DenonDNSC2000.cue = function (midino, control, value, status, group) { @@ -330,14 +330,14 @@ DenonDNSC2000.cue = function (midino, control, value, status, group) { DenonDNSC2000.keyLock = function (midino, control, value, status, group) { if ((status & 0xF0) == 0x90) { DenonDNSC2000.toggleBinaryValue(group,'keylock'); - engine.beginTimer(100, 'DenonDNSC2000.handleKeyLockLed("'+group+'")', true); + engine.beginTimer(100, ()=>DenonDNSC2000.handleKeyLockLed(group), true); } } DenonDNSC2000.beatSync = function (midino, control, value, status, group) { if ((status & 0xF0) == 0x90) { DenonDNSC2000.toggleBinaryValue(group,'beatsync'); - engine.beginTimer(100, 'DenonDNSC2000.handleBeatSyncLed("'+group+'")', true); + engine.beginTimer(100, () => DenonDNSC2000.handleBeatSyncLed(group), true); } } diff --git a/res/controllers/Denon-MC7000-scripts.js b/res/controllers/Denon-MC7000-scripts.js index e37884220f4..f9937681767 100644 --- a/res/controllers/Denon-MC7000-scripts.js +++ b/res/controllers/Denon-MC7000-scripts.js @@ -249,7 +249,7 @@ MC7000.init = function() { engine.makeConnection("[Sampler"+samplerIdx+"]", "play", MC7000.VelSampLED); } // send Softtakeover delayed to avoid conflicts with ControllerStatusSysex - engine.beginTimer(2000, function() { + engine.beginTimer(2000, () => { // Softtakeover for Pitch Faders only for (let chanIdx = 1; chanIdx <= 4; chanIdx++) { engine.softTakeover("[Channel" + chanIdx + "]", "rate", true); @@ -430,9 +430,7 @@ MC7000.PadButtons = function(channel, control, value, status, group) { engine.setValue(group, "hotcue_" + cueIdx + "_activate", false); if (engine.getValue(group, "slip_enabled")) { engine.setValue(group, "slip_enabled", false); - engine.beginTimer(50, function() { - engine.setValue(group, "slip_enabled", true); - }, true); + engine.beginTimer(50, () => engine.setValue(group, "slip_enabled", true), true); } } else if (control === 0x1C + cueIdx - 1 && value === 0x7F) { engine.setValue(group, "hotcue_" + cueIdx + "_clear", true); @@ -589,9 +587,7 @@ MC7000.PadButtons = function(channel, control, value, status, group) { // midi.sendShortMsg(0x94 + deckIndex, 0x14 + pitchIdx - 1, MC7000.padColor.pitchoff); // switch to pitch off color if (engine.getValue(group, "slip_enabled")) { engine.setValue(group, "slip_enabled", false); - engine.beginTimer(50, function() { - engine.setValue(group, "slip_enabled", true); - }, true); + engine.beginTimer(50, () => engine.setValue(group, "slip_enabled", true), true); } } else if (isButtonPressed && isControlAddressShift) { //shifted buttons deselect hotcue for pitch engine.setValue(group, "pitch", 0); @@ -691,9 +687,7 @@ MC7000.wheelTouch = function(channel, control, value, status, group) { if (engine.getValue(group, "slip_enabled")) { engine.scratchDisable(deckNumber, false); // stops scratching immediately engine.setValue(group, "slip_enabled", false); - engine.beginTimer(50, function() { - engine.setValue(group, "slip_enabled", true); - }, true); + engine.beginTimer(50, () => engine.setValue(group, "slip_enabled", true), true); } else { engine.scratchDisable(deckNumber); // continues scratching e.g. for backspin } @@ -909,9 +903,7 @@ MC7000.reverse = function(channel, control, value, status, group) { engine.brake(deckNumber, false); // disable brake effect engine.setValue(group, "play", 1); engine.setValue(group, "slip_enabled", false); - engine.beginTimer(50, function() { - engine.setValue(group, "slip_enabled", true); - }, true); + engine.beginTimer(50, () => engine.setValue(group, "slip_enabled", true), true); } else { engine.softStart(deckNumber, true, MC7000.spinbackFactor[deckIndex]); } @@ -927,9 +919,7 @@ MC7000.censor = function(channel, control, value, status, group) { } else { engine.setValue(group, "reverseroll", 0); } - engine.beginTimer(50, function() { - engine.setValue(group, "slip_enabled", true); - }, true); + engine.beginTimer(50, () => engine.setValue(group, "slip_enabled", true), true); } else { // reverse play while button pressed if (value > 0) { diff --git a/res/controllers/EKS-Otus.js b/res/controllers/EKS-Otus.js index 079111e24ca..1ae93195ea3 100644 --- a/res/controllers/EKS-Otus.js +++ b/res/controllers/EKS-Otus.js @@ -365,7 +365,7 @@ EksOtus.init = function (id) { if (EksOtus.LEDUpdateInterval!=undefined) { controller.timers["led_update"] = engine.beginTimer( EksOtus.LEDUpdateInterval, - "EksOtus.updateLEDs(true)" + () => EksOtus.updateLEDs(true) ); } @@ -670,7 +670,7 @@ EksOtus.deckSwitch = function(field) { if (EksOtus.deckSwitchClicked==false) { EksOtus.deckSwitchClicked=true; controller.timers["deck_switch"] = engine.beginTimer( - 250,"EksOtus.deckSwitchClickedClear()" + 250, EksOtus.deckSwitchClickedClear ); } else { EksOtus.deckSwitchDoubleClick(); diff --git a/res/controllers/Electrix-Tweaker-scripts.js b/res/controllers/Electrix-Tweaker-scripts.js index 985784a00fc..97388d78c8a 100644 --- a/res/controllers/Electrix-Tweaker-scripts.js +++ b/res/controllers/Electrix-Tweaker-scripts.js @@ -515,7 +515,7 @@ ElectrixTweaker.arrowSide = function(channel, control, value, status, group) { if (value) { if (ElectrixTweaker.topShift) { engine.setValue(group, "eject", 1); - engine.beginTimer(250, "engine.setValue(\""+group+"\", \"eject\", 0)", true); + engine.beginTimer(250, () => engine.setValue(group, eject, 0), true); } else { engine.setValue(group, "LoadSelectedTrack", 1); } @@ -554,7 +554,7 @@ ElectrixTweaker.oneShot = function(channel, control, value, status, group) { engine.setValue(group, "repeat", 0); engine.setValue(group, "play", 0); engine.setValue(group, "eject", 1); - engine.beginTimer(250, "engine.setValue(\""+group+"\", \"eject\", 0)", true); + engine.beginTimer(250, () => engine.setValue(group, eject, 0), true); } else { if (ElectrixTweaker.samplerVelocityAsVolume) { engine.setValue(group, "volume", script.absoluteNonLin(value * ElectrixTweaker.samplerSensitivity, 0, .25, 1)); @@ -696,7 +696,7 @@ ElectrixTweaker.midEncoder = function(channel, control, value, status, group) { engine.setValue(group, "beatjump_32_forward", 1); midi.sendShortMsg(0xB0, ElectrixTweaker.encoders[group].Mid.ring, 127); } - ElectrixTweaker.midEncoderLEDTimer[group] = engine.beginTimer(1000, "midi.sendShortMsg(0xB0, ElectrixTweaker.encoders[\""+group+"\"][\"Mid\"][\"ring\"], 64)", true); + ElectrixTweaker.midEncoderLEDTimer[group] = engine.beginTimer(1000, () => midi.sendShortMsg(0xB0, ElectrixTweaker.encoders[group].Mid.ring, 64), true); } else { switch (ElectrixTweaker.mode[group]) { case "eq": @@ -712,7 +712,7 @@ ElectrixTweaker.midEncoder = function(channel, control, value, status, group) { engine.setValue(group, "loop_move_" + ElectrixTweaker.loopMoveSize[group] + "_forward", 1); midi.sendShortMsg(0xB0, ElectrixTweaker.encoders[group].Mid.ring, 127); } - ElectrixTweaker.midEncoderLEDTimer[group] = engine.beginTimer(1000, "midi.sendShortMsg(0xB0, ElectrixTweaker.encoders[\""+group+"\"][\"Mid\"][\"ring\"], 64)", true); + ElectrixTweaker.midEncoderLEDTimer[group] = engine.beginTimer(1000, () => midi.sendShortMsg(0xB0, ElectrixTweaker.encoders[group].Mid.ring, 64), true); break; } } diff --git a/res/controllers/Gemini-FirstMix-scripts.js b/res/controllers/Gemini-FirstMix-scripts.js index a2570cedbb8..749ea3acc27 100644 --- a/res/controllers/Gemini-FirstMix-scripts.js +++ b/res/controllers/Gemini-FirstMix-scripts.js @@ -168,7 +168,7 @@ firstmix.preview = function (channel, control, value, status, group) { engine.setValue("[Sampler4]", "volume", 0); engine.setValue("[Sampler4]", "pfl", 1); engine.setValue("[Sampler4]", "LoadSelectedTrack", 1); - engine.beginTimer(250,"engine.setValue(\"[Sampler4]\", \"play\", 1)",true); // I had to add a delay because this wouldn't work otherwise + engine.beginTimer(250, () => engine.setValue("[Sampler4]", "play", 1),true); // I had to add a delay because this wouldn't work otherwise firstmix.setLED(firstmix.leds[0]["preview"], 0x7f); firstmix.previewButton = true; } diff --git a/res/controllers/Hercules DJ Control MP3 e2-scripts.js b/res/controllers/Hercules DJ Control MP3 e2-scripts.js index 40c4052b30d..f85b5c6b40f 100644 --- a/res/controllers/Hercules DJ Control MP3 e2-scripts.js +++ b/res/controllers/Hercules DJ Control MP3 e2-scripts.js @@ -352,7 +352,7 @@ HerculesMP3e2.holdButton = function (group, value, first, second) { if (value) { engine.setValue(group, first, 1); // Set "On" the first function - holdTimerID = engine.beginTimer(2000, "HerculesMP3e2.holdTimer(\""+group+"\", \""+first+"\", \""+second+"\")", true); + holdTimerID = engine.beginTimer(2000, () => HerculesMP3e2.holdTimer(group, first, second), true); } else { if (holdButtonFlag) { @@ -606,7 +606,7 @@ HerculesMP3e2.scratch = function(midino, control, value, status, group) { if (scratchMode === 0) { // Enable the scratch mode on the corresponding deck and start the timer scratchMode = 1; - scratchTimer = engine.beginTimer(scratchResetTime, "HerculesMP3e2.wheelOnOff()"); + scratchTimer = engine.beginTimer(scratchResetTime, HerculesMP3e2.wheelOnOff); midi.sendShortMsg(0x90, 45, 0x7F); // Switch-on the Scratch led engine.setValue("[Channel1]", "keylock", 0); engine.setValue("[Channel2]", "keylock", 0); diff --git a/res/controllers/Hercules-DJ-Console-4-Mx-scripts.js b/res/controllers/Hercules-DJ-Console-4-Mx-scripts.js index 69570785a29..c595e7bdb25 100644 --- a/res/controllers/Hercules-DJ-Console-4-Mx-scripts.js +++ b/res/controllers/Hercules-DJ-Console-4-Mx-scripts.js @@ -343,7 +343,7 @@ Hercules4Mx.init = function(id, debugging) { Hercules4Mx.setupFXButtonsCustomMixx21(); } - engine.beginTimer(3000, "Hercules4Mx.doDelayedSetup", true); + engine.beginTimer(3000, Hercules4Mx.doDelayedSetup, true); }; //timer-called (delayed) setup. Hercules4Mx.doDelayedSetup = function() { @@ -569,7 +569,7 @@ Hercules4Mx.onAutoDJFade = function(value, group, control) { //After 5 seconds, restore non-flashing led. It would be perfect if autoDJFade was triggered also //when the fading ends, but right now it seems this is not possible. Also, it doesn't seem to be //an option to get the duration of the fading, that's why i simply put there 5 seconds. - Hercules4Mx.autoDJfadingId = engine.beginTimer(5000, "Hercules4Mx.doEndAutoDJFadeOffAction", true); + Hercules4Mx.autoDJfadingId = engine.beginTimer(5000, Hercules4Mx.doEndAutoDJFadeOffAction, true); }; Hercules4Mx.doEndAutoDJFadeOffAction = function() { midi.sendShortMsg(Hercules4Mx.NOnC1, 0x7C, 0x00); diff --git a/res/controllers/Hercules-DJ-Console-Mk1-hid-scripts.js b/res/controllers/Hercules-DJ-Console-Mk1-hid-scripts.js index 6ac1d587f77..05f194ac7f3 100644 --- a/res/controllers/Hercules-DJ-Console-Mk1-hid-scripts.js +++ b/res/controllers/Hercules-DJ-Console-Mk1-hid-scripts.js @@ -139,7 +139,7 @@ HerculesMk1Hid.init = function() { if (v < 30) v = 30; if (HerculesMk1Hid.track_timer) engine.stopTimer(HerculesMk1Hid.track_timer); - HerculesMk1Hid.track_timer = engine.beginTimer(parseInt(5120 / v), 'HerculesMk1Hid.scroll_tracks_joystick'); + HerculesMk1Hid.track_timer = engine.beginTimer(parseInt(5120 / v), HerculesMk1Hid.scroll_tracks_joystick); } }); */ @@ -318,7 +318,7 @@ HerculesMk1Hid.scroll_tracks = function(g, e, v) { if (v > 0) { engine.setValue("[Playlist]", e == "track_next_a" ? "SelectNextTrack" : "SelectPrevTrack", 1); if (!HerculesMk1Hid.scroll_timer) { - HerculesMk1Hid.scroll_timer = engine.beginTimer(150, 'HerculesMk1Hid.scroll_tracks("[Playlist]","' + e + '",' + v + ')'); + HerculesMk1Hid.scroll_timer = engine.beginTimer(150, () => HerculesMk1Hid.scroll_tracks("[Playlist]",e,v)); } } else { diff --git a/res/controllers/Hercules-DJ-Console-Mk2-hid-scripts.js b/res/controllers/Hercules-DJ-Console-Mk2-hid-scripts.js index ed71a388c81..a491711aa29 100644 --- a/res/controllers/Hercules-DJ-Console-Mk2-hid-scripts.js +++ b/res/controllers/Hercules-DJ-Console-Mk2-hid-scripts.js @@ -139,7 +139,7 @@ HerculesMk2Hid.init = function() { if (v < 30) v = 30; if (HerculesMk2Hid.track_timer) engine.stopTimer(HerculesMk2Hid.track_timer); - HerculesMk2Hid.track_timer = engine.beginTimer(parseInt(5120 / v), 'HerculesMk2Hid.scroll_tracks_joystick'); + HerculesMk2Hid.track_timer = engine.beginTimer(parseInt(5120 / v), HerculesMk2Hid.scroll_tracks_joystick); } }); */ @@ -301,7 +301,7 @@ HerculesMk2Hid.scroll_tracks = function(g, e, v) { if (v > 0) { engine.setValue("[Playlist]", e == "track_next_a" ? "SelectNextTrack" : "SelectPrevTrack", 1); if (!HerculesMk2Hid.scroll_timer) { - HerculesMk2Hid.scroll_timer = engine.beginTimer(150, 'HerculesMk2Hid.scroll_tracks("[Playlist]","' + e + '",' + v + ')'); + HerculesMk2Hid.scroll_timer = engine.beginTimer(150, () => HerculesMk2Hid.scroll_tracks("[Playlist]", e, v)); } } else { diff --git a/res/controllers/Hercules-DJ-Console-RMX-2-scripts.js b/res/controllers/Hercules-DJ-Console-RMX-2-scripts.js index c81169eeab9..351793ea6b5 100644 --- a/res/controllers/Hercules-DJ-Console-RMX-2-scripts.js +++ b/res/controllers/Hercules-DJ-Console-RMX-2-scripts.js @@ -58,7 +58,9 @@ DJCRMX2.Deck.prototype.wheelPress = function (value) { this.finishWheelPress(); } else { this.scratchTimer = engine.beginTimer( - 100, "DJCRMX2.decks[" + this.number + "].finishWheelPress()", true); + // we delay the lookup here since this.number may have changed + // by the time the timer fires + 100, () => DJCRMX2.decks[this.number].finishWheelPress(), true); } } } @@ -79,6 +81,8 @@ DJCRMX2.Deck.prototype.finishWheelPress = function() { } else { // Check again soon. this.scratchTimer = engine.beginTimer( + // we delay the lookup here since this.number may have changed + // by the time the timer fires 100, "DJCRMX2.decks[" + this.number + "].finishWheelPress()", true); } } diff --git a/res/controllers/Hercules-DJ-Console-RMX-hid-scripts.js b/res/controllers/Hercules-DJ-Console-RMX-hid-scripts.js index 09d8cd53fbf..456d657ab65 100644 --- a/res/controllers/Hercules-DJ-Console-RMX-hid-scripts.js +++ b/res/controllers/Hercules-DJ-Console-RMX-hid-scripts.js @@ -228,8 +228,7 @@ RMX.scroll_tracks = function(g, e, v) { engine.setValue("[Playlist]", direction, 1); if (!RMX.scroll_timer) { - var callback = 'RMX.scroll_tracks("[Playlist]","' + e + '",' + v + ')'; - RMX.scroll_timer = engine.beginTimer(150, callback); + RMX.scroll_timer = engine.beginTimer(150, () => RMX.scroll_tracks("Playlist", e, v), true); } } else { @@ -283,8 +282,7 @@ RMX.jog = function(g, e, v, ctrl) { } engine.scratchTick(deck, ctrl.relative); - var callback = 'RMX.stopScratching(\"' + g + '\")'; - RMX.scratchTimer = engine.beginTimer(20, callback, true); + RMX.scratchTimer = engine.beginTimer(20, () => RMX.stopScratching(g), true); } // fine jog mode when playing diff --git a/res/controllers/Hercules-DJ-Console-RMX-scripts.js b/res/controllers/Hercules-DJ-Console-RMX-scripts.js index 13d5ccbd970..14a23f45ea8 100644 --- a/res/controllers/Hercules-DJ-Console-RMX-scripts.js +++ b/res/controllers/Hercules-DJ-Console-RMX-scripts.js @@ -39,11 +39,7 @@ HerculesRMX.Button.prototype.setLed = function(ledState, blink) { } else { midi.sendShortMsg(0xB0,this.controlId,LedState.off); } - if(blink) { - engine.beginTimer(20, "midi.sendShortMsg(0xB0," + (this.controlId + 0x30) + ", " + LedState.on + ")", true); - } else { - engine.beginTimer(20, "midi.sendShortMsg(0xB0," + (this.controlId + 0x30) + ", " + LedState.off + ")", true); - } + engine.beginTimer(20, () => midi.sendShortMsg(0xB0, this.controlId, blink ? LedState.on : LedState.off), true); }; HerculesRMX.shiftHandler = function(value) { @@ -856,14 +852,13 @@ HerculesRMX.shutdown = function() { HerculesRMX.killLeds = function() { HerculesRMX.Buttons.Scratch.setLed(LedState.off); //TODO: remove timers when alsa midi work properly. - var button; var time = 20; for (var key in HerculesRMX.Decks.Left.Buttons) { - engine.beginTimer(time, "HerculesRMX.Decks.Left.Buttons['" + key + "'].setLed(LedState.off)", true); + engine.beginTimer(time, () => HerculesRMX.Decks.Left.Buttons[key].setLed(LedState.off), true); time = time + 5; } for (var key in HerculesRMX.Decks.Right.Buttons) { - engine.beginTimer(time, "HerculesRMX.Decks.Right.Buttons['" + key + "'].setLed(LedState.off)", true); + engine.beginTimer(time, () => HerculesRMX.Decks.Right.Buttons[key].setLed(LedState.off), true); time = time + 5; } } @@ -875,11 +870,10 @@ HerculesRMX.rateChange = function (value, group) { HerculesRMX.Decks.Left.Buttons.Sync.setLed(LedState.off); } if (HerculesRMX.Decks.Right.Buttons.Sync.state != ButtonState.pressed) { - engine.beginTimer(25, "HerculesRMX.Decks.Right.Buttons.Sync.setLed(LedState.off)", true); + engine.beginTimer(25, () => HerculesRMX.Decks.Right.Buttons.Sync.setLed(LedState.off), true); } if (value != 0.0) { - var deck = HerculesRMX.GetDeck(group); - engine.beginTimer(30, "HerculesRMX.GetDeck('" + group + "').Buttons.PitchReset.setLed(LedState.off)", true); + engine.beginTimer(30, () => HerculesRMX.GetDeck(group).Buttons.PitchReset.setLed(LedState.off), true); } }; diff --git a/res/controllers/Hercules-DJ-Control-MP3-hid-scripts.js b/res/controllers/Hercules-DJ-Control-MP3-hid-scripts.js index 2184422e7d4..367b228b2ac 100644 --- a/res/controllers/Hercules-DJ-Control-MP3-hid-scripts.js +++ b/res/controllers/Hercules-DJ-Control-MP3-hid-scripts.js @@ -338,7 +338,7 @@ HerculesMP3Hid.scroll_tracks = function(g, e, v) { if (v > 0) { engine.setValue("[Playlist]", e == "track_next_a" ? "SelectNextTrack" : "SelectPrevTrack", 1); if (!HerculesMP3Hid.scroll_timer) { - HerculesMP3Hid.scroll_timer = engine.beginTimer(150, function () { + HerculesMP3Hid.scroll_timer = engine.beginTimer(150, () => { HerculesMP3Hid.scroll_tracks("[Playlist]", e, v); }); } diff --git a/res/controllers/Hercules-DJ-Control-MP3-scripts.js b/res/controllers/Hercules-DJ-Control-MP3-scripts.js index c03c319a614..e0edeb80293 100644 --- a/res/controllers/Hercules-DJ-Control-MP3-scripts.js +++ b/res/controllers/Hercules-DJ-Control-MP3-scripts.js @@ -123,13 +123,13 @@ HerculesMp3.init = function (id) { // called when the device is opened & set up // a timer and a buffer will rectify this. // Setting it to 20ms instead of 11ms as this first is the lowest value accepted for a timer. - engine.beginTimer(20, "HerculesMp3.ledhelper()"); + engine.beginTimer(20, HerculesMp3.ledhelper); // Be the leds! HerculesMp3.leds(true); - engine.beginTimer(500, "HerculesMp3.leds(false)",true); + engine.beginTimer(500, () => HerculesMp3.leds(false),true); // Connect leds here and not in xml. This is to avoid an annoying bug (maybe) in controller drivers. @@ -193,7 +193,7 @@ HerculesMp3.leds = function (onoff) { HerculesMp3.ledblink = function (control,onoff){ if(onoff) { actual_status = HerculesMp3.controls.outputs[control].status; - blinktimer[control] = engine.beginTimer(300,"HerculesMp3.ledblinkhelper("+control+")"); + blinktimer[control] = engine.beginTimer(300,() => HerculesMp3.ledblinkhelper(control)); HerculesMp3.controls.outputs[control].isblinking = true; } else @@ -287,7 +287,7 @@ HerculesMp3.loophold = function (deck) { HerculesMp3.loop = function (deck, control, value) { if(value) { is_hold_loop[deck] = false; - timerloopID[deck] = engine.beginTimer(700,"HerculesMp3.loophold("+deck+")",true); + timerloopID[deck] = engine.beginTimer(700, HerculesMp3.loophold(deck),true); } else { engine.stopTimer(timerloopID[deck]); @@ -329,7 +329,7 @@ HerculesMp3.hotcue = function (deck, control, value) { hotcue_string = HerculesMp3.fxbutton(HerculesMp3.controls.inputs[control].name); if(value){ is_hold_hotcue[control] = false; - timerhotcueID[control] = engine.beginTimer(500,"HerculesMp3.hchold("+deck+","+control+","+"\""+hotcue_string+"\")",true); + timerhotcueID[control] = engine.beginTimer(500, () => HerculesMp3.hchold(deck,control,hotcue_string),true); } else { engine.stopTimer(timerhotcueID[control]); @@ -556,7 +556,7 @@ HerculesMp3.jog_wheel = function (group, control, value, status) { if(engine.getValue(Deck[n],"scratch2_enable")) { //when not moved for 200 msecs, probably we are not touching the wheel anymore - scratch_timer[n] = engine.beginTimer(200,"HerculesMp3.jog_wheelhelper("+n+")",true); + scratch_timer[n] = engine.beginTimer(200, () => HerculesMp3.jog_wheelhelper(n),true); scratch_timer_on[n] = true; } } diff --git a/res/controllers/Hercules-DJ-Control-Steel-scripts.js b/res/controllers/Hercules-DJ-Control-Steel-scripts.js index e9691f32073..f9182adab26 100644 --- a/res/controllers/Hercules-DJ-Control-Steel-scripts.js +++ b/res/controllers/Hercules-DJ-Control-Steel-scripts.js @@ -63,17 +63,17 @@ HerculesSteel.Button = function (controlId, blinkId) { HerculesSteel.Button.prototype.setLed = function(lightState) { if(lightState == HerculesSteel.LedState.on) - { - engine.beginTimer(20, "midi.sendShortMsg(0xB0," + (this.controlId) + ", " + HerculesSteel.LedState.on + ")", true); + { + engine.beginTimer(20, () => midi.sendShortMsg(0xB0, this.controlId, HerculesSteel.LedState.on), true); } else if(lightState == HerculesSteel.LedState.blink) - { - engine.beginTimer(20, "midi.sendShortMsg(0xB0," + (this.controlId + 0x30) + ", " + HerculesSteel.LedState.on + ")", true); + { + engine.beginTimer(20, () => midi.sendShortMsg(0xB0, this.controlId + 0x30, HerculesSteel.LedState.on), true); } else - { - engine.beginTimer(20, "midi.sendShortMsg(0xB0," + (this.controlId) + ", " + HerculesSteel.LedState.off + ")", true); - engine.beginTimer(40, "midi.sendShortMsg(0xB0," + (this.controlId + 0x30) + ", " + HerculesSteel.LedState.off + ")", true); + { + engine.beginTimer(20, () => midi.sendShortMsg(0xB0, this.controlId, HerculesSteel.LedState.off), true); + engine.beginTimer(40, () => midi.sendShortMsg(0xB0, this.controlId + 0x30, HerculesSteel.LedState.off), true); } }; @@ -973,7 +973,7 @@ HerculesSteel.LedsON = function() { { //TODO: remove timers when alsa midi work properly. //midi.sendShortMsg(0xB0, i, 0x7F); - engine.beginTimer(time, "midi.sendShortMsg(0xB0, '" + i + "', 0x7F);", true); + engine.beginTimer(time, () => midi.sendShortMsg(0xB0, i, 0x7F), true); time = time + 5; } @@ -985,7 +985,7 @@ HerculesSteel.LedsON = function() { { //TODO: remove timers when alsa midi work properly. //midi.sendShortMsg(0xB0, i, 0x7F); - engine.beginTimer(time, "midi.sendShortMsg(0xB0, '" + i + "', 0x7F);", true); + engine.beginTimer(time, () => midi.sendShortMsg(0xB0, i, 0x7F), true); time = time + 5; } // Some buttons stays OFF : rewind A/B, forward A/B, Load Deck A, Load Deck B, Up, Down, Apply Ctrl. on @@ -994,16 +994,15 @@ HerculesSteel.LedsON = function() { HerculesSteel.LedsOFF = function() { HerculesSteel.Buttons.Scratch.setLed(HerculesSteel.LedState.off); //TODO: remove timers when alsa midi work properly. - var button; var time = 20; print("switch off Left deck LEDs"); for (var key in HerculesSteel.Decks.Left.Buttons) { - engine.beginTimer(time, "HerculesSteel.Decks.Left.Buttons['" + key + "'].setLed(HerculesSteel.LedState.off)", true); + engine.beginTimer(time, () => HerculesSteel.Decks.Left.Buttons[key].setLed(HerculesSteel.LedState.off), true); time = time + 5; } print("switch off Right deck LEDs"); for (var key in HerculesSteel.Decks.Right.Buttons) { - engine.beginTimer(time, "HerculesSteel.Decks.Right.Buttons['" + key + "'].setLed(HerculesSteel.LedState.off)", true); + engine.beginTimer(time, () => HerculesSteel.Decks.Right.Buttons[key].setLed(HerculesSteel.LedState.off), true); time = time + 5; } } @@ -1015,10 +1014,9 @@ HerculesSteel.rateChange = function (value, group) { HerculesSteel.Decks.Left.Buttons.Sync.setLed(HerculesSteel.LedState.off); } if (HerculesSteel.Decks.Right.Buttons.Sync.state != HerculesSteel.ButtonState.pressed) { - engine.beginTimer(25, "HerculesSteel.Decks.Right.Buttons.Sync.setLed(HerculesSteel.LedState.off)", true); + engine.beginTimer(25, () => HerculesSteel.Decks.Right.Buttons.Sync.setLed(HerculesSteel.LedState.off), true); } if (value != 0.0) { - var deck = HerculesSteel.GetDeck(group); - engine.beginTimer(30, "HerculesSteel.GetDeck('" + group + "').Buttons.PitchReset.setLed(HerculesSteel.LedState.off)", true); + engine.beginTimer(30, () => HerculesSteel.GetDeck(group).Buttons.PitchReset.setLed(HerculesSteel.LedState.off), true); } }; diff --git a/res/controllers/Hercules-DJControl-Compact-scripts.js b/res/controllers/Hercules-DJControl-Compact-scripts.js index e5e57090120..a860f66069f 100644 --- a/res/controllers/Hercules-DJControl-Compact-scripts.js +++ b/res/controllers/Hercules-DJControl-Compact-scripts.js @@ -67,7 +67,7 @@ HercDJCompact.jog_wheel = function (group, control, value, status) { if(engine.getValue(input.group, "scratch2_enable")) { //when not moved for 200 msecs, probably we are not touching the wheel anymore scratch_timer[input.channel] = - engine.beginTimer(200, "HercDJCompact.jog_wheelhelper("+input.channel+")", true); + engine.beginTimer(200, () => HercDJCompact.jog_wheelhelper(input.channel), true); scratch_timer_on[input.channel] = true; } } else { diff --git a/res/controllers/Hercules_DJControl_Jogvision-scripts.js b/res/controllers/Hercules_DJControl_Jogvision-scripts.js index 7e95eeab127..d20c9a118ae 100644 --- a/res/controllers/Hercules_DJControl_Jogvision-scripts.js +++ b/res/controllers/Hercules_DJControl_Jogvision-scripts.js @@ -208,7 +208,7 @@ var DJCJV = { } if (CFG.user.beatHelper === 1) { - DJCJV.other.beatHelpTimer = engine.beginTimer(100, "DJCJV.beatHelp"); + DJCJV.other.beatHelpTimer = engine.beginTimer(100, DJCJV.beatHelp); } // Ask the controller to send all current knob/slider values over MIDI, which will update the corresponding GUI controls in MIXXX. diff --git a/res/controllers/Ion-Discover-DJ-Pro-scripts.js b/res/controllers/Ion-Discover-DJ-Pro-scripts.js index 211d6848a5f..21e3a5c3e53 100644 --- a/res/controllers/Ion-Discover-DJ-Pro-scripts.js +++ b/res/controllers/Ion-Discover-DJ-Pro-scripts.js @@ -181,7 +181,7 @@ IonDiscoverDjPro.jogWheel = function(channel, control, value, status, group) { engine.stopTimer(IonDiscoverDjPro.scratchTimer[deck]); } engine.scratchTick(deck, adjustedJog); - IonDiscoverDjPro.scratchTimer[deck] = engine.beginTimer(20, "IonDiscoverDjPro.jogWheelStopScratch(" + deck + ")", true); + IonDiscoverDjPro.scratchTimer[deck] = engine.beginTimer(20, () => IonDiscoverDjPro.jogWheelStopScratch(deck), true); } else { var gammaInputRange = 23; // Max jog speed var maxOutFraction = 0.5; // Where on the curve it should peak; 0.5 is half-way diff --git a/res/controllers/Ion-Discover-DJ-scripts.js b/res/controllers/Ion-Discover-DJ-scripts.js index f1cb4eef136..bcae1653267 100644 --- a/res/controllers/Ion-Discover-DJ-scripts.js +++ b/res/controllers/Ion-Discover-DJ-scripts.js @@ -52,7 +52,7 @@ IonDiscoverDJ.sendMidi = function(status, control, value, timeToWait) { if(timeToWait == 0) { midi.sendShortMsg(status, control, value); } else { - engine.beginTimer(timeToWait, "midi.sendShortMsg(" + status + ", " + control + ", " + value + ")", true); + engine.beginTimer(timeToWait, () => midi.sendShortMsg(status, control, value), true); } }; diff --git a/res/controllers/KANE_QuNeo_scripts.js b/res/controllers/KANE_QuNeo_scripts.js index de835cd4aa7..20e18ef25bf 100644 --- a/res/controllers/KANE_QuNeo_scripts.js +++ b/res/controllers/KANE_QuNeo_scripts.js @@ -531,7 +531,7 @@ KANE_QuNeo.jumpLoop = function (deck, numBeats) { if (KANE_QuNeo.jumpHoldTimers[channel].length < 1) KANE_QuNeo.jumpHoldTimers[channel].push( engine.beginTimer(KANE_QuNeo.jumpHoldTime, - "KANE_QuNeo.jumpHeld("+deck+","+numBeats+")", + () => KANE_QuNeo.jumpHeld(deck, numBeats), true)); // calculate samples per beat @@ -599,7 +599,8 @@ KANE_QuNeo.jumpLoop = function (deck, numBeats) { KANE_QuNeo.scheduleSync = function (deck, syncType) { engine.beginTimer( KANE_QuNeo.jumpSyncTimer, - "KANE_QuNeo.doSync("+deck+", \"" + syncType + "\")",true) + () => KANE_QuNeo.doSync(deck, syncType), + true); } KANE_QuNeo.doSync = function (deck, syncType) { @@ -614,7 +615,7 @@ KANE_QuNeo.doSync = function (deck, syncType) { // if our operation somehow changed loop enabling, immediately change it back engine.beginTimer(KANE_QuNeo.checkLoopDelay, - "KANE_QuNeo.checkLoop("+deck+","+loopEnabled+")", true); + () => KANE_QuNeo.checkLoop(deck, loopEnabled), true); } } @@ -637,8 +638,7 @@ KANE_QuNeo.syncTrack = function (deck, type, scheduleFlag) { KANE_QuNeo.scheduleLoop = function (deck, numBeats) { engine.beginTimer(KANE_QuNeo.jumpLoopTimer, - "KANE_QuNeo.doLoop("+deck+","+numBeats+")" - ,true) + () => KANE_QuNeo.doLoop(deck, numBeats), true); } KANE_QuNeo.doLoop = function (deck, numBeats) { @@ -669,7 +669,7 @@ KANE_QuNeo.deckMultiplyLoop = function (deck, factor) { // if our operation somehow changed loop enabling, immediately change it back engine.beginTimer(KANE_QuNeo.checkLoopDelay, - "KANE_QuNeo.checkLoop("+deck+","+loopEnabled+")", true); + () => KANE_QuNeo.checkLoop(deck, loopEnabled), true); // emit LED updates, timer because engine is slow at registering loop stuffs KANE_QuNeo.delayedAssertion("KANE_QuNeo.assertBeatLEDs("+deck+")",true); @@ -694,7 +694,7 @@ KANE_QuNeo.jumpHeld = function (deck, numBeats) { print("=====> AUTO JUMPING ACTIVATED WITH NUMBEATS: "+numBeats) KANE_QuNeo.jumpHoldTimers[channel].push( engine.beginTimer(KANE_QuNeo.autoJumpSpeed, - "KANE_QuNeo.jumpLoop("+deck+","+numBeats+")")); + () => KANE_QuNeo.jumpLoop(deck, numBeats))); } } @@ -717,7 +717,7 @@ KANE_QuNeo.verticalSliderTouch = function (slider, value) { KANE_QuNeo.verticalSliderDoubleTap[slider - 1] = 1; // then begin the reset timer engine.beginTimer(KANE_QuNeo.doubleTapWindow, - "KANE_QuNeo.resetDoubleTap("+slider+")", + () => KANE_QuNeo.resetDoubleTap(slider), true); } @@ -888,7 +888,8 @@ KANE_QuNeo.closeSliderMode = function () { KANE_QuNeo.deckZoom = function (deck, value) { var channel = deck - 1; // track channels start at 0 to properly reference arrays var channelName = KANE_QuNeo.getChannelName(deck) - var normalized = Math.ceil(6 * ((127 - value) / 127)) + // range is 1..10 + var normalized = Math.ceil(9 * ((127 - value) / 127)) + 1; // adjust zoom engine.setValue(channelName, "waveform_zoom", normalized) } @@ -913,7 +914,7 @@ KANE_QuNeo.visualNudge = function (deck, direction) { // then set timer to see if button is held for more than half a second KANE_QuNeo.visualNudgeTimers[channel].push( engine.beginTimer(KANE_QuNeo.visualNudgeHoldTime, - "KANE_QuNeo.visualNudgeHeld("+deck+","+direction+")", + () => KANE_QuNeo.visualNudgeHeld(deck, direction), true)) // then do the pressed nudge KANE_QuNeo.doVisualNudge(deck, direction); @@ -930,7 +931,7 @@ KANE_QuNeo.visualNudgeHeld = function (deck, direction) { // ...so set a persistent scroll timer KANE_QuNeo.visualNudgeTimers[channel].push( engine.beginTimer(KANE_QuNeo.visualNudgeSpeed, - "KANE_QuNeo.doVisualNudge("+deck+","+direction+")")) + () => KANE_QuNeo.visualNudgeAll(deck, direction))) } KANE_QuNeo.doVisualNudge = function (deck, direction) { @@ -963,7 +964,7 @@ KANE_QuNeo.rateNudgePress = function (deck, direction) { if (!(KANE_QuNeo.rateNudge)) KANE_QuNeo.rateNudgeTimers.push( engine.beginTimer(KANE_QuNeo.rateNudgeHoldTime, - "KANE_QuNeo.rateNudgeHeld("+deck+","+direction+")", + () => KANE_QuNeo.rateNudgeHeld(deck, direction), true)) else { // if we are currently auto nudging, KANE_QuNeo.cancelRateNudge(); // toggle it off @@ -979,7 +980,7 @@ KANE_QuNeo.rateNudgeHeld = function (deck, direction) { // then set a persistent nudge timer KANE_QuNeo.rateNudgeTimers.push( engine.beginTimer(KANE_QuNeo.rateNudgeSpeed, - "KANE_QuNeo.rateNudgeAll("+deck+","+direction+")")) + () => KANE_QuNeo.rateNudgeAll(deck, direction))) } KANE_QuNeo.rateNudgeAll = function (callingDeck, direction) { @@ -1210,9 +1211,7 @@ KANE_QuNeo.timeKeeper = function (deck, value) { KANE_QuNeo.nextBeatTimer[channel].length == 0) KANE_QuNeo.nextBeatTimer[channel] = [engine.beginTimer(KANE_QuNeo.beatOffset, - "KANE_QuNeo.handleBeat("+deck+")", - true)]; - + () => KANE_QuNeo.handleBeat(deck), true)]; // now determine whether or not the track has changed var channelName = KANE_QuNeo.getChannelName(deck); var trackSamples = engine.getValue(channelName, "track_samples"); @@ -1253,8 +1252,8 @@ KANE_QuNeo.handleBeat = function (deck) { // signify that this beat was reached outside the beat_active window engine.beginTimer(KANE_QuNeo.beatOffset, - "KANE_QuNeo.resetNextBeatTimer("+deck+")", - true); + () => KANE_QuNeo.resetNextBeatTimer(deck), + true); // record last beat number var lastWholeBeat = KANE_QuNeo.wholeBeat[channel]; @@ -1360,19 +1359,20 @@ KANE_QuNeo.scheduleBeat = function (deck, wholeBeat, direction) { and = 1000*(spb * 1/2); // and is symmetric in either direction // now set and store actual timers, in case we want to cancel them - var startOfCall = "KANE_QuNeo.deckBeatLEDs("+deck+","+wholeBeat+","; + + let makeHandler = division => () => KANE_QuNeo.deckBeatLEDs(deck,wholeBeat,division); // the beat itself, do it now KANE_QuNeo.deckBeatLEDs(deck,wholeBeat,0); // e, add this and the following quarters to our list of timers KANE_QuNeo.scheduledBeats[channel].push( - engine.beginTimer(e,startOfCall+"1/4)", true)) + engine.beginTimer(e,makeHandler(1/4), true)) // and KANE_QuNeo.scheduledBeats[channel].push( - engine.beginTimer(and,startOfCall+"1/2)", true)) + engine.beginTimer(and,makeHandler(1/2), true)) // uh KANE_QuNeo.scheduledBeats[channel].push( - engine.beginTimer(uh,startOfCall+"3/4)", true)) + engine.beginTimer(uh,makeHandler(3/4), true)) } /***** (U) Utilities *****/ @@ -2347,8 +2347,8 @@ KANE_QuNeo.masterVuMeter = function (value) { // Sliders KANE_QuNeo.deckZoomLEDs = function (deck, value) { var LEDGroup = KANE_QuNeo.getLEDGroup(deck); - // normalize zoom LED value to be 0-127 - var zoom = ((value - 1) / 5) * 127 + // normalize zoom LED value to be 0-127, range is 1..10 + var zoom = ((value - 1) / 9) * 127 // determine which control we are manipulating var control = KANE_QuNeo.getSliderControl(deck, 0) // emit message diff --git a/res/controllers/Korg-nanoKONTROL-2-scripts.js b/res/controllers/Korg-nanoKONTROL-2-scripts.js index 14c8c6c4ac0..bc0d834a3af 100644 --- a/res/controllers/Korg-nanoKONTROL-2-scripts.js +++ b/res/controllers/Korg-nanoKONTROL-2-scripts.js @@ -1,7 +1,7 @@ function NK2() {} NK2.debug=0;//set debug level NK2.LEDflasheson=true;//false disables led flash timers for debugging purposes -NK2.numDecks=8;//set to 8 for all [Channels], to 4 for 4 [Channels] and 4 [Samplers], and to 2 for 2 [Channels] and 6 [Samplers] +NK2.numDecks=4;//set to 4 for 4 [Channels] and 4 [Samplers], and to 2 for 2 [Channels] and 6 [Samplers] //############################################################################ //defaults //############################################################################ @@ -36,9 +36,7 @@ NK2.leftButton={"trdown":0x3A,"trup":0x3B,"cycle":0x2E,"mset":0x3C,"mdown":0x3D, NK2.faders={0x00:1,0x01:2,0x02:3,0x03:4,0x04:5,0x05:6,0x06:7,0x07:8}; //initialize decks -if (NK2.numDecks==8){ - NK2.Deck={1:"[Channel1]",2:"[Channel2]",3:"[Channel3]",4:"[Channel4]",5:"[Channel5]",6:"[Channel6]",7:"[Channel7]",8:"[Channel8]"};//list of decks, applied to each strip - 8 strips, 8 decks. (8 decks, 0 samplers) -}else if (NK2.numDecks==4){ +if (NK2.numDecks==4){ NK2.Deck={1:"[Channel1]",2:"[Channel2]",3:"[Channel3]",4:"[Channel4]",5:"[Sampler1]",6:"[Sampler2]",7:"[Sampler3]",8:"[Sampler4]"};//list of decks, applied to each strip - 8 strips, 8 decks. (4 decks, 4 samplers) }else if (NK2.numDecks==2){ NK2.Deck={1:"[Channel1]",2:"[Channel2]",3:"[Sampler1]",4:"[Sampler2]",5:"[Sampler3]",6:"[Sampler4]",7:"[Sampler5]",8:"[Sampler6]"};//list of decks, applied to each strip - 8 strips, 8 decks. (2 decks, 6 samplers) @@ -94,7 +92,7 @@ NK2.bankSelect = function bankSelect(deck, bank) { }else if (NK2.curNSMR=="R"){ NK2.LEDBankIndicator=NK2.Rbutton[NK2.curDeck]; } - if (NK2.LEDflasheson===true){engine.stopTimer(NK2.LEDtimer);NK2.LEDtimer=engine.beginTimer(750, "NK2.indicatorLEDs()");}//start timer for LED indicator flasher + if (NK2.LEDflasheson===true){engine.stopTimer(NK2.LEDtimer);NK2.LEDtimer=engine.beginTimer(750, NK2.indicatorLEDs);}//start timer for LED indicator flasher NK2.updateLEDs(); }; @@ -290,7 +288,7 @@ NK2.indicatorLEDs = function indicatorLEDs(value,group,control){ NK2.flashon=0; NK2.flashcount=0; - NK2.flashTimer=engine.beginTimer(100, "NK2.flashIndicators()"); + NK2.flashTimer=engine.beginTimer(100, NK2.flashIndicators); return true; }; @@ -508,9 +506,9 @@ NK2.toggleBinaryControlAll = function toggleBinaryControlAll(control){ NK2.wavezoomAll = function wavezoomAll(value){ if (NK2.debug>2){print("##function: "+NK2.getFunctionName())}; - var range=6-1; + var range=10-1; var newValue=Math.round(1+((value/127)*range)); - if (newValue>6)newValue=6; + if (newValue>10)newValue=10; if (newValue<1)newValue=1; if (NK2.lastwavevalue!=value){ for (var i=1; i<9; i++){ @@ -524,9 +522,9 @@ NK2.wavezoomDeck = function wavezoomDeck(value, group){ if (NK2.debug>2){print("##function: "+NK2.getFunctionName())}; if (group=="default"){group=NK2.Deck[NK2.curDeck];}; - var range=6-1; + var range=10-1; var newValue=Math.round(1+((value/127)*range)); - if (newValue>6)newValue=6; + if (newValue>10)newValue=10; if (newValue<1)newValue=1; if (NK2.lastwavevalue!=value){ engine.setValue(group, "waveform_zoom", newValue); @@ -598,7 +596,7 @@ NK2.cueClear = function cueClear(cue, control){//clear hotcue - OR move hotcue t if(engine.getValue(NK2.Deck[NK2.curDeck], "hotcue_"+cue+"_enabled")!=true){//hotcue not set - prepare to move next hotcue pressed to this button NK2.cueMoveToNum=cue; engine.stopTimer(NK2.cueMoveIndicator); - NK2.cueMoveIndicator=engine.beginTimer(100, "NK2.cueMoveIndicatorLEDs("+control+")");//start timer for LED indicator flasher showing the button we're moving to + NK2.cueMoveIndicator=engine.beginTimer(100, () => NK2.cueMoveIndicatorLEDs(control));//start timer for LED indicator flasher showing the button we're moving to return true; } @@ -707,7 +705,7 @@ NK2.reloopButton = function reloopButton(value) { engine.stopTimer(NK2.reloopTimer); NK2.loopbuttonDown=true; NK2.doreloop=true; - NK2.reloopTimer = engine.beginTimer(500, "NK2.disablereloop()", true); + NK2.reloopTimer = engine.beginTimer(500, NK2.disablereloop, true); } else {//button was released NK2.loopbuttonDown=false; if (NK2.doreloop===true) {engine.setValue(NK2.Deck[NK2.curDeck], "reloop_exit", 1);engine.setValue(NK2.Deck[NK2.curDeck], "reloop_exit", 0);}; @@ -725,7 +723,7 @@ NK2.loopin = function loopin(value) { engine.stopTimer(NK2.loopinTimer); NK2.loopinbuttonDown=true; NK2.doloopin=true; - NK2.loopinTimer = engine.beginTimer(500, "NK2.disableloopin()", true); + NK2.loopinTimer = engine.beginTimer(500, NK2.disableloopin, true); } else {//button was released NK2.loopinbuttonDown=false; if (NK2.doloopin===true) {engine.setValue(NK2.Deck[NK2.curDeck], "loop_in", 1);engine.setValue(NK2.Deck[NK2.curDeck], "loop_in", 0);}; @@ -743,7 +741,7 @@ NK2.loopout = function loopout(value) { engine.stopTimer(NK2.loopoutTimer); NK2.loopoutbuttonDown=true; NK2.doloopout=true; - NK2.loopoutTimer = engine.beginTimer(500, "NK2.disableloopout()", true); + NK2.loopoutTimer = engine.beginTimer(500, NK2.disableloopout, true); } else {//button was released NK2.loopoutbuttonDown=false; if (NK2.doloopout===true) {engine.setValue(NK2.Deck[NK2.curDeck], "loop_out", 1);engine.setValue(NK2.Deck[NK2.curDeck], "loop_out", 0);}; @@ -876,7 +874,7 @@ NK2.testleds=function testleds(){//sends LED on messages to all if (NK2.testLED>=127){return false; } NK2.testLED++ midi.sendShortMsg(0xB0, NK2.testLED, 0x7F); - NK2.LEDtimer=engine.beginTimer(100, "NK2.testleds()", true); + NK2.LEDtimer=engine.beginTimer(100, NK2.testleds, true); } //############################################################################ diff --git a/res/controllers/Korg-nanoPAD2-scripts.js b/res/controllers/Korg-nanoPAD2-scripts.js index 1032728321a..61c6757698f 100644 --- a/res/controllers/Korg-nanoPAD2-scripts.js +++ b/res/controllers/Korg-nanoPAD2-scripts.js @@ -130,7 +130,7 @@ NANOPAD2RK.reloopButton = function (channel, control, value, status, group) { NANOPAD2RK.loopbuttonDown=true; NANOPAD2RK.doreloop=true; - NANOPAD2RK.reloopTimer = engine.beginTimer(500, "NANOPAD2RK.disablereloop()", true); + NANOPAD2RK.reloopTimer = engine.beginTimer(500, NANOPAD2RK.disablereloop, true); }; NANOPAD2RK.reloopButtonRelease = function (channel, control, value, status, group) {//button was released diff --git a/res/controllers/Midi_for_light-scripts.js b/res/controllers/Midi_for_light-scripts.js index bcd1a108066..6c6cc073d8c 100644 --- a/res/controllers/Midi_for_light-scripts.js +++ b/res/controllers/Midi_for_light-scripts.js @@ -84,14 +84,14 @@ midi_for_light.init = function(id) { // called when the MIDI device is opened & engine.connectControl("[Master]", "crossfader", "midi_for_light.crossfaderChange"); - if (enable_vu_meter_global === true) midi_for_light.vu_meter_timer = engine.beginTimer(40, "midi_for_light.vuMeter()"); + if (enable_vu_meter_global === true) midi_for_light.vu_meter_timer = engine.beginTimer(40, midi_for_light.vuMeter); // Check midi_channel if value valid. Possible range is 1 to 16. if (midi_channel > 16) midi_channel = 16; if (midi_channel < 1) midi_channel = 1; for (var i = 0; i <= 3; i++) { - deck_beat_watchdog_timer[i] = engine.beginTimer(beat_watchdog_time, "midi_for_light.deckBeatWatchdog(" + i + ")"); + deck_beat_watchdog_timer[i] = engine.beginTimer(beat_watchdog_time, () => { midi_for_light.deckBeatWatchdog(i); }); engine.connectControl("[Channel" + (i + 1) + "]", "beat_active", "midi_for_light.deckBeatOutputToMidi"); engine.connectControl("[Channel" + (i + 1) + "]", "volume", "midi_for_light.deckVolumeChange"); engine.connectControl("[Channel" + (i + 1) + "]", "play", "midi_for_light.deckButtonPlay"); @@ -118,7 +118,7 @@ midi_for_light.deckButtonPlay = function(value, group, control) { // called when if (value == 1) { // deck play on engine.stopTimer(deck_beat_watchdog_timer[deck]); beat_watchdog[deck] = false; - deck_beat_watchdog_timer[deck] = engine.beginTimer(beat_watchdog_time, "midi_for_light.deckBeatWatchdog(" + deck + ")"); + deck_beat_watchdog_timer[deck] = engine.beginTimer(beat_watchdog_time, () => { midi_for_light.deckBeatWatchdog(deck); }); } else { // deck play stop engine.stopTimer(deck_beat_watchdog_timer[deck]); beat_watchdog[deck] = true; @@ -416,7 +416,7 @@ midi_for_light.deckVolumeChange = function(value, group, control) { // deck volu midi_for_light.deck_current = deckneu; midi.sendShortMsg(0x8F + midi_channel, 0x30, 0x64 + deckneu); // Note C on with 64 and add deck midi_for_light.volumeBeatBlockStatus = true; - midi_for_light.volumeBeatBlock_timer = engine.beginTimer(1000, "midi_for_light.volumeBeatBlock()"); + midi_for_light.volumeBeatBlock_timer = engine.beginTimer(1000, midi_for_light.volumeBeatBlock); } }; @@ -441,7 +441,7 @@ midi_for_light.crossfaderChange = function() { // crossfader chenge, check deck engine.stopTimer(midi_for_light.volumebeat_on_delay_timer); if (engine.getValue("[Master]", "crossfader") > -0.25) { // crossfader more than 25% left; if (engine.getValue("[Master]", "crossfader") < 0.25) { // crossfader more then 25% right; - midi_for_light.volumebeat_on_delay_timer = engine.beginTimer(3000, "midi_for_light.volumeBeatOnDelay()"); + midi_for_light.volumebeat_on_delay_timer = engine.beginTimer(3000, midi_for_light.volumeBeatOnDelay); } } @@ -463,7 +463,7 @@ midi_for_light.crossfaderChange = function() { // crossfader chenge, check deck midi_for_light.deck_current = deck; midi.sendShortMsg(0x8F + midi_channel, 0x30, 0x64 + deck); // note C on with value 64 + deck midi_for_light.crossfader_block = true; - midi_for_light.crossfader_change_block_timer = engine.beginTimer(1000, "midi_for_light.crossfaderChangeBlock()"); + midi_for_light.crossfader_change_block_timer = engine.beginTimer(1000, midi_for_light.crossfaderChangeBlock); } }; @@ -508,7 +508,7 @@ midi_for_light.deckBeatOutputToMidi = function(value, group, control) { // send // reset deck beat watchdog engine.stopTimer(deck_beat_watchdog_timer[deck]); beat_watchdog[deck] = false; - deck_beat_watchdog_timer[deck] = engine.beginTimer(beat_watchdog_time, "midi_for_light.deckBeatWatchdog(" + deck + ")"); + deck_beat_watchdog_timer[deck] = engine.beginTimer(beat_watchdog_time, () => { midi_for_light.deckBeatWatchdog(deck); }); // fit deck bpm to midi range 0-127 if (deck_bpm <= 0) deck_bpm = 0; diff --git a/res/controllers/Nintendo-Wiimote.js b/res/controllers/Nintendo-Wiimote.js index 5367e860967..9dfb9f576ff 100644 --- a/res/controllers/Nintendo-Wiimote.js +++ b/res/controllers/Nintendo-Wiimote.js @@ -408,7 +408,7 @@ Wiimote.init = function(id) { return; controller.timers[timer_id] = engine.beginTimer( interval, - "Wiimote.controller.autorepeatTimer()" + () => Wiimote.controller.autorepeatTimer() // FIXME: autorepeatTimer does not exist? ) } controller.setOutput("state","rumble",0); @@ -700,7 +700,7 @@ Wiimote.rumble = function(rumble,milliseconds) { if (milliseconds!=undefined && rumble) { controller.timers["rumble"] = engine.beginTimer( milliseconds, - "Wiimote.rumble(false)" + () => Wiimote.rumble(false) ); } else if ("rumble" in controller.timers) { engine.stopTimer(controller.timers["rumble"]); diff --git a/res/controllers/Novation-Dicer-scripts.js b/res/controllers/Novation-Dicer-scripts.js index 450a7047225..67a260e5343 100644 --- a/res/controllers/Novation-Dicer-scripts.js +++ b/res/controllers/Novation-Dicer-scripts.js @@ -320,12 +320,12 @@ NovationDicer.transformer = function(channel, control, value, status, group) if(group == "[Channel1]") { NovationDicer.gainCH1 = engine.getValue(group, "pregain"); - NovationDicer.timer1 = engine.beginTimer(((60000/engine.getValue(group,"bpm"))/8),"NovationDicer.stutter(\"[Channel1]\")"); + NovationDicer.timer1 = engine.beginTimer(((60000/engine.getValue(group,"bpm"))/8), () => NovationDicer.stutter("[Channel1]")); midi.sendShortMsg(0x9c,0x3f,NovationDicer.orange); } else { NovationDicer.gainCH2 = engine.getValue(group, "pregain"); - NovationDicer.timer2 = engine.beginTimer(((60000/engine.getValue(group,"bpm"))/8),"NovationDicer.stutter(\"[Channel2]\")"); + NovationDicer.timer2 = engine.beginTimer(((60000/engine.getValue(group,"bpm"))/8), () => NovationDicer.stutter("[Channel2]")); midi.sendShortMsg(0x9f,0x3f,NovationDicer.orange); } } else diff --git a/res/controllers/Novation-Launchpad MK2-scripts.js b/res/controllers/Novation-Launchpad MK2-scripts.js index f9a65dd9356..89bd921c094 100644 --- a/res/controllers/Novation-Launchpad MK2-scripts.js +++ b/res/controllers/Novation-Launchpad MK2-scripts.js @@ -4410,7 +4410,7 @@ var NLMK2 = (function () { waveform_zoom: { group: `[${type}${i}]`, name: 'waveform_zoom', - type: '1.0 - 6.0' + type: '1.0 - 10.0' }, waveform_zoom_up: { group: `[${type}${i}]`, @@ -4903,7 +4903,7 @@ var NLMK2 = (function () { start(interval) { if (this._state == null) { const started = Date.now(); - const handle = engine.beginTimer(interval, this.task); + const handle = engine.beginTimer(interval, this.task.bind(this)); this._state = { handle, started diff --git a/res/controllers/Novation-Launchpad Mini MK3-scripts.js b/res/controllers/Novation-Launchpad Mini MK3-scripts.js index ce1fb372417..e28d9e44d66 100644 --- a/res/controllers/Novation-Launchpad Mini MK3-scripts.js +++ b/res/controllers/Novation-Launchpad Mini MK3-scripts.js @@ -4410,7 +4410,7 @@ var NLMMK3 = (function () { waveform_zoom: { group: `[${type}${i}]`, name: 'waveform_zoom', - type: '1.0 - 6.0' + type: '1.0 - 10.0' }, waveform_zoom_up: { group: `[${type}${i}]`, @@ -4903,7 +4903,7 @@ var NLMMK3 = (function () { start(interval) { if (this._state == null) { const started = Date.now(); - const handle = engine.beginTimer(interval, this.task); + const handle = engine.beginTimer(interval, this.task.bind(this)); this._state = { handle, started diff --git a/res/controllers/Novation-Launchpad-Mini-scripts.js b/res/controllers/Novation-Launchpad-Mini-scripts.js index bacdb0de531..7f981a609c9 100644 --- a/res/controllers/Novation-Launchpad-Mini-scripts.js +++ b/res/controllers/Novation-Launchpad-Mini-scripts.js @@ -337,7 +337,8 @@ function ZoomKey(dir) { that.onPushOrig = that.onPush; that.onPush = function() { - if ( ZoomKey.zoom < 6 && this.dir == "+" ) { + // range is 1..10 + if ( ZoomKey.zoom < 10 && this.dir == "+" ) { ZoomKey.zoom++; } if ( ZoomKey.zoom > 1 && this.dir == "-") { diff --git a/res/controllers/Novation-Launchpad-scripts.js b/res/controllers/Novation-Launchpad-scripts.js index bc1d5643634..7f80657ed23 100644 --- a/res/controllers/Novation-Launchpad-scripts.js +++ b/res/controllers/Novation-Launchpad-scripts.js @@ -4410,7 +4410,7 @@ var NLMK1 = (function () { waveform_zoom: { group: `[${type}${i}]`, name: 'waveform_zoom', - type: '1.0 - 6.0' + type: '1.0 - 10.0' }, waveform_zoom_up: { group: `[${type}${i}]`, @@ -4902,7 +4902,7 @@ var NLMK1 = (function () { start(interval) { if (this._state == null) { const started = Date.now(); - const handle = engine.beginTimer(interval, this.task); + const handle = engine.beginTimer(interval, this.task.bind(this)); this._state = { handle, started diff --git a/res/controllers/Numark-DJ2Go-scripts.js b/res/controllers/Numark-DJ2Go-scripts.js index 115e3777767..ed21369ffae 100644 --- a/res/controllers/Numark-DJ2Go-scripts.js +++ b/res/controllers/Numark-DJ2Go-scripts.js @@ -114,7 +114,7 @@ NumarkDJ2Go.deck = function(deckNum) { var beta = (alpha/30); //Adjust to suit. engine.scratchEnable(this.deckNum, intervalsPerRev, rpm, alpha, beta); }; - this.scratchOff = function() { + this.scratchOff = () => { engine.scratchDisable(this.deckNum); this.scratchTimer= 0; }; @@ -130,7 +130,7 @@ NumarkDJ2Go.deck = function(deckNum) { var scrConst = 1; //Adjust to suit. var scrVal = (forwards)?scrConst:-scrConst; engine.scratchTick(this.deckNum, scrVal); - this.scratchTimer = engine.beginTimer(playDelay,"NumarkDJ2Go.decks.D" + this.deckNum + ".scratchOff()", true); + this.scratchTimer = engine.beginTimer(playDelay, NumarkDJ2Go.decks["D" + this.deckNum].scratchOff, true); }; //Pitchbend attribute. Required for pitchbend to be ramping (i.e speeds up/slows down the more the wheel is moved). this.bendVal= 0; @@ -150,12 +150,10 @@ NumarkDJ2Go.deck = function(deckNum) { nVal = (nVal > 3.0)?3.0:nVal; //If gone over 3, keep at 3. this.bendVal = (forwards)?nVal:-nVal; //Return to positive or minus number. engine.setValue(this.group, "jog", this.bendVal); - this.pitchTimer = engine.beginTimer(20,"NumarkDJ2Go.decks.D" + this.deckNum + ".pitchBendOff()", true); - }; - //Used by function above. Turns pitchbend off. - this.pitchBendOff = function() { - this.bendVal = 0; - this.pitchTimer= 0; + this.pitchTimer = engine.beginTimer(20, () => { + this.bendVal = 0; + this.pitchTimer= 0; + }, true); }; //Controls for the deck--buttons, sliders, etc--are associated with the deck using this array. this.control = []; @@ -193,7 +191,6 @@ NumarkDJ2Go.control = function(key, midino, group) { //actually illuminate. NumarkDJ2Go.light = function(group, midino, deckID, controlID) { this.midino = midino; - this.objStr= "NumarkDJ2Go.decks." + deckID + ".control." + controlID + ".light" this.lit = false; this.flashTimer= 0; this.flashOnceTimer= 0; @@ -201,15 +198,14 @@ NumarkDJ2Go.light = function(group, midino, deckID, controlID) { midi.sendShortMsg(0x90, this.midino, value); this.lit = value; }; - this.flashOnceOn = function() { + this.flashOnceOn = () => { midi.sendShortMsg(0x90, this.midino,1); - this.flashOnceTimer = engine.beginTimer(150, this.objStr + ".flashOnceOff()", true); - }; - this.flashOnceOff = function() { - midi.sendShortMsg(0x80, this.midino,1); - this.flashOnceTimer = 0; + this.flashOnceTimer = engine.beginTimer(150, () => { + midi.sendShortMsg(0x80, this.midino,1); + this.flashOnceTimer = 0; + }, true); }; - this.flashOff = function(relight) { + this.flashOff = relight => { if (this.flashTimer !== 0) { engine.stopTimer(this.flashTimer); @@ -233,10 +229,10 @@ NumarkDJ2Go.light = function(group, midino, deckID, controlID) { var relight = this.lit; this.flashOff(); this.flashOnceOn(); //This is because the timer take 600 milisecs before first flash. - this.flashTimer = engine.beginTimer(600, this.objStr + ".flashOnceOn()"); + this.flashTimer = engine.beginTimer(600, this.flashOnceOn); if (flashNo) { - engine.beginTimer((flashNo * 600) -50, this.objStr + ".flashOff(" + relight + ")", true); + engine.beginTimer((flashNo * 600) -50, () => this.flashOff(relight), true); }; }; }; diff --git a/res/controllers/Numark-Mixtrack-2-scripts.js b/res/controllers/Numark-Mixtrack-2-scripts.js index df15f6044c7..2d8a374ed9c 100644 --- a/res/controllers/Numark-Mixtrack-2-scripts.js +++ b/res/controllers/Numark-Mixtrack-2-scripts.js @@ -179,14 +179,14 @@ NumarkMixTrackII.jogWheel = function(channel, control, value, status, group) { if (NumarkMixTrackII.scratch_timer[deck - 1] != -1) { engine.stopTimer(NumarkMixTrackII.scratch_timer[deck - 1]); } - NumarkMixTrackII.scratch_timer[deck - 1] = engine.beginTimer(20, "NumarkMixTrackII.jogWheelStopScratch(" + deck + ")", true); + NumarkMixTrackII.scratch_timer[deck - 1] = engine.beginTimer(20, () => NumarkMixTrackII.jogWheelStopScratch(deck), true); } } else { if (!NumarkMixTrackII.touch[deck - 1]) { if (NumarkMixTrackII.scratch_timer[deck - 1] != -1) { engine.stopTimer(NumarkMixTrackII.scratch_timer[deck - 1]); } - NumarkMixTrackII.scratch_timer[deck - 1] = engine.beginTimer(20, "NumarkMixTrackII.jogWheelStopScratch(" + deck + ")", true); + NumarkMixTrackII.scratch_timer[deck - 1] = engine.beginTimer(20, () => NumarkMixTrackII.jogWheelStopScratch(deck), true); } } @@ -221,7 +221,7 @@ NumarkMixTrackII.wheelTouch = function(channel, control, value, status, group){ engine.stopTimer(NumarkMixTrackII.scratch_timer[deck - 1]); } - NumarkMixTrackII.scratch_timer[deck - 1] = engine.beginTimer(20, "NumarkMixTrackII.jogWheelStopScratch(" + deck + ")", true); + NumarkMixTrackII.scratch_timer[deck - 1] = engine.beginTimer(20, () => NumarkMixTrackII.jogWheelStopScratch(deck), true); } else { if (!NumarkMixTrackII.scratch_mode[deck - 1] && engine.getValue(group, "play")) { return; diff --git a/res/controllers/Numark-Mixtrack-3-scripts.js b/res/controllers/Numark-Mixtrack-3-scripts.js index ec98504c0ac..a658b0842f3 100644 --- a/res/controllers/Numark-Mixtrack-3-scripts.js +++ b/res/controllers/Numark-Mixtrack-3-scripts.js @@ -312,9 +312,7 @@ LED.prototype.flashOn = function(num_ms_on, value, num_ms_off, flashCount, relig // so we don't need this part if flashcount == 1 // permanent timer - this.flashTimer = engine.beginTimer(num_ms_on + num_ms_off, function() { - this.flashOnceOn(false); - }); + this.flashTimer = engine.beginTimer(num_ms_on + num_ms_off, ()=>this.flashOnceOn(false)); } if (flashCount > 1) { @@ -322,9 +320,7 @@ LED.prototype.flashOn = function(num_ms_on, value, num_ms_off, flashCount, relig // so we don't need this part if flashcount=1 // temporary timer. The end of this timer stops the permanent flashing - this.flashTimer2 = engine.beginTimer(flashCount * (num_ms_on + num_ms_off) - num_ms_off, function() { - this.stopflash(relight); - }, true); + this.flashTimer2 = engine.beginTimer(flashCount * (num_ms_on + num_ms_off) - num_ms_off, ()=>this.stopflash(relight), true); } }; @@ -371,9 +367,7 @@ LED.prototype.flashOnceOn = function(relight) { sendShortMsg(this.control, this.midino, this.valueon); pauseScript(scriptpause); this.flashOnceDuration = this.num_ms_on; - this.flashOnceTimer = engine.beginTimer(this.num_ms_on - scriptpause, function() { - this.flashOnceOff(relight); - }, true); + this.flashOnceTimer = engine.beginTimer(this.num_ms_on - scriptpause, ()=>this.flashOnceOff(relight), true); }; // private :call back function (called in flashOnceOn() ) diff --git a/res/controllers/Numark-Mixtrack-Platinum-scripts.js b/res/controllers/Numark-Mixtrack-Platinum-scripts.js index 0e8ce011a19..c870c56973f 100644 --- a/res/controllers/Numark-Mixtrack-Platinum-scripts.js +++ b/res/controllers/Numark-Mixtrack-Platinum-scripts.js @@ -396,7 +396,7 @@ MixtrackPlatinum.EffectUnit = function (unitNumbers) { } var button = this; - this.flash_timer = engine.beginTimer(time, function() { + this.flash_timer = engine.beginTimer(time, () => { if (button.flash_state) { button.send(button.on); button.flash_state = false; @@ -405,7 +405,7 @@ MixtrackPlatinum.EffectUnit = function (unitNumbers) { button.send(button.off); button.flash_state = true; } - }.bind(this)); + }); }, stopFlash: function() { engine.stopTimer(this.flash_timer); @@ -1190,7 +1190,7 @@ MixtrackPlatinum.startScratchTimer = function (deck) { if (MixtrackPlatinum.scratch_timer[deck]) return; MixtrackPlatinum.scratch_tick[deck] = 0; - MixtrackPlatinum.scratch_timer[deck] = engine.beginTimer(20, function() { + MixtrackPlatinum.scratch_timer[deck] = engine.beginTimer(20, () => { MixtrackPlatinum.scratchTimerCallback(deck); }); }; diff --git a/res/controllers/Numark-Mixtrack-Pro-FX-scripts.js b/res/controllers/Numark-Mixtrack-Pro-FX-scripts.js index f2a62577cfb..82036d1710c 100644 --- a/res/controllers/Numark-Mixtrack-Pro-FX-scripts.js +++ b/res/controllers/Numark-Mixtrack-Pro-FX-scripts.js @@ -536,7 +536,7 @@ MixtrackProFX.PadSection = function(deckNumber) { this.blinkLedOn = function(midi1, midi2) { this.blinkLedOff(); this.blinkLedState = true; - this.blinkTimer = engine.beginTimer(MixtrackProFX.blinkDelay, function() { + this.blinkTimer = engine.beginTimer(MixtrackProFX.blinkDelay, () => { midi.sendShortMsg(midi1, midi2, this.blinkLedState ? 0x7F : 0x01); this.blinkLedState = !this.blinkLedState; }); diff --git a/res/controllers/Numark-Mixtrack-Pro-scripts.js b/res/controllers/Numark-Mixtrack-Pro-scripts.js index d1d7df6307c..1bbf23d5ec7 100644 --- a/res/controllers/Numark-Mixtrack-Pro-scripts.js +++ b/res/controllers/Numark-Mixtrack-Pro-scripts.js @@ -220,8 +220,7 @@ NumarkMixTrackPro.setLED = function(value, status) { NumarkMixTrackPro.flashLED = function (led, veces){ var ndx = Math.random(); - var func = "NumarkMixTrackPro.doFlash(" + ndx + ", " + veces + ")"; - var id = engine.beginTimer(120, func); + var id = engine.beginTimer(120, NumarkMixTrackPro.doFlash(ndx, veces)); NumarkMixTrackPro.ledTimers[ndx] = new NumarkMixTrackPro.LedTimer(id, led, 0, false); } @@ -589,7 +588,7 @@ NumarkMixTrackPro.jogWheel = function(channel, control, value, status, group) { if (NumarkMixTrackPro.scratchMode[deck-1] && posNeg == -1 && !NumarkMixTrackPro.touch[deck-1]) { if (NumarkMixTrackPro.scratchTimer[deck-1] != -1) engine.stopTimer(NumarkMixTrackPro.scratchTimer[deck-1]); - NumarkMixTrackPro.scratchTimer[deck-1] = engine.beginTimer(20, "NumarkMixTrackPro.jogWheelStopScratch(" + deck + ")", true); + NumarkMixTrackPro.scratchTimer[deck-1] = engine.beginTimer(20, () => {NumarkMixTrackPro.jogWheelStopScratch(deck); }, true); } } else { // stop scratching @@ -597,7 +596,7 @@ NumarkMixTrackPro.jogWheel = function(channel, control, value, status, group) { if (!NumarkMixTrackPro.touch[deck-1]){ if (NumarkMixTrackPro.scratchTimer[deck-1] != -1) engine.stopTimer(NumarkMixTrackPro.scratchTimer[deck-1]); - NumarkMixTrackPro.scratchTimer[deck-1] = engine.beginTimer(20, "NumarkMixTrackPro.jogWheelStopScratch(" + deck + ")", true); + NumarkMixTrackPro.scratchTimer[deck-1] = engine.beginTimer(20, () => { NumarkMixTrackPro.jogWheelStopScratch(); }, true); } } @@ -635,7 +634,7 @@ NumarkMixTrackPro.wheelTouch = function(channel, control, value, status, group){ if (NumarkMixTrackPro.scratchTimer[deck-1] != -1) engine.stopTimer(NumarkMixTrackPro.scratchTimer[deck-1]); - NumarkMixTrackPro.scratchTimer[deck-1] = engine.beginTimer(20, "NumarkMixTrackPro.jogWheelStopScratch(" + deck + ")", true); + NumarkMixTrackPro.scratchTimer[deck-1] = engine.beginTimer(20, () => { NumarkMixTrackPro.jogWheelStopScratch(deck); }, true); } else { diff --git a/res/controllers/Numark-N4-scripts.js b/res/controllers/Numark-N4-scripts.js index 80233aca9a2..ed65e51e0b5 100644 --- a/res/controllers/Numark-N4-scripts.js +++ b/res/controllers/Numark-N4-scripts.js @@ -228,10 +228,10 @@ NumarkN4.topContainer = function(channel) { midi.sendShortMsg(0xB0+channel, 0x0B+i, (i-this.hotCuePage)?0x00:0x7F); } } - this.timer = engine.beginTimer(1000, function() { + this.timer = engine.beginTimer(1000, () => { theContainer.reconnectComponents(); this.timer = 0; - }.bind(this), true); + }, true); }, shift: function() { this.group=theContainer.group; @@ -492,9 +492,9 @@ NumarkN4.Deck = function(channel) { if (this.inGetParameter()!==value) { this.inSetParameter(value); } - engine.beginTimer(100, function() { + engine.beginTimer(100, () => { this.flickerSafetyTimeout=true; - }.bind(this), true); + }, true); } }, }); @@ -564,7 +564,7 @@ NumarkN4.Deck = function(channel) { }, }); - this.manageChannelIndicator = function() { + this.manageChannelIndicator = () => { this.duration=engine.getParameter(theDeck.group, "duration"); // checks if the playposition is in the warnTimeFrame if (engine.getParameter(theDeck.group, "playposition") * this.duration > (this.duration - NumarkN4.warnAfterTime)) { @@ -586,7 +586,7 @@ NumarkN4.Deck = function(channel) { // spawned which conflicted with the old (still running) timers. if (!this.previouslyLoaded) { //timer is more efficient is this case than a callback because it would be called too often. - theDeck.blinkTimer=engine.beginTimer(NumarkN4.blinkInterval, theDeck.manageChannelIndicator.bind(this)); + theDeck.blinkTimer=engine.beginTimer(NumarkN4.blinkInterval, theDeck.manageChannelIndicator); } this.previouslyLoaded=value; }.bind(this)); diff --git a/res/controllers/Numark-Omni-Control-scripts.js b/res/controllers/Numark-Omni-Control-scripts.js index 556069a4bf1..5411520ffca 100644 --- a/res/controllers/Numark-Omni-Control-scripts.js +++ b/res/controllers/Numark-Omni-Control-scripts.js @@ -127,7 +127,7 @@ NumarkTotalControl.loopOut = function(channel, control, value, status, group) { // Get current position by temporary setting loop start NumarkTotalControl.oldLoopStart[deck-1] = start; engine.setValue(group, "loop_in", 1); - engine.beginTimer(20, "NumarkTotalControl.loopExtendedAdjustment('" + group + "')", true); + engine.beginTimer(20, () => NumarkTotalControl.loopExtendedAdjustment(group), true); } } else { engine.setValue(group, "loop_out", 1); @@ -144,7 +144,7 @@ NumarkTotalControl.loopExtendedAdjustment = function(group) { var start = engine.getValue(group, "loop_start_position"); if (start == NumarkTotalControl.oldLoopStart[deck-1]) { // Still old loop start -> retry later - engine.beginTimer(20, "NumarkTotalControl.loopExtendedAdjustment('" + group + "')", true); + engine.beginTimer(20, () => NumarkTotalControl.loopExtendedAdjustment(group), true); return; } @@ -208,7 +208,7 @@ NumarkTotalControl.loopExtendedChange = function(group, timerCall) { NumarkTotalControl.extendedLoopingLEDState[deck-1] = engine.getValue(group, "loop_enabled"); // Start LED blink timer NumarkTotalControl.loopLEDBlink(deck); - NumarkTotalControl.extendedLoopingLEDTimer[deck-1] = engine.beginTimer(333, "NumarkTotalControl.loopLEDBlink(" + deck + ")"); + NumarkTotalControl.extendedLoopingLEDTimer[deck-1] = engine.beginTimer(333, () => NumarkTotalControl.loopLEDBlink(deck)); } } @@ -260,7 +260,7 @@ NumarkTotalControl.extendedFunctionButton = function(normalFunction, extendedLoo NumarkTotalControl.extendedLoopingChanged[deck-1] = false; NumarkTotalControl.extendedLoopingJogCarryOver[deck-1] = 0; // Start alternative function timer -> activated after button was 500msec pressed or jog wheel movement (see jogWheel function) - NumarkTotalControl.extendedLoopingLEDTimer[deck-1] = engine.beginTimer(500, "NumarkTotalControl.loopExtendedChange('" + group + "', true)", true); + NumarkTotalControl.extendedLoopingLEDTimer[deck-1] = engine.beginTimer(500, () => NumarkTotalControl.loopExtendedChange(group, true), true); } } else { // Check if alternative function wasn't used @@ -307,7 +307,7 @@ NumarkTotalControl.quantizeLED = function(value, group, key) { NumarkTotalControl.setLED(NumarkTotalControl.leds[0]["quantize"], deck1); } else if (NumarkTotalControl.quantizeLEDTimer == -1) { NumarkTotalControl.quantizeLEDBlink(); - NumarkTotalControl.quantizeLEDTimer = engine.beginTimer(333, "NumarkTotalControl.quantizeLEDBlink()"); + NumarkTotalControl.quantizeLEDTimer = engine.beginTimer(333, () => NumarkTotalControl.quantizeLEDBlink()); } } @@ -408,7 +408,7 @@ NumarkTotalControl.jogWheel = function(channel, control, value, status, group) { engine.stopTimer(NumarkTotalControl.scratchTimer[deck-1]); } engine.scratchTick(deck, adjustedJog); - NumarkTotalControl.scratchTimer[deck-1] = engine.beginTimer(20, "NumarkTotalControl.jogWheelStopScratch(" + deck + ")", true); + NumarkTotalControl.scratchTimer[deck-1] = engine.beginTimer(20, () => NumarkTotalControl.jogWheelStopScratch(deck), true); } else { var gammaInputRange = 64; // Max jog speed var maxOutFraction = 0.5; // Where on the curve it should peak; 0.5 is half-way diff --git a/res/controllers/Numark-Party-Mix.scripts.js b/res/controllers/Numark-Party-Mix.scripts.js index c1ece5ffc3b..e924596ff98 100644 --- a/res/controllers/Numark-Party-Mix.scripts.js +++ b/res/controllers/Numark-Party-Mix.scripts.js @@ -152,7 +152,7 @@ NumarkPartyMix.Deck = function(deckNumber) { } if (deck.scratchModeEnabled) { - this.touchTimer = engine.beginTimer(50, function() { + this.touchTimer = engine.beginTimer(50, () => { engine.scratchDisable(deckNumber); }, true); @@ -354,7 +354,7 @@ NumarkPartyMix.Browse = function() { browse.knobpressed = this.isPress(channel, control, value, status); if (browse.knobpressed) { this.isLongPressed = false; - this.longPressTimer = engine.beginTimer(this.longPressTimeout, function() { + this.longPressTimer = engine.beginTimer(this.longPressTimeout, () => { this.isLongPressed = true; this.longPressTimer = 0; }, true); diff --git a/res/controllers/Numark-Total-Control-scripts.js b/res/controllers/Numark-Total-Control-scripts.js index 556069a4bf1..341c9a42432 100644 --- a/res/controllers/Numark-Total-Control-scripts.js +++ b/res/controllers/Numark-Total-Control-scripts.js @@ -127,7 +127,7 @@ NumarkTotalControl.loopOut = function(channel, control, value, status, group) { // Get current position by temporary setting loop start NumarkTotalControl.oldLoopStart[deck-1] = start; engine.setValue(group, "loop_in", 1); - engine.beginTimer(20, "NumarkTotalControl.loopExtendedAdjustment('" + group + "')", true); + engine.beginTimer(20, () => NumarkTotalControl.loopExtendedAdjustment(group), true); } } else { engine.setValue(group, "loop_out", 1); @@ -144,7 +144,7 @@ NumarkTotalControl.loopExtendedAdjustment = function(group) { var start = engine.getValue(group, "loop_start_position"); if (start == NumarkTotalControl.oldLoopStart[deck-1]) { // Still old loop start -> retry later - engine.beginTimer(20, "NumarkTotalControl.loopExtendedAdjustment('" + group + "')", true); + engine.beginTimer(20, () => { NumarkTotalControl.loopExtendedAdjustment(group); }, true); return; } @@ -208,7 +208,7 @@ NumarkTotalControl.loopExtendedChange = function(group, timerCall) { NumarkTotalControl.extendedLoopingLEDState[deck-1] = engine.getValue(group, "loop_enabled"); // Start LED blink timer NumarkTotalControl.loopLEDBlink(deck); - NumarkTotalControl.extendedLoopingLEDTimer[deck-1] = engine.beginTimer(333, "NumarkTotalControl.loopLEDBlink(" + deck + ")"); + NumarkTotalControl.extendedLoopingLEDTimer[deck-1] = engine.beginTimer(333, () => { NumarkTotalControl.loopLEDBlink(deck); }); } } @@ -260,7 +260,7 @@ NumarkTotalControl.extendedFunctionButton = function(normalFunction, extendedLoo NumarkTotalControl.extendedLoopingChanged[deck-1] = false; NumarkTotalControl.extendedLoopingJogCarryOver[deck-1] = 0; // Start alternative function timer -> activated after button was 500msec pressed or jog wheel movement (see jogWheel function) - NumarkTotalControl.extendedLoopingLEDTimer[deck-1] = engine.beginTimer(500, "NumarkTotalControl.loopExtendedChange('" + group + "', true)", true); + NumarkTotalControl.extendedLoopingLEDTimer[deck-1] = engine.beginTimer(500, () => {NumarkTotalControl.loopExtendedChange(group, true); }, true); } } else { // Check if alternative function wasn't used @@ -307,7 +307,7 @@ NumarkTotalControl.quantizeLED = function(value, group, key) { NumarkTotalControl.setLED(NumarkTotalControl.leds[0]["quantize"], deck1); } else if (NumarkTotalControl.quantizeLEDTimer == -1) { NumarkTotalControl.quantizeLEDBlink(); - NumarkTotalControl.quantizeLEDTimer = engine.beginTimer(333, "NumarkTotalControl.quantizeLEDBlink()"); + NumarkTotalControl.quantizeLEDTimer = engine.beginTimer(333, NumarkTotalControl.quantizeLEDBlink); } } @@ -408,7 +408,7 @@ NumarkTotalControl.jogWheel = function(channel, control, value, status, group) { engine.stopTimer(NumarkTotalControl.scratchTimer[deck-1]); } engine.scratchTick(deck, adjustedJog); - NumarkTotalControl.scratchTimer[deck-1] = engine.beginTimer(20, "NumarkTotalControl.jogWheelStopScratch(" + deck + ")", true); + NumarkTotalControl.scratchTimer[deck-1] = engine.beginTimer(20, () => { NumarkTotalControl.jogWheelStopScratch(deck); }, true); } else { var gammaInputRange = 64; // Max jog speed var maxOutFraction = 0.5; // Where on the curve it should peak; 0.5 is half-way diff --git a/res/controllers/Numark-V7-scripts.js b/res/controllers/Numark-V7-scripts.js index aaab51bf482..ab8ceb1fc48 100644 --- a/res/controllers/Numark-V7-scripts.js +++ b/res/controllers/Numark-V7-scripts.js @@ -64,7 +64,7 @@ NumarkV7.RPM = 33+1/3; //Motor-Scratch rpm NumarkV7.init = function () { //flash LED's NumarkV7.FlashAllLED(1000); - engine.beginTimer(3500, "NumarkV7.init2()", true); + engine.beginTimer(3500, NumarkV7.init2, true); } NumarkV7.init2 = function () { //Tap Light @@ -176,36 +176,36 @@ NumarkV7.shutdown = function () { NumarkV7.FlashAllLED = function (sustain) { midi.sendShortMsg(0xB0,0x39,0x01); - engine.beginTimer(sustain, "NumarkV7.OffAllLED()", true); - engine.beginTimer(sustain, "NumarkV7.RunLED()", true); + engine.beginTimer(sustain, NumarkV7.OffAllLED, true); + engine.beginTimer(sustain, NumarkV7.RunLED, true ); } NumarkV7.OffAllLED = function () { midi.sendShortMsg(0xB0,0x39,0x00); } NumarkV7.RunLED = function () { NumarkV7.RunLED1() - engine.beginTimer(100, "NumarkV7.RunLED2()", true); - engine.beginTimer(200, "NumarkV7.RunLED3()", true); - engine.beginTimer(300, "NumarkV7.RunLED4()", true); - engine.beginTimer(400, "NumarkV7.RunLED5()", true); - engine.beginTimer(500, "NumarkV7.RunLED6()", true); - engine.beginTimer(600, "NumarkV7.RunLED7()", true); - engine.beginTimer(700, "NumarkV7.RunLED8()", true); - engine.beginTimer(800, "NumarkV7.RunLED9()", true); - engine.beginTimer(900, "NumarkV7.RunLED10()", true); - engine.beginTimer(1000, "NumarkV7.RunLED11()", true); - engine.beginTimer(1100, "NumarkV7.RunLED12()", true); - engine.beginTimer(1200, "NumarkV7.RunLED11()", true); - engine.beginTimer(1300, "NumarkV7.RunLED10()", true); - engine.beginTimer(1400, "NumarkV7.RunLED9()", true); - engine.beginTimer(1500, "NumarkV7.RunLED8()", true); - engine.beginTimer(1600, "NumarkV7.RunLED7()", true); - engine.beginTimer(1700, "NumarkV7.RunLED6()", true); - engine.beginTimer(1800, "NumarkV7.RunLED5()", true); - engine.beginTimer(1900, "NumarkV7.RunLED4()", true); - engine.beginTimer(2000, "NumarkV7.RunLED3()", true); - engine.beginTimer(2100, "NumarkV7.RunLED2()", true); - engine.beginTimer(2200, "NumarkV7.RunLED13()", true); + engine.beginTimer(100, NumarkV7.RunLED2 , true); + engine.beginTimer(200, NumarkV7.RunLED3 , true); + engine.beginTimer(300, NumarkV7.RunLED4 , true); + engine.beginTimer(400, NumarkV7.RunLED5 , true); + engine.beginTimer(500, NumarkV7.RunLED6 , true); + engine.beginTimer(600, NumarkV7.RunLED7 , true); + engine.beginTimer(700, NumarkV7.RunLED8 , true); + engine.beginTimer(800, NumarkV7.RunLED9 , true); + engine.beginTimer(900, NumarkV7.RunLED10 , true); + engine.beginTimer(1000, NumarkV7.RunLED11 , true); + engine.beginTimer(1100, NumarkV7.RunLED12 , true); + engine.beginTimer(1200, NumarkV7.RunLED11 , true); + engine.beginTimer(1300, NumarkV7.RunLED10 , true); + engine.beginTimer(1400, NumarkV7.RunLED9 , true); + engine.beginTimer(1500, NumarkV7.RunLED8 , true); + engine.beginTimer(1600, NumarkV7.RunLED7 , true); + engine.beginTimer(1700, NumarkV7.RunLED6 , true); + engine.beginTimer(1800, NumarkV7.RunLED5 , true); + engine.beginTimer(1900, NumarkV7.RunLED4 , true); + engine.beginTimer(2000, NumarkV7.RunLED3 , true); + engine.beginTimer(2100, NumarkV7.RunLED2 , true); + engine.beginTimer(2200, NumarkV7.RunLED13 , true); } NumarkV7.RunLED1 = function () { midi.sendShortMsg(0xB0,0x34,0x01); @@ -1030,7 +1030,7 @@ NumarkV7.PitchA = function () { engine.scratchDisable(1, false); NumarkV7.PitchAPause = 2; if (!NumarkV7.PitchAPauseOn) { - NumarkV7.timer1 = engine.beginTimer(100, "NumarkV7.PitchScratchEnableA"); + NumarkV7.timer1 = engine.beginTimer(100, NumarkV7.PitchScratchEnableA); } } engine.setValue("[Channel1]","rate", (currentvalue * 1)); @@ -1075,7 +1075,7 @@ NumarkV7.PitchB = function () { engine.scratchDisable(2, false); NumarkV7.PitchBPause = 2; if (!NumarkV7.PitchBPauseOn) { - NumarkV7.timer2 = engine.beginTimer(100, "NumarkV7.PitchScratchEnableB"); + NumarkV7.timer2 = engine.beginTimer(100, NumarkV7.PitchScratchEnableB); } } engine.setValue("[Channel2]","rate", (currentvalue * 1)); diff --git a/res/controllers/Pioneer-DDJ-200-scripts.js b/res/controllers/Pioneer-DDJ-200-scripts.js index e1f03a234a2..6514982d87c 100644 --- a/res/controllers/Pioneer-DDJ-200-scripts.js +++ b/res/controllers/Pioneer-DDJ-200-scripts.js @@ -56,7 +56,7 @@ DDJ200.init = function() { DDJ200.LEDsOff(); // start with focus on library for selecting tracks (delay seems required) - engine.beginTimer(500, function() { + engine.beginTimer(500, () => { engine.setValue("[Library]", "MoveFocus", 1); }, true); @@ -152,11 +152,11 @@ DDJ200.touch = function(channel, control, value, status, group) { var alpha = 1.0 / 8; engine.scratchEnable(vDeckNo, 128, 33 + 1 / 3, alpha, alpha / 32); // disable jog not to prevent track alignment - DDJ200.vDeck[vDeckNo]["jogEnabled"] = false; + DDJ200.vDeck[vDeckNo].jogEnabled = false; } else { // enable jog after 900 ms again - engine.beginTimer(900, function() { - DDJ200.vDeck[vDeckNo]["jogEnabled"] = true; + engine.beginTimer(900, () => { + DDJ200.vDeck[vDeckNo].jogEnabled = true; }, true); // disable scratch engine.scratchDisable(vDeckNo); diff --git a/res/controllers/Pioneer-DDJ-400-script.js b/res/controllers/Pioneer-DDJ-400-script.js index aa7ac851f28..a818f1703ec 100644 --- a/res/controllers/Pioneer-DDJ-400-script.js +++ b/res/controllers/Pioneer-DDJ-400-script.js @@ -352,7 +352,7 @@ PioneerDDJ400.startLoopLightsBlink = function(channel, control, status, group) { PioneerDDJ400.stopLoopLightsBlink(group, control, status); - PioneerDDJ400.timers[group][control] = engine.beginTimer(500, function() { + PioneerDDJ400.timers[group][control] = engine.beginTimer(500, () => { blink = 0x7F - blink; // When adjusting the loop out position, turn the loop in light off @@ -606,7 +606,7 @@ PioneerDDJ400.startSamplerBlink = function(channel, control, group) { let val = 0x7f; PioneerDDJ400.stopSamplerBlink(channel, control); - PioneerDDJ400.timers[channel][control] = engine.beginTimer(250, function() { + PioneerDDJ400.timers[channel][control] = engine.beginTimer(250, () => { val = 0x7f - val; // blink the appropriate pad diff --git a/res/controllers/Pioneer-DDJ-FLX4-script.js b/res/controllers/Pioneer-DDJ-FLX4-script.js index 7c9ea88d5b5..1b9012a267d 100644 --- a/res/controllers/Pioneer-DDJ-FLX4-script.js +++ b/res/controllers/Pioneer-DDJ-FLX4-script.js @@ -423,7 +423,7 @@ PioneerDDJFLX4.startLoopLightsBlink = function(channel, control, status, group) PioneerDDJFLX4.stopLoopLightsBlink(group, control, status); - PioneerDDJFLX4.timers[group][control] = engine.beginTimer(500, function() { + PioneerDDJFLX4.timers[group][control] = engine.beginTimer(500, () => { blink = 0x7F - blink; // When adjusting the loop out position, turn the loop in light off @@ -718,7 +718,7 @@ PioneerDDJFLX4.startSamplerBlink = function(channel, control, group) { let val = 0x7f; PioneerDDJFLX4.stopSamplerBlink(channel, control); - PioneerDDJFLX4.timers[channel][control] = engine.beginTimer(250, function() { + PioneerDDJFLX4.timers[channel][control] = engine.beginTimer(250, () => { val = 0x7f - val; // blink the appropriate pad diff --git a/res/controllers/Pioneer-DDJ-SB2-scripts.js b/res/controllers/Pioneer-DDJ-SB2-scripts.js index 5aecfb954e0..8c18d6cb2fe 100644 --- a/res/controllers/Pioneer-DDJ-SB2-scripts.js +++ b/res/controllers/Pioneer-DDJ-SB2-scripts.js @@ -180,7 +180,7 @@ PioneerDDJSB2.init = function(_id) { PioneerDDJSB2.initDeck("[Channel4]"); if (PioneerDDJSB2.twinkleVumeterAutodjOn) { - PioneerDDJSB2.vuMeterTimer = engine.beginTimer(100, "PioneerDDJSB2.vuMeterTwinkle()"); + PioneerDDJSB2.vuMeterTimer = engine.beginTimer(100, PioneerDDJSB2.vuMeterTwinkle); } // request the positions of the knobs and faders from the controller @@ -702,7 +702,7 @@ PioneerDDJSB2.shiftKeyLockButton = function(channel, control, value, status, gro var deck = status - 0x90; if (value) { engine.stopTimer(PioneerDDJSB2.speedRateToNormalTimer[deck]); - PioneerDDJSB2.speedRateToNormalTimer[deck] = engine.beginTimer(PioneerDDJSB2.speedRateToNormalTime, "PioneerDDJSB2.speedRateToNormal('" + group + "', " + deck + ")"); + PioneerDDJSB2.speedRateToNormalTimer[deck] = engine.beginTimer(PioneerDDJSB2.speedRateToNormalTime, () => { PioneerDDJSB2.speedRateToNormal(group, deck); }, true); } }; @@ -1130,7 +1130,7 @@ PioneerDDJSB2.EffectUnit = function(unitNumber) { input: function(channel, control, value, status) { if (this.isPress(channel, control, value, status)) { this.isLongPressed = false; - this.longPressTimer = engine.beginTimer(this.longPressTimeout, function() { + this.longPressTimer = engine.beginTimer(this.longPressTimeout, () => { var effectGroup = "[EffectRack1_EffectUnit" + unitNumber + "_Effect" + this.buttonNumber + "]"; script.toggleControl(effectGroup, "enabled"); this.isLongPressed = true; diff --git a/res/controllers/Pioneer-DDJ-SB3-scripts.js b/res/controllers/Pioneer-DDJ-SB3-scripts.js index ba5d2441790..f9cc01e9c53 100755 --- a/res/controllers/Pioneer-DDJ-SB3-scripts.js +++ b/res/controllers/Pioneer-DDJ-SB3-scripts.js @@ -140,7 +140,7 @@ PioneerDDJSB3.flasher.functions = []; PioneerDDJSB3.flasher.init = function() { var flag = true; - PioneerDDJSB3.flasher.timer = engine.beginTimer(500, function() { + PioneerDDJSB3.flasher.timer = engine.beginTimer(500, () => { flag = !flag; for (var i = 0; i < PioneerDDJSB3.flasher.functions.length; i++) { @@ -277,7 +277,7 @@ PioneerDDJSB3.init = function() { PioneerDDJSB3.initDeck("[Channel4]"); if (PioneerDDJSB3.twinkleVumeterAutodjOn) { - PioneerDDJSB3.vuMeterTimer = engine.beginTimer(100, PioneerDDJSB3.vuMeterTwinkle()); + PioneerDDJSB3.vuMeterTimer = engine.beginTimer(100, PioneerDDJSB3.vuMeterTwinkle); } // request the positions of the knobs and faders from the controller @@ -1209,7 +1209,7 @@ PioneerDDJSB3.jogTouch = function(channel, control, value, status, group) { if (engine.getValue(group, "slipEnabled")) { engine.setValue(group, "slipEnabled", false); - engine.beginTimer(250, function() { + engine.beginTimer(250, () => { engine.setValue(group, "slipEnabled", true); }, true); } diff --git a/res/controllers/Pioneer-DDJ-SX-scripts.js b/res/controllers/Pioneer-DDJ-SX-scripts.js index 292ccd9be96..caefea27723 100644 --- a/res/controllers/Pioneer-DDJ-SX-scripts.js +++ b/res/controllers/Pioneer-DDJ-SX-scripts.js @@ -396,7 +396,7 @@ PioneerDDJSX.init = function(id) { // activate vu meter timer for Auto DJ: if (PioneerDDJSX.twinkleVumeterAutodjOn) { - PioneerDDJSX.vuMeterTimer = engine.beginTimer(200, "PioneerDDJSX.vuMeterTwinkle()"); + PioneerDDJSX.vuMeterTimer = engine.beginTimer(200, PioneerDDJSX.vuMeterTwinkle); } // initiate control status request: @@ -483,7 +483,7 @@ PioneerDDJSX.autoDJToggleSyncKey = function(channel, control, value, status, gro PioneerDDJSX.autoDJTimer = function(value, group, control) { if (value) { - PioneerDDJSX.autoDJTickTimer = engine.beginTimer(PioneerDDJSX.autoDJTickInterval, "PioneerDDJSX.autoDJControl()"); + PioneerDDJSX.autoDJTickTimer = engine.beginTimer(PioneerDDJSX.autoDJTickInterval, PioneerDDJSX.autoDJControl); } else if (PioneerDDJSX.autoDJTickTimer) { engine.stopTimer(PioneerDDJSX.autoDJTickTimer); PioneerDDJSX.autoDJTickTimer = 0; diff --git a/res/controllers/Reloop Terminal Mix 2-4.js b/res/controllers/Reloop Terminal Mix 2-4.js index cf745315ec8..8889594e2f1 100644 --- a/res/controllers/Reloop Terminal Mix 2-4.js +++ b/res/controllers/Reloop Terminal Mix 2-4.js @@ -104,8 +104,8 @@ TerminalMix.init = function (id,debug) { engine.connectControl("[Channel2]","beat_active","TerminalMix.tapLEDR"); TerminalMix.timers["fstartflash"] = -1; -// TerminalMix.timers["qtrSec"] = engine.beginTimer(250,"TerminalMix.qtrSec"); - TerminalMix.timers["halfSec"] = engine.beginTimer(500,"TerminalMix.halfSec"); +// TerminalMix.timers["qtrSec"] = engine.beginTimer(250, TerminalMix.qtrSec); + TerminalMix.timers["halfSec"] = engine.beginTimer(500, TerminalMix.halfSec); if (TerminalMix.traxKnobMode == "tracks") { midi.sendShortMsg(0x90,0x37,0x7F); // light Back button diff --git a/res/controllers/Reloop-Beatmix-2-4-scripts.js b/res/controllers/Reloop-Beatmix-2-4-scripts.js index 92dd6782f1a..a22493507e0 100644 --- a/res/controllers/Reloop-Beatmix-2-4-scripts.js +++ b/res/controllers/Reloop-Beatmix-2-4-scripts.js @@ -329,7 +329,7 @@ ReloopBeatmix24.LoadButton = function(channel, control, value, status, group) { if (value === DOWN) { loadButtonLongPressed[group] = false; loadButtonTimers[group] = engine.beginTimer(1000, - "ReloopBeatmix24.LoadButtonEject(\"" + group + "\")", true); + () => {RegloopBeatmix24.LoadButtonEject(group); }, true); } else { // UP if (!loadButtonLongPressed[group]) { // Short press engine.stopTimer(loadButtonTimers[group]); @@ -546,7 +546,7 @@ ReloopBeatmix24.JogLed = function(value, group, _control) { jogWheelTimers[group] = engine.beginTimer( timeLeft <= JogFlashCriticalTime ? JogFlashCriticalInterval : JogFlashWarningInterval, - "ReloopBeatmix24.jogLedFlash(\"" + group + "\", " + ON + ")", + () => {ReloopBeatmix24.jogLedFlash(group, ON); }, true); JogBlinking[group] = true; } @@ -584,8 +584,8 @@ ReloopBeatmix24.jogLedFlash = function(group, state) { const nextTime = (timeleft < JogFlashCriticalTime ? JogFlashCriticalInterval : JogFlashWarningInterval); jogWheelTimers[group] = engine.beginTimer(nextTime, - "ReloopBeatmix24.jogLedFlash(\"" + group + "\", " + - (state ? OFF : ON) + ")", true); + () => {ReloopBeatmix24.jogLedFlash(group, state ? OFF : ON); }, + true); } else { // Back in time ? // shut off all jog leds ReloopBeatmix24.AllJogLEDsToggle(0x90 + chan, OFF); @@ -622,8 +622,7 @@ ReloopBeatmix24.FxModeLedFlash = function(step, mode) { midi.sendShortMsg(i, 0x26 - mode, ledValue); midi.sendShortMsg(i, 0x26 + SHIFT - mode, ledValue); } - engine.beginTimer(150, "ReloopBeatmix24.FxModeLedFlash(" + (step + 1) + - ", " + mode + ")", true); + engine.beginTimer(150, () => { ReloopBeatmix24.FxModeLedFlash(step + 1, mode); }, true); } }; @@ -636,7 +635,7 @@ ReloopBeatmix24.FxModeCallback = function(group, mode) { midi.sendShortMsg(i, 0x26 - mode, OFF); midi.sendShortMsg(i, 0x26 + SHIFT - mode, OFF); } - engine.beginTimer(150, "ReloopBeatmix24.FxModeLedFlash(1, " + mode + ")", + engine.beginTimer(150, () => { ReloopBeatmix24.FxModeLedFlash(1, mode); }, true); }; @@ -653,8 +652,7 @@ ReloopBeatmix24.ActivateFx = function(channel, control, value, status, group) { } FxModeLongPressed[group] = false; FxModeTimers[group] = engine.beginTimer(1000, - "ReloopBeatmix24.FxModeCallback(\"" + group + "\", " + FxNum + ")", - true); + () => {ReloopBeatmix24.FxModeCallback(group, FxNum); }, true); } else { // UP if (FxModeLongPressed[group]) { // long press // Nothing to do, this has already been done in callback function @@ -726,8 +724,7 @@ ReloopBeatmix24.ShiftFxKnobOnOff = function(channel, control, value, status, gro if (value === UP) { engine.setValue(group, "clear", 1); engine.beginTimer(100, - "ReloopBeatmix24.EffectClearTimerCallBack(\"" + group + - "\")", true); + () => {ReloopBeatmix24.EffectClearTimerCallBack(group); }, true); } } // Nothing in single-effect mode diff --git a/res/controllers/Reloop-Beatpad-scripts.js b/res/controllers/Reloop-Beatpad-scripts.js index c3e5023a157..fed35acf311 100644 --- a/res/controllers/Reloop-Beatpad-scripts.js +++ b/res/controllers/Reloop-Beatpad-scripts.js @@ -381,7 +381,6 @@ LED.prototype.onOff = function(value) { // if not set, it considers it as a switch off (default=false) // valueoff : like "value". That permits for instance with two colors (once red(on), once blue(off), once red(on), etc...) LED.prototype.flashOn = function(num_ms_on, value, num_ms_off, flashCount, relight, valueoff) { - var myself = this; // stop pending timers this.flashOff(); @@ -406,14 +405,14 @@ LED.prototype.flashOn = function(num_ms_on, value, num_ms_off, flashCount, relig // so we don't need this part if flashcount=1 // permanent timer - this.flashTimer = engine.beginTimer( num_ms_on + num_ms_off, function(){ myself.flashOnceOn(false); } ); + this.flashTimer = engine.beginTimer( num_ms_on + num_ms_off, () => { this.flashOnceOn(false); } ); } if (flashCount > 1) { // flashcount>0 , means temporary flash, first flash already done, // so we don't need this part if flashcount=1 // temporary timer. The end of this timer stops the permanent flashing - this.flashTimer2 = engine.beginTimer(flashCount * (num_ms_on + num_ms_off) - num_ms_off, function(){ myself.Stopflash(relight); }, true); + this.flashTimer2 = engine.beginTimer(flashCount * (num_ms_on + num_ms_off) - num_ms_off, () => { this.Stopflash(relight); }, true); } }; @@ -423,7 +422,7 @@ LED.prototype.getFlashDuration = function() { }; LED.prototype.checkOn = function() { - return this.lit; + return this.lit; }; // private : relight=true : restore light state before it was flashing @@ -464,11 +463,10 @@ LED.prototype.Stopflash = function(relight) { // private : call back function (called in flashon() ) LED.prototype.flashOnceOn = function(relight) { - var myself = this; midi.sendShortMsg(this.control, this.midino, this.valueon); pauseScript(scriptpause); this.flashOnceDuration = this.num_ms_on; - this.flashOnceTimer = engine.beginTimer(this.num_ms_on - scriptpause, function(){ myself.flashOnceOff(relight); }, true); + this.flashOnceTimer = engine.beginTimer(this.num_ms_on - scriptpause, () => { this.flashOnceOff(relight); }, true); }; // private :call back function (called in flashOnceOn() ) @@ -521,7 +519,6 @@ var SingleDoubleBtn = function(Callback, DoublePressTimeOut) { // Button pressed SingleDoubleBtn.prototype.ButtonDown = function(channel, control, value, status, group) { - var myself = this; this.channel = channel; this.control = control; this.value = value; @@ -530,8 +527,7 @@ SingleDoubleBtn.prototype.ButtonDown = function(channel, control, value, status, if (this.ButtonTimer === 0) { // first press this.ButtonTimer = - engine.beginTimer(this.DoublePressTimeOut, - function(){ myself.ButtonDecide(); }, true); + engine.beginTimer(this.DoublePressTimeOut, this.ButtonDecide, true); this.ButtonCount = 1; } else { // 2nd press (before timer's out) engine.stopTimer(this.ButtonTimer); @@ -597,14 +593,13 @@ LongShortBtn.prototype.ButtonAssertLongPress = function() { }; LongShortBtn.prototype.ButtonDown = function(channel, control, value, status, group) { - var myself = this; this.channel = channel; this.control = control; this.value = value; this.status = status; this.group = group; this.ButtonLongPress = false; - this.ButtonLongPressTimer = engine.beginTimer(this.LongPressThreshold, function(){ myself.ButtonAssertLongPress(); }, true); + this.ButtonLongPressTimer = engine.beginTimer(this.LongPressThreshold, this.ButtonAssertLongPress, true); }; LongShortBtn.prototype.ButtonUp = function() { @@ -689,7 +684,6 @@ LongShortDoubleBtn.prototype.ButtonAssert1Press = function() { // Button pressed (function called by mapper's code) LongShortDoubleBtn.prototype.ButtonDown = function(channel, control, value, status, group) { - var myself = this; this.channel = channel; this.control = control; this.value = value; @@ -702,13 +696,10 @@ LongShortDoubleBtn.prototype.ButtonDown = function(channel, control, value, stat // and short press this.ButtonLongPress = false; this.ButtonLongPressTimer = - engine.beginTimer(this.LongPressThreshold, - function(){ myself.ButtonAssertLongPress(); }, + engine.beginTimer(this.LongPressThreshold, this.ButtonAssertLongPress, true); this.ButtonTimer = - engine.beginTimer(this.DoublePressTimeOut, - function(){ myself.ButtonAssert1Press(); }, - true); + engine.beginTimer(this.DoublePressTimeOut, this.ButtonAssert1Press, true); } else if (this.ButtonCount == 1) { // 2nd press (before short timer's out) // stop timers... if (this.ButtonLongPressTimer !== 0) { @@ -852,7 +843,6 @@ var Jogger = function (group, deckNum, model) { }; Jogger.prototype.finishWheelTouch = function() { - var myself = this; this.wheelTouchInertiaTimer = 0; var play = engine.getValue(this.group, "play"); if (play !== 0) { @@ -872,15 +862,12 @@ Jogger.prototype.finishWheelTouch = function() { } else { // Check again soon. this.wheelTouchInertiaTimer = - engine.beginTimer(100, - function(){ myself.finishWheelTouch(); }, - true); + engine.beginTimer(100, this.finishWheelTouch, true); } } }; Jogger.prototype.onWheelTouch = function(value,Do_iCut) { - var myself = this; if (Do_iCut) { this.iCUT.On(); } else { @@ -906,9 +893,7 @@ Jogger.prototype.onWheelTouch = function(value,Do_iCut) { this.finishWheelTouch(); } else { // If button up this.wheelTouchInertiaTimer = - engine.beginTimer(inertiaTime, - function(){ myself.finishWheelTouch(); }, - true); + engine.beginTimer(inertiaTime, this.finishWheelTouch, true); } } }; @@ -1091,7 +1076,6 @@ ReloopBeatpad.rgbLEDs.prototype.onOff = function(showname, value) { // public : make a rgb light flashing ReloopBeatpad.rgbLEDs.prototype.flashOn = function(num_ms_on, RGBColor, num_ms_off, flashCount) { - var myself = this; this.setshow("show6", RGBColor); // stop pending timers @@ -1111,14 +1095,14 @@ ReloopBeatpad.rgbLEDs.prototype.flashOn = function(num_ms_on, RGBColor, num_ms_o // so we don't need this part if flashcount=1 // permanent timer this.flashTimer = engine.beginTimer( num_ms_on + num_ms_off, - function(){ myself.flashOnceOn(true); } ); + () => { this.flashOnceOn(true); }); } if (flashCount > 1) { // flashcount>0 , means temporary flash, first flash already done, // so we don't need this part if flashcount=1 // temporary timer. The end of this timer stops the permanent flashing - this.flashTimer2 = engine.beginTimer(flashCount * (num_ms_on + num_ms_off) - num_ms_off, function(){ myself.Stopflash(); }, true); + this.flashTimer2 = engine.beginTimer(flashCount * (num_ms_on + num_ms_off) - num_ms_off, this.Stopflash, true); } }; @@ -1161,11 +1145,10 @@ ReloopBeatpad.rgbLEDs.prototype.getFlashDuration = function() { // private : call back function (called in flashon() ) ReloopBeatpad.rgbLEDs.prototype.flashOnceOn = function(relight) { - var myself = this; this.layers.show5.activate = true; var pausecount = this.activateshow("show6", true); this.flashOnceDuration = this.num_ms_on; - this.flashOnceTimer = engine.beginTimer(this.flashDuration - scriptpause * pausecount, function(){ myself.flashOnceOff(relight); }, true); + this.flashOnceTimer = engine.beginTimer(this.flashDuration - scriptpause * pausecount, () => { this.flashOnceOff(relight); }, true); }; // private :call back function (called in flashOnceOn() ) diff --git a/res/controllers/Reloop-Jockey-3-ME-scripts.js b/res/controllers/Reloop-Jockey-3-ME-scripts.js index 529af30685f..347a044f8df 100644 --- a/res/controllers/Reloop-Jockey-3-ME-scripts.js +++ b/res/controllers/Reloop-Jockey-3-ME-scripts.js @@ -67,12 +67,12 @@ Jockey3ME.LedMeterShow = function() { if (Jockey3ME.LedMeterShowValueTwo && Jockey3ME.LedMeterShowValue < 0) { engine.stopTimer(Jockey3ME.LedMeterShowTimer); Jockey3ME.LedMeterShowTimer = 0; - Jockey3ME.EffectLedMeter = engine.beginTimer(20,"Jockey3ME.EffectLedMeterShow()"); + Jockey3ME.EffectLedMeter = engine.beginTimer(20,Jockey3ME.EffectLedMeterShow); }; } Jockey3ME.LedShowBegin = function () { - Jockey3ME.LedMeterShowTimer = engine.beginTimer(40,"Jockey3ME.LedMeterShow()"); + Jockey3ME.LedMeterShowTimer = engine.beginTimer(40,Jockey3ME.LedMeterShow); } // Init Script at Program start @@ -89,7 +89,7 @@ Jockey3ME.init = function () { midi.sendShortMsg(0x92,j,0x00); midi.sendShortMsg(0x93,j,0x00); }; - Jockey3ME.LedShowBeginTimer = engine.beginTimer(2000,"Jockey3ME.LedShowBegin()",1); // LedShow Script Starts Here after 500ms + Jockey3ME.LedShowBeginTimer = engine.beginTimer(2000,Jockey3ME.LedShowBegin,true); // LedShow Script Starts Here after 500ms for (var i = 1; i <= 4; i++) { for (var j = 1; j <= 3; j++) { engine.connectControl("[EffectRack1_EffectUnit" + i + "_Effect1]","parameter" + j,"Jockey3ME.FX_Param_Led"); @@ -239,7 +239,7 @@ Jockey3ME.effectSelect = function (channel, control, value, status, group) { if (fxChainSelectKnob) { engine.setValue("[EffectRack1_EffectUnit" + currentDeck + "]", "chain_selector", (value-64)); // Set Leds - // Jockey3ME.effectSelectTimer = engine.beginTimer(100, "Jockey3ME.effectSelectLedSet(" + status + "," + currentDeck + ")",1); + // Jockey3ME.effectSelectTimer = engine.beginTimer(100, () => { Jockey3ME.effectSelectLedSet(status, currentDeck); },true); var num_parameters = engine.getValue("[EffectRack1_EffectUnit" + currentDeck + "_Effect1]", "num_parameters"); if (num_parameters > 3) { num_parameters = 3; @@ -332,8 +332,8 @@ Jockey3ME.effectSelectPush = function (channel, control, value, status, group) { continue; } if (Jockey3ME.fxSelectKnobPushIterator[r]) { - engine.beginTimer(400,"midi.sendShortMsg(" + status + "," + control + ",0x7F)",1); - engine.beginTimer(600,"midi.sendShortMsg(" + status + "," + control + ",0x00)",1); + engine.beginTimer(400,() => { midi.sendShortMsg(status, control, 0x7F); }, true); + engine.beginTimer(600,() => { midi.sendShortMsg(status, control, 0x00); }, true); break fxSelectKnobPushBreak; } } @@ -355,21 +355,21 @@ Jockey3ME.effectSelectPush = function (channel, control, value, status, group) { if (engine.getValue("[EffectRack1_EffectUnit" + currentDeck + "_Effect" + Jockey3ME.fxSelectKnobPush[currentDeck-1] + "]","parameter" + Jockey3ME.fxSelectKnobParamChose + "_loaded")) { engine.setValue("[EffectRack1_EffectUnit" + currentDeck + "_Effect" + Jockey3ME.fxSelectKnobPush[currentDeck-1] + "]","parameter" + Jockey3ME.fxSelectKnobParamChose + "_link_type",Jockey3ME.fxSelectKnobParamLinkChose); engine.setValue("[EffectRack1_EffectUnit" + currentDeck + "_Effect" + Jockey3ME.fxSelectKnobPush[currentDeck-1] + "]","parameter" + Jockey3ME.fxSelectKnobParamChose + "_link_inverse",Jockey3ME.fxSelectKnobParamLinkInverseChose); - engine.beginTimer(400,"midi.sendShortMsg(" + status + "," + control + ",0x7F)",1); - engine.beginTimer(600,"midi.sendShortMsg(" + status + "," + control + ",0x00)",1); - engine.beginTimer(800,"midi.sendShortMsg(" + status + "," + control + ",0x7F)",1); - engine.beginTimer(1000,"midi.sendShortMsg(" + status + "," + control + ",0x00)",1); + engine.beginTimer(400, () => { midi.sendShortMsg(status, control, 0x7F); }, true); + engine.beginTimer(600, () => { midi.sendShortMsg(status, control, 0x00); }, true); + engine.beginTimer(800, () => { midi.sendShortMsg(status, control, 0x7F); }, true); + engine.beginTimer(1000, () => { midi.sendShortMsg(status, control, 0x00); }, true); } } } Jockey3ME.fxSelectKnobPush[currentDeck-1] = 0; } else { Jockey3ME.fxSelectKnobPush[currentDeck-1] = 0; - engine.beginTimer(400,"midi.sendShortMsg(" + status + "," + control + ",0x7F)",1); - engine.beginTimer(600,"midi.sendShortMsg(" + status + "," + control + ",0x00)",1); + engine.beginTimer(400,() => { midi.sendShortMsg(status, control, 0x7F); }, true); + engine.beginTimer(600,() => { midi.sendShortMsg(status, control, 0x00); }, true); } midi.sendShortMsg(status,control,0x7F); - engine.beginTimer(200,"midi.sendShortMsg(" + status + "," + control + ",0x00)",1); + engine.beginTimer(200, () => {midi.sendShortMsg(status, control, 0x00); }, true); } } diff --git a/res/controllers/Roland_DJ-505-scripts.js b/res/controllers/Roland_DJ-505-scripts.js index 59b14c42040..995758c98fe 100644 --- a/res/controllers/Roland_DJ-505-scripts.js +++ b/res/controllers/Roland_DJ-505-scripts.js @@ -172,7 +172,7 @@ DJ505.init = function() { midi.sendSysexMsg([0xF0, 0x00, 0x20, 0x7F, 0x01, 0xF7], 6); // Send "keep-alive" message to keep controller in Serato mode - engine.beginTimer(500, function() { + engine.beginTimer(500, () => { midi.sendShortMsg(0xBF, 0x64, 0x00); }); @@ -220,7 +220,7 @@ DJ505.browseEncoder = new components.Encoder({ this.isLongPressed = false; this.longPressTimer = engine.beginTimer( this.longPressTimeout, - function() { this.isLongPressed = true; }.bind(this), + () => { this.isLongPressed = true; }, true ); @@ -621,10 +621,10 @@ DJ505.Deck = function(deckNumbers, offset) { }, input: function(channel, control, value, _status, _group) { if (value) { - this.longPressTimer = engine.beginTimer(this.longPressTimeout, function() { + this.longPressTimer = engine.beginTimer(this.longPressTimeout, () => { this.onLongPress(); this.longPressTimer = 0; - }.bind(this), true); + }, true); } else if (this.longPressTimer !== 0) { // Button released after short press engine.stopTimer(this.longPressTimer); @@ -693,10 +693,10 @@ DJ505.Deck = function(deckNumbers, offset) { group: "[Channel" + deckNumbers + "]", input: function(_channel, _control, value, _status, group) { if (value) { - this.longPressTimer = engine.beginTimer(this.longPressTimeout, function() { + this.longPressTimer = engine.beginTimer(this.longPressTimeout, () => { this.onLongPress(group); this.longPressTimer = 0; - }.bind(this), true); + }, true); } else if (this.longPressTimer !== 0) { // Button released after short press engine.stopTimer(this.longPressTimer); @@ -749,7 +749,7 @@ DJ505.DeckToggleButton.prototype.input = function(channel, control, value, statu // Button was pressed this.longPressTimer = engine.beginTimer( this.longPressTimeout, - function() { this.isLongPressed = true; }.bind(this), + () => { this.isLongPressed = true; }, true ); this.secondaryDeck = !this.secondaryDeck; @@ -880,10 +880,10 @@ DJ505.Sampler = function() { this.startStopButtonPressed = function(channel, control, value, status, _group) { if (status === 0xFA) { this.playbackCounter = 1; - this.playbackTimer = engine.beginTimer(500, function() { + this.playbackTimer = engine.beginTimer(500, () => { midi.sendShortMsg(0xBA, 0x02, this.playbackCounter); this.playbackCounter = (this.playbackCounter % 4) + 1; - }.bind(this)); + }); } else if (status === 0xFC) { if (this.playbackTimer) { engine.stopTimer(this.playbackTimer); @@ -961,10 +961,10 @@ DJ505.SlipModeButton.prototype.unshift = function() { this.doubleTapTimer = engine.beginTimer( this.doubleTapTimeout, - function() { + () => { this.doubleTapped = false; this.doubleTapTimer = null; - }.bind(this), + }, true ); }; @@ -1618,9 +1618,9 @@ DJ505.SavedLoopMode = function(deck, offset) { if (value) { this.longPressTimer = engine.beginTimer( - this.longPressTimeout, function() { + this.longPressTimeout, () => { engine.setValue(this.group, "hotcue_" + this.number + "_clear", 1); - }.bind(this)); + }); } else { if (this.longPressTimer !== 0) { engine.stopTimer(this.longPressTimer); diff --git a/res/controllers/Sony-SixxAxis.js b/res/controllers/Sony-SixxAxis.js index b712f5be88c..d27931fc81d 100644 --- a/res/controllers/Sony-SixxAxis.js +++ b/res/controllers/Sony-SixxAxis.js @@ -112,7 +112,7 @@ SonySixxAxis.init = function(id) { return; controller.timers[timer_id] = engine.beginTimer( interval, - "SonySixxAxis.controller.autorepeatTimer()" + SonySixxAxis.controller.autorepeatTimer // FIXME: autorepeatTimer is not defined? ) } HIDDebug("Sony SixxAxis controller initialized: " + SonySixxAxis.id); diff --git a/res/controllers/Soundless_joyMIDI_scripts.js b/res/controllers/Soundless_joyMIDI_scripts.js index 0b6f47e263c..5ebc62b4a17 100644 --- a/res/controllers/Soundless_joyMIDI_scripts.js +++ b/res/controllers/Soundless_joyMIDI_scripts.js @@ -135,7 +135,7 @@ joyMIDI.syncButton = function(channel, control, value, status, group) { } joyMIDI[group].syncLongPress = 0; joyMIDI[group].syncTimerID = - engine.beginTimer(1000, function() { joyMIDI.syncTimerHandler(group); }, true); + engine.beginTimer(1000, () => { joyMIDI.syncTimerHandler(group); }, true); } } else { engine.setValue(group, "rate", 0); @@ -535,7 +535,7 @@ joyMIDI.wheelScratch = function(channel, control, value, status, group) { engine.scratchTick(deck, newValue); joyMIDI[group].scratchTimerID = - engine.beginTimer(scratchDisableTime, function() { joyMIDI.ScratchTimerHandler(deck, group); }, true); + engine.beginTimer(scratchDisableTime, () => { joyMIDI.ScratchTimerHandler(deck, group); }, true); }; joyMIDI.ScratchTimerHandler = function(deck, group) { @@ -649,7 +649,7 @@ joyMIDI.joystick = function(channel, control, _value, _status, _group) { if (joystickDelay === false) { /* Delay a while */ joystickDelay = true; - engine.beginTimer(300, function() { joystickDelay = false; }, true); + engine.beginTimer(300, () => { joystickDelay = false; }, true); if (!joyMIDI["[Channel1]"].btnShift) { /* Joystick only */ @@ -678,7 +678,7 @@ joyMIDI.fsr = function(_channel, _control, _value, _status, _group) { if (fsrDelay === false) { /* Delay a while */ fsrDelay = true; - engine.beginTimer(300, function() { fsrDelay = false; }, true); + engine.beginTimer(300, () => { fsrDelay = false; }, true); var isShift = joyMIDI["[Channel1]"].btnShift === true || joyMIDI["[Channel2]"].btnShift === true; if (! isShift) { diff --git a/res/controllers/Stanton-SCS1d-scripts.js b/res/controllers/Stanton-SCS1d-scripts.js index cf8ac3fcfd2..de561e7ff5d 100644 --- a/res/controllers/Stanton-SCS1d-scripts.js +++ b/res/controllers/Stanton-SCS1d-scripts.js @@ -832,7 +832,7 @@ StantonSCS1d.DeckChange = function (channel, control, value, status) { if (!StantonSCS1d.fastDeckChange) { if (StantonSCS1d.timer["deckChange"] != -1) engine.stopTimer(StantonSCS1d.timer["deckChange"]); StantonSCS1d.state["flashes"] = 0; // initialize number of flashes - StantonSCS1d.timer["deckChange"] = engine.beginTimer(60,"StantonSCS1d.deckChangeFlash("+channel+","+value+")"); + StantonSCS1d.timer["deckChange"] = engine.beginTimer(60, () => { StantonSCS1d.deckChangeFlash(channel, value); }); return; } // No flashy lights @@ -1698,7 +1698,7 @@ StantonSCS1d.loopEnabled = function (value) { if (value>0 && StantonSCS1d.timer["loop"]==-1) { if (!StantonSCS1d.loopActive[StantonSCS1d.deck] || StantonSCS1d.loopActive[StantonSCS1d.deck]==-1) StantonSCS1d.activateLoop(1); - StantonSCS1d.timer["loop"] = engine.beginTimer(500,"StantonSCS1d.loopFlash()"); + StantonSCS1d.timer["loop"] = engine.beginTimer(500, StantonSCS1d.loopFlash); } if (value<=0 && StantonSCS1d.timer["loop"]!=-1) { @@ -2041,7 +2041,7 @@ StantonSCS1d.circleBars = function (value) { if (trackTimeRemaining<=30 && trackTimeRemaining>15) { // If <30s left, flash slowly if (StantonSCS1d.timer["30s-d"+deck] == -1) { // Start timer - StantonSCS1d.timer["30s-d"+deck] = engine.beginTimer(500,"StantonSCS1d.circleFlash("+deck+")"); + StantonSCS1d.timer["30s-d"+deck] = engine.beginTimer(500, () => { StantonSCS1d.circleFlash(deck); }); if (StantonSCS1d.timer["15s-d"+deck] != -1) { // Stop the 15s timer if it was running engine.stopTimer(StantonSCS1d.timer["15s-d"+deck]); @@ -2051,7 +2051,7 @@ StantonSCS1d.circleBars = function (value) { } else if (trackTimeRemaining<=15 && trackTimeRemaining>0) { // If <15s left, flash quickly if (StantonSCS1d.timer["15s-d"+deck] == -1) { // Start timer - StantonSCS1d.timer["15s-d"+deck] = engine.beginTimer(125,"StantonSCS1d.circleFlash("+deck+")"); + StantonSCS1d.timer["15s-d"+deck] = engine.beginTimer(125, () => { StantonSCS1d.circleFlash(deck); }); if (StantonSCS1d.timer["30s-d"+deck] != -1) { // Stop the 30s timer if it was running engine.stopTimer(StantonSCS1d.timer["30s-d"+deck]); diff --git a/res/controllers/Stanton-SCS1m-scripts.js b/res/controllers/Stanton-SCS1m-scripts.js index a8a11293b0a..b46fcc1c959 100644 --- a/res/controllers/Stanton-SCS1m-scripts.js +++ b/res/controllers/Stanton-SCS1m-scripts.js @@ -745,7 +745,7 @@ StantonSCS1m.positionUpdates = function (value,deck) { if (trackTimeRemaining<=30 && trackTimeRemaining>15) { // If <30s left, flash slowly if (StantonSCS1m.timer["30s-d"+deck] == -1) { // Start timer - StantonSCS1m.timer["30s-d"+deck] = engine.beginTimer(500,"StantonSCS1m.displayFlash("+deck+")"); + StantonSCS1m.timer["30s-d"+deck] = engine.beginTimer(500, () => { StantonSCS1m.displayFlash(deck); }); if (StantonSCS1m.timer["15s-d"+deck] != -1) { // Stop the 15s timer if it was running engine.stopTimer(StantonSCS1m.timer["15s-d"+deck]); @@ -755,7 +755,7 @@ StantonSCS1m.positionUpdates = function (value,deck) { } else if (trackTimeRemaining<=15 && trackTimeRemaining>0) { // If <15s left, flash quickly if (StantonSCS1m.timer["15s-d"+deck] == -1) { // Start timer - StantonSCS1m.timer["15s-d"+deck] = engine.beginTimer(125,"StantonSCS1m.displayFlash("+deck+")"); + StantonSCS1m.timer["15s-d"+deck] = engine.beginTimer(125,() => { StantonSCS1m.displayFlash(deck); }); if (StantonSCS1m.timer["30s-d"+deck] != -1) { // Stop the 30s timer if it was running engine.stopTimer(StantonSCS1m.timer["30s-d"+deck]); diff --git a/res/controllers/Stanton-SCS3d-scripts.js b/res/controllers/Stanton-SCS3d-scripts.js index c8f92e7a65d..a17fa3ca83a 100644 --- a/res/controllers/Stanton-SCS3d-scripts.js +++ b/res/controllers/Stanton-SCS3d-scripts.js @@ -1199,7 +1199,7 @@ StantonSCS3d.DeckChangeP1 = function (channel, control, value, status) { // If in the middle of flashing lights from a previous change, abort that one if (StantonSCS3d.timer[0] != -1) engine.stopTimer(StantonSCS3d.timer[0]); StantonSCS3d.state["flashes"] = 0; // initialize number of flashes - StantonSCS3d.timer[0] = engine.beginTimer(60,"StantonSCS3d.deckChangeFlash("+channel+","+value+",\"right\")"); + StantonSCS3d.timer[0] = engine.beginTimer(60, () => { StantonSCS3d.deckChangeFlash(channel, value, "right"); }); return; } } @@ -1209,7 +1209,7 @@ StantonSCS3d.DeckChangeP1 = function (channel, control, value, status) { if (!StantonSCS3d.fastDeckChange) { if (StantonSCS3d.timer[0] != -1) engine.stopTimer(StantonSCS3d.timer[0]); StantonSCS3d.state["flashes"] = 0; // initialize number of flashes - StantonSCS3d.timer[0] = engine.beginTimer(60,"StantonSCS3d.deckChangeFlash("+channel+","+value+",\"left\")"); + StantonSCS3d.timer[0] = engine.beginTimer(60, () => { StantonSCS3d.deckChangeFlash(channel, value, "left"); }); return; } } @@ -1938,7 +1938,7 @@ StantonSCS3d.ActiveLoop = function (value) { if (value>0) { if (StantonSCS3d.timer[timerName] == -1) { // Start timer - StantonSCS3d.timer[timerName] = engine.beginTimer(500,"StantonSCS3d.activeLoopLEDs("+StantonSCS3d.deck+",false)"); + StantonSCS3d.timer[timerName] = engine.beginTimer(500, () => { StantonSCS3d.activeLoopLEDs(StantonSCS3d.deck,false); }); } } else { @@ -2215,7 +2215,7 @@ StantonSCS3d.circleLEDs = function (value) { if (trackTimeRemaining<=30 && trackTimeRemaining>15) { // If <30s left, flash slowly if (StantonSCS3d.timer["30s-d"+deck] == -1) { // Start timer - StantonSCS3d.timer["30s-d"+deck] = engine.beginTimer(500,"StantonSCS3d.circleFlash("+deck+")"); + StantonSCS3d.timer["30s-d"+deck] = engine.beginTimer(500, () => { StantonSCS3d.circleFlash(deck); }); if (StantonSCS3d.timer["15s-d"+deck] != -1) { // Stop the 15s timer if it was running engine.stopTimer(StantonSCS3d.timer["15s-d"+deck]); @@ -2225,7 +2225,7 @@ StantonSCS3d.circleLEDs = function (value) { } else if (trackTimeRemaining<=15 && trackTimeRemaining>0) { // If <15s left, flash quickly if (StantonSCS3d.timer["15s-d"+deck] == -1) { // Start timer - StantonSCS3d.timer["15s-d"+deck] = engine.beginTimer(125,"StantonSCS3d.circleFlash("+deck+")"); + StantonSCS3d.timer["15s-d"+deck] = engine.beginTimer(125, () => { StantonSCS3d.circleFlash(deck); }); if (StantonSCS3d.timer["30s-d"+deck] != -1) { // Stop the 30s timer if it was running engine.stopTimer(StantonSCS3d.timer["30s-d"+deck]); diff --git a/res/controllers/Stanton-SCS3m-scripts.js b/res/controllers/Stanton-SCS3m-scripts.js index db6c10b7f22..494b014de79 100644 --- a/res/controllers/Stanton-SCS3m-scripts.js +++ b/res/controllers/Stanton-SCS3m-scripts.js @@ -405,7 +405,7 @@ SCS3M.Agent = function(device) { } } - var flushModeset = function() { + var flushModeset = () => { var message; // Now we can flush the rest of the messages. @@ -576,7 +576,7 @@ SCS3M.Agent = function(device) { sw.hold = function(onHeld) { return function() { heldBegin = true; - var switchExpire = engine.beginTimer(200, function() { + var switchExpire = engine.beginTimer(200, () => { engine.stopTimer(switchExpire); if (heldBegin) { heldBegin = false; diff --git a/res/controllers/TrakProDJ-iPad-scripts.js b/res/controllers/TrakProDJ-iPad-scripts.js index 0d0d6628f13..13cb1af7705 100644 --- a/res/controllers/TrakProDJ-iPad-scripts.js +++ b/res/controllers/TrakProDJ-iPad-scripts.js @@ -188,10 +188,10 @@ TrakProDJ.jog_enable = function(deck) { if (!ctrl.timer) { if (TrakProDJ.use_scratch) { print(group + ' enable scratch'); - ctrl.timer = engine.beginTimer(20,"TrakProDJ.jog_scratch_timer(deck)"); + ctrl.timer = engine.beginTimer(20, () => { TrakProDJ.jog_scratch_timer(deck); }); } else { print(group + ' enable rate bend'); - ctrl.timer = engine.beginTimer(20,"TrakProDJ.jog_rate_timer(deck)"); + ctrl.timer = engine.beginTimer(20, () => { TrakProDJ.jog_rate_timer(deck); }); } } if (TrakProDJ.use_scratch) { diff --git a/res/controllers/Traktor Kontrol Z1.hid.xml b/res/controllers/Traktor Kontrol Z1.hid.xml new file mode 100644 index 00000000000..843adc9fd65 --- /dev/null +++ b/res/controllers/Traktor Kontrol Z1.hid.xml @@ -0,0 +1,19 @@ + + + + Native Instruments Traktor Kontrol Z1 + djantti + HID mapping for Native Instruments Traktor Kontrol Z1 + https://mixxx.discourse.group/t/new-mapping-for-native-instruments-traktor-kontrol-z1/28436 + native_instruments_traktor_kontrol_z1 + + + + + + + + + + + diff --git a/res/controllers/Traktor-Kontrol-F1-scripts.js b/res/controllers/Traktor-Kontrol-F1-scripts.js index 303b571e8d0..c02d2ca2172 100644 --- a/res/controllers/Traktor-Kontrol-F1-scripts.js +++ b/res/controllers/Traktor-Kontrol-F1-scripts.js @@ -351,7 +351,7 @@ KontrolF1.init = function (id) { KontrolF1.testUpdateInterval = 20; KontrolF1.testTimer = engine.beginTimer( KontrolF1.testUpdateInterval, - "KontrolF1.testSegments()" + KontrolF1.testSegments ); KontrolF1.updateLEDs(); diff --git a/res/controllers/Traktor-Kontrol-S2-MK1-hid-scripts.js b/res/controllers/Traktor-Kontrol-S2-MK1-hid-scripts.js index 40a3adbe1bc..d201bdbdb4a 100644 --- a/res/controllers/Traktor-Kontrol-S2-MK1-hid-scripts.js +++ b/res/controllers/Traktor-Kontrol-S2-MK1-hid-scripts.js @@ -416,8 +416,8 @@ class DeckClass { } else { this.wheelTouchInertiaTimer = engine.beginTimer( inertiaTime, - this.finishJogPress.bind(this) - , true); + this.finishJogPress, + true); } } } @@ -530,7 +530,7 @@ class DeckClass { engine.scratchDisable(this.number, true); } else { // Check again soon. - this.wheelPressInertiaTimer = engine.beginTimer(20, this.finishJogPress.bind(this), true); + this.wheelPressInertiaTimer = engine.beginTimer(20, finishJogPress, true); } } } @@ -795,10 +795,10 @@ class EffectUnit { engine.setValue(this.group, "loaded_chain_preset", 1); return; } - this.effectFocusLongPressTimer = engine.beginTimer(longPressTimeoutMilliseconds, function() { + this.effectFocusLongPressTimer = engine.beginTimer(longPressTimeoutMilliseconds, () => { this.effectFocusChooseModeActive = true; this.connectEffectButtonLedsFocused(); - }.bind(this)); + }); if (!showParameters) { engine.setValue(this.group, "show_parameters", 1); this.effectFocusButtonPressedWhenParametersHidden = true; @@ -930,10 +930,10 @@ class EffectParameter { } else { this.toggle(); this.longPressTimer = engine.beginTimer(longPressTimeoutMilliseconds, - function() { + () => { this.isLongPressed = true; this.longPressTimer= 0; - }.bind(this), + }, true ); } diff --git a/res/controllers/Traktor-Kontrol-S2-MK2-hid-scripts.js b/res/controllers/Traktor-Kontrol-S2-MK2-hid-scripts.js index b6f28b7bfaf..654f04b1d45 100644 --- a/res/controllers/Traktor-Kontrol-S2-MK2-hid-scripts.js +++ b/res/controllers/Traktor-Kontrol-S2-MK2-hid-scripts.js @@ -661,7 +661,7 @@ TraktorS2MK2.jogTouch = function(field) { TraktorS2MK2.finishJogTouch(field.group); } else { TraktorS2MK2.wheelTouchInertiaTimer[field.group] = engine.beginTimer( - inertiaTime, function() { + inertiaTime, () => { TraktorS2MK2.finishJogTouch(field.group); }, true); } @@ -685,7 +685,8 @@ TraktorS2MK2.finishJogTouch = function(group) { } else { // Check again soon. TraktorS2MK2.wheelTouchInertiaTimer[group] = engine.beginTimer( - 1, function() { + // FIXME: 1ms is too short, what is appropriate? + 1, () => { TraktorS2MK2.finishJogTouch(group); }, true); } @@ -1020,9 +1021,9 @@ TraktorS2MK2.effectFocusButton = function(field) { engine.setValue(field.group, "loaded_chain_preset", 1); return; } - TraktorS2MK2.effectFocusLongPressTimer[field.group] = engine.beginTimer(TraktorS2MK2.longPressTimeoutMilliseconds, function() { + TraktorS2MK2.effectFocusLongPressTimer[field.group] = engine.beginTimer(TraktorS2MK2.longPressTimeoutMilliseconds, () => { TraktorS2MK2.effectFocusChooseModeActive[field.group] = true; - TraktorS2MK2.effectButtonLEDconnections[field.group].forEach(function(connection) { + TraktorS2MK2.effectButtonLEDconnections[field.group].forEach(connection => { connection.disconnect(); }); var makeButtonLEDcallback = function(buttonNumber) { @@ -1112,7 +1113,7 @@ TraktorS2MK2.effectButton = function(field) { toggle(); TraktorS2MK2.effectButtonLongPressTimer[effectUnitGroup][buttonNumber] = engine.beginTimer(TraktorS2MK2.longPressTimeoutMilliseconds, - function() { + () => { TraktorS2MK2.effectButtonIsLongPressed[effectUnitGroup][buttonNumber] = true; TraktorS2MK2.effectButtonLongPressTimer[effectUnitGroup][buttonNumber] = 0; }, diff --git a/res/controllers/Traktor-Kontrol-S2-MK3-hid-scripts.js b/res/controllers/Traktor-Kontrol-S2-MK3-hid-scripts.js index 40858c1fe6a..469dd9dc5f9 100644 --- a/res/controllers/Traktor-Kontrol-S2-MK3-hid-scripts.js +++ b/res/controllers/Traktor-Kontrol-S2-MK3-hid-scripts.js @@ -285,7 +285,7 @@ TraktorS2MK3.syncHandler = function(field) { if (engine.getValue(field.group, "sync_enabled") === 0) { script.triggerControl(field.group, "beatsync"); // Start timer to measure how long button is pressed - TraktorS2MK3.syncPressedTimer[field.group] = engine.beginTimer(300, function() { + TraktorS2MK3.syncPressedTimer[field.group] = engine.beginTimer(300, () => { engine.setValue(field.group, "sync_enabled", 1); // Reset sync button timer state if active if (TraktorS2MK3.syncPressedTimer[field.group] !== 0) { @@ -578,7 +578,7 @@ TraktorS2MK3.microphoneHandler = function(field) { if (field.value) { if (TraktorS2MK3.microphonePressedTimer === 0) { // Start timer to measure how long button is pressed - TraktorS2MK3.microphonePressedTimer = engine.beginTimer(300, function() { + TraktorS2MK3.microphonePressedTimer = engine.beginTimer(300, () => { // Reset microphone button timer status if active if (TraktorS2MK3.microphonePressedTimer !== 0) { TraktorS2MK3.microphonePressedTimer = 0; diff --git a/res/controllers/Traktor-Kontrol-S3-hid-scripts.js b/res/controllers/Traktor-Kontrol-S3-hid-scripts.js index 40f90428e0d..517934b3197 100644 --- a/res/controllers/Traktor-Kontrol-S3-hid-scripts.js +++ b/res/controllers/Traktor-Kontrol-S3-hid-scripts.js @@ -132,12 +132,12 @@ TraktorS3.Controller = class { this.fxButtonState = {1: false, 2: false, 3: false, 4: false, 5: false}; this.masterVuMeter = { - "VuMeterL": { + "vu_meter_left": { connection: null, updated: false, value: 0 }, - "VuMeterR": { + "vu_meter_right": { connection: null, updated: false, value: 0 @@ -281,9 +281,9 @@ TraktorS3.Controller = class { const chanob = this.Channels[ch]; engine.makeConnection(ch, "playposition", TraktorS3.Channel.prototype.playpositionChanged.bind(chanob)); - engine.connectControl(ch, "track_loaded", + engine.makeConnection(ch, "track_loaded", TraktorS3.Channel.prototype.trackLoadedHandler.bind(chanob)); - engine.connectControl(ch, "end_of_track", + engine.makeConnection(ch, "end_of_track", TraktorS3.Channel.prototype.endOfTrackHandler.bind(chanob)); } @@ -496,17 +496,17 @@ TraktorS3.Controller = class { }; for (const ch in VuOffsets) { for (let i = 0; i < 14; i++) { - outputB.addOutput(ch, "!" + "VuMeter" + i, VuOffsets[ch] + i, "B"); + outputB.addOutput(ch, "!" + "vu_meter" + i, VuOffsets[ch] + i, "B"); } } const MasterVuOffsets = { - "VuMeterL": 0x3D, - "VuMeterR": 0x46 + "vu_meter_left": 0x3D, + "vu_meter_right": 0x46 }; for (let i = 0; i < 8; i++) { - outputB.addOutput("[Master]", "!" + "VuMeterL" + i, MasterVuOffsets.VuMeterL + i, "B"); - outputB.addOutput("[Master]", "!" + "VuMeterR" + i, MasterVuOffsets.VuMeterR + i, "B"); + outputB.addOutput("[Main]", "!" + "vu_meter_left" + i, MasterVuOffsets.vu_meter_left + i, "B"); + outputB.addOutput("[Main]", "!" + "vu_meter_right" + i, MasterVuOffsets.vu_meter_right + i, "B"); } outputB.addOutput("[Main]", "peak_indicator_left", 0x45, "B"); @@ -527,13 +527,13 @@ TraktorS3.Controller = class { this.Channels[idx].linkOutputs(); } - engine.connectControl("[Microphone]", "pfl", this.pflOutput); + engine.makeConnection("[Microphone]", "pfl", this.pflOutput); - engine.connectControl("[Skin]", "show_maximized_library", TraktorS3.Controller.prototype.maximizeLibraryOutput.bind(this)); + engine.makeConnection("[Skin]", "show_maximized_library", TraktorS3.Controller.prototype.maximizeLibraryOutput.bind(this)); // Master VuMeters - this.masterVuMeter.VuMeterL.connection = engine.makeConnection("[Main]", "vu_meter_left", TraktorS3.Controller.prototype.masterVuMeterHandler.bind(this)); - this.masterVuMeter.VuMeterR.connection = engine.makeConnection("[Main]", "vu_meter_right", TraktorS3.Controller.prototype.masterVuMeterHandler.bind(this)); + this.masterVuMeter.vu_meter_left.connection = engine.makeConnection("[Main]", "vu_meter_left", TraktorS3.Controller.prototype.masterVuMeterHandler.bind(this)); + this.masterVuMeter.vu_meter_right.connection = engine.makeConnection("[Main]", "vu_meter_right", TraktorS3.Controller.prototype.masterVuMeterHandler.bind(this)); this.linkChannelOutput("[Main]", "peak_indicator_left", TraktorS3.Controller.prototype.peakOutput.bind(this)); this.linkChannelOutput("[Main]", "peak_indicator_right", TraktorS3.Controller.prototype.peakOutput.bind(this)); this.guiTickConnection = engine.makeConnection("[App]", "gui_tick_50ms_period_s", TraktorS3.Controller.prototype.guiTickHandler.bind(this)); @@ -764,7 +764,7 @@ TraktorS3.Controller = class { for (const vu in this.masterVuMeter) { if (this.masterVuMeter[vu].updated) { - this.vuMeterOutput(this.masterVuMeter[vu].value, "[Master]", vu, 8); + this.vuMeterOutput(this.masterVuMeter[vu].value, "[Main]", vu, 8); this.masterVuMeter[vu].updated = false; gotUpdate = true; } @@ -772,7 +772,7 @@ TraktorS3.Controller = class { for (let ch = 1; ch <= 4; ch++) { const chan = this.Channels["[Channel" + ch + "]"]; if (chan.vuMeterUpdated) { - this.vuMeterOutput(chan.vuMeterValue, chan.group, "VuMeter", 14); + this.vuMeterOutput(chan.vuMeterValue, chan.group, "vu_meter", 14); chan.vuMeterUpdated = false; gotUpdate = true; } @@ -974,13 +974,13 @@ TraktorS3.Deck = class { if (engine.getValue(this.activeChannel, "sync_enabled") === 0) { script.triggerControl(this.activeChannel, "beatsync"); // Start timer to measure how long button is pressed - this.syncPressedTimer = engine.beginTimer(300, function() { + this.syncPressedTimer = engine.beginTimer(300, () => { engine.setValue(this.activeChannel, "sync_enabled", 1); // Reset sync button timer state if active if (this.syncPressedTimer !== 0) { this.syncPressedTimer = 0; } - }.bind(this), this, true); + }, this, true); // Light corresponding LED when button is pressed this.colorOutput(1, "sync_enabled"); @@ -1449,11 +1449,11 @@ TraktorS3.Deck = class { switch (this.deckNumber) { case 1: this.controller.hid.linkOutput("deck1", key, "[Channel1]", key, callback); - engine.connectControl("[Channel3]", key, callback); + engine.makeConnection("[Channel3]", key, callback); break; case 2: this.controller.hid.linkOutput("deck2", key, "[Channel2]", key, callback); - engine.connectControl("[Channel4]", key, callback); + engine.makeConnection("[Channel4]", key, callback); break; } } @@ -1516,7 +1516,7 @@ TraktorS3.Deck = class { } lightHotcue(number) { - const loaded = engine.getValue(this.activeChannel, "hotcue_" + number + "_enabled"); + const loaded = engine.getValue(this.activeChannel, "hotcue_" + number + "_status"); const active = engine.getValue(this.activeChannel, "hotcue_" + number + "_activate"); let ledValue = this.controller.hid.LEDColors.WHITE; if (loaded) { @@ -1660,7 +1660,7 @@ TraktorS3.Channel = class { } return; } - this.endOfTrackTimer = engine.beginTimer(400, function() { + this.endOfTrackTimer = engine.beginTimer(400, () => { this.endOfTrackBlinkState = !this.endOfTrackBlinkState; }, false); } @@ -1695,7 +1695,7 @@ TraktorS3.Channel = class { this.clipConnection = engine.makeConnection(this.group, "peak_indicator", TraktorS3.Controller.prototype.peakOutput.bind(this.controller)); this.controller.linkChannelOutput(this.group, "pfl", TraktorS3.Controller.prototype.pflOutput.bind(this.controller)); for (let j = 1; j <= 8; j++) { - this.hotcueCallbacks.push(engine.makeConnection(this.group, "hotcue_" + j + "_enabled", + this.hotcueCallbacks.push(engine.makeConnection(this.group, "hotcue_" + j + "_status", TraktorS3.Channel.prototype.hotcuesOutput.bind(this))); this.hotcueCallbacks.push(engine.makeConnection(this.group, "hotcue_" + j + "_activate", TraktorS3.Channel.prototype.hotcuesOutput.bind(this))); @@ -1956,7 +1956,7 @@ TraktorS3.FXControl = class { case this.STATE_EFFECT: break; case this.STATE_FOCUS: - this.focusBlinkTimer = engine.beginTimer(150, function() { + this.focusBlinkTimer = engine.beginTimer(150, () => { TraktorS3.kontrol.fxController.focusBlinkState = !TraktorS3.kontrol.fxController.focusBlinkState; TraktorS3.kontrol.fxController.lightFx(); }, false); @@ -2402,17 +2402,17 @@ TraktorS3.QuickFxControl = class { // This changes the lighting of the five FX Select buttons and maybe // also the FX Enable buttons - engine.connectControl("[QuickEffectRack1_[Channel1]]", "loaded_chain_preset", this.quickEffectChainLoadHandler.bind(this)); - engine.connectControl("[QuickEffectRack1_[Channel2]]", "loaded_chain_preset", this.quickEffectChainLoadHandler.bind(this)); - engine.connectControl("[QuickEffectRack1_[Channel3]]", "loaded_chain_preset", this.quickEffectChainLoadHandler.bind(this)); - engine.connectControl("[QuickEffectRack1_[Channel4]]", "loaded_chain_preset", this.quickEffectChainLoadHandler.bind(this)); + engine.makeConnection("[QuickEffectRack1_[Channel1]]", "loaded_chain_preset", this.quickEffectChainLoadHandler.bind(this)); + engine.makeConnection("[QuickEffectRack1_[Channel2]]", "loaded_chain_preset", this.quickEffectChainLoadHandler.bind(this)); + engine.makeConnection("[QuickEffectRack1_[Channel3]]", "loaded_chain_preset", this.quickEffectChainLoadHandler.bind(this)); + engine.makeConnection("[QuickEffectRack1_[Channel4]]", "loaded_chain_preset", this.quickEffectChainLoadHandler.bind(this)); // The FX enable buttons can directly be bound to the quick effect chain // enabled status as their lighting doesn't depend on other factors - engine.connectControl("[QuickEffectRack1_[Channel1]]", "enabled", value => this.lightFxEnable(1, value === 1)); - engine.connectControl("[QuickEffectRack1_[Channel2]]", "enabled", value => this.lightFxEnable(2, value === 1)); - engine.connectControl("[QuickEffectRack1_[Channel3]]", "enabled", value => this.lightFxEnable(3, value === 1)); - engine.connectControl("[QuickEffectRack1_[Channel4]]", "enabled", value => this.lightFxEnable(4, value === 1)); + engine.makeConnection("[QuickEffectRack1_[Channel1]]", "enabled", value => this.lightFxEnable(1, value === 1)); + engine.makeConnection("[QuickEffectRack1_[Channel2]]", "enabled", value => this.lightFxEnable(2, value === 1)); + engine.makeConnection("[QuickEffectRack1_[Channel3]]", "enabled", value => this.lightFxEnable(3, value === 1)); + engine.makeConnection("[QuickEffectRack1_[Channel4]]", "enabled", value => this.lightFxEnable(4, value === 1)); } // Input handling diff --git a/res/controllers/Traktor-Kontrol-S4-MK2-hid-scripts.js b/res/controllers/Traktor-Kontrol-S4-MK2-hid-scripts.js index 7af1452068c..09e7ca6b48e 100644 --- a/res/controllers/Traktor-Kontrol-S4-MK2-hid-scripts.js +++ b/res/controllers/Traktor-Kontrol-S4-MK2-hid-scripts.js @@ -1060,7 +1060,7 @@ TraktorS4MK2.jogTouchHandler = function(field) { TraktorS4MK2.finishJogTouch(field.group); } else { TraktorS4MK2.controller.wheelTouchInertiaTimer[field.group] = engine.beginTimer( - inertiaTime, "TraktorS4MK2.finishJogTouch(\"" + field.group + "\")", true); + inertiaTime, () => { TraktorS4MK2.finishJogTouch(field.group); }, true); } } }; @@ -1092,7 +1092,7 @@ TraktorS4MK2.finishJogTouch = function(group) { } else { // Check again soon. TraktorS4MK2.controller.wheelTouchInertiaTimer[group] = engine.beginTimer( - 100, "TraktorS4MK2.finishJogTouch(\"" + group + "\")", true); + 100, () => { TraktorS4MK2.finishJogTouch(group); }, true); } } }; diff --git a/res/controllers/Traktor-Kontrol-S4-MK3.js b/res/controllers/Traktor-Kontrol-S4-MK3.js index b8fbd1f1960..8c581ba78ca 100644 --- a/res/controllers/Traktor-Kontrol-S4-MK3.js +++ b/res/controllers/Traktor-Kontrol-S4-MK3.js @@ -444,7 +444,7 @@ class Deck extends ComponentContainer { this.moveMode = this.secondDeckModes.moveMode; if (this.wheelMode === wheelModes.motor) { - engine.beginTimer(MotorWindUpMilliseconds, function() { + engine.beginTimer(MotorWindUpMilliseconds, () => { engine.setValue(newGroup, "scratch2_enable", true); }, true); } @@ -537,7 +537,7 @@ class Button extends Component { indicator(on) { if (on && this.indicatorTimer === 0) { this.outDisconnect(); - this.indicatorTimer = engine.beginTimer(this.indicatorIntervalMillis, this.indicatorCallback.bind(this)); + this.indicatorTimer = engine.beginTimer(this.indicatorIntervalMillis, this.indicatorCallback); } else if (!on && this.indicatorTimer !== 0) { engine.stopTimer(this.indicatorTimer); this.indicatorTimer = 0; @@ -657,7 +657,7 @@ class CueButton extends PushButton { engine.setValue(this.group, this.inKey, pressed); if (this.deck.wheelMode === wheelModes.motor) { engine.setValue(this.group, "scratch2_enable", false); - engine.beginTimer(MotorWindDownMilliseconds, function() { + engine.beginTimer(MotorWindDownMilliseconds, () => { engine.setValue(this.group, "scratch2_enable", true); }, true); } @@ -2313,7 +2313,7 @@ class S4Mk3Deck extends Deck { } else { this.deck.wheelMode = wheelModes.motor; const group = this.group; - engine.beginTimer(MotorWindUpMilliseconds, function() { + engine.beginTimer(MotorWindUpMilliseconds, () => { engine.setValue(group, "scratch2_enable", true); }, true); } @@ -2380,7 +2380,7 @@ class S4Mk3Deck extends Deck { } else if (engine.getValue(this.group, "scratch2") === 0) { engine.setValue(this.group, "scratch2_enable", false); } else { - engine.beginTimer(100, this.stopScratchWhenOver.bind(this), true); + engine.beginTimer(100, this.stopScratchWhenOver, true); } } }); @@ -2922,7 +2922,7 @@ class S4MK3 { controller.sendOutputReport(129, deckMeters.buffer); }); if (UseMotors) { - engine.beginTimer(20, this.motorCallback.bind(this)); + engine.beginTimer(20, this.motorCallback); this.leftVelocityFactor = wheelAbsoluteMax * baseRevolutionsPerSecond * 2; this.rightVelocityFactor = wheelAbsoluteMax * baseRevolutionsPerSecond * 2; diff --git a/res/controllers/Traktor-Kontrol-Z1-scripts.js b/res/controllers/Traktor-Kontrol-Z1-scripts.js new file mode 100644 index 00000000000..b5e32e58fd8 --- /dev/null +++ b/res/controllers/Traktor-Kontrol-Z1-scripts.js @@ -0,0 +1,266 @@ +// +// Native Instruments Traktor Kontrol Z1 HID controller script for Mixxx 2.4 +// ------------------------------------------------------------------------- +// Based on: NI Traktor Kontrol series scripts by leifhelm, mi01 & xeruf +// Author: djantti +// + +class TraktorZ1Class { + constructor() { + this.controller = new HIDController(); + + // Modifier state + this.modePressed = false; + + // VU meters + this.vuLeftConnection = {}; + this.vuRightConnection = {}; + this.vuMeterThresholds = {"vu-30": (1 / 7), "vu-15": (2 / 7), "vu-6": (3 / 7), "vu-3": (4 / 7), "vu0": (5 / 7), "vu3": (6 / 7), "vu6": (7 / 7)}; + } + + init(_id) { + this.id = _id; + + this.registerInputPackets(); + this.registerOutputPackets(); + this.readCurrentPosition(); + this.enableSoftTakeover(); + + console.log(this.id + " initialized"); + } + + registerInputPackets() { + const InputReport0x01 = new HIDPacket("InputReport0x01", 0x01, this.inputReportCallback.bind(this)); + + // Mode button + this.registerInputButton(InputReport0x01, "[ControlX]", "!mode", 0x1D, 0x02, this.modeHandler.bind(this)); + + // Headphone buttons + this.registerInputButton(InputReport0x01, "[Channel1]", "!pfl", 0x1D, 0x10, this.headphoneHandler.bind(this)); + this.registerInputButton(InputReport0x01, "[Channel2]", "!pfl", 0x1D, 0x01, this.headphoneHandler.bind(this)); + + // FX buttons + this.registerInputButton(InputReport0x01, "[Channel1]", "!fx", 0x1D, 0x04, this.fxHandler.bind(this)); + this.registerInputButton(InputReport0x01, "[Channel2]", "!fx", 0x1D, 0x08, this.fxHandler.bind(this)); + + // EQ knobs + this.registerInputScaler(InputReport0x01, "[EqualizerRack1_[Channel1]_Effect1]", "parameter3", 0x03, 0xFFFF, this.parameterHandler.bind(this)); + this.registerInputScaler(InputReport0x01, "[EqualizerRack1_[Channel1]_Effect1]", "parameter2", 0x05, 0xFFFF, this.parameterHandler.bind(this)); + this.registerInputScaler(InputReport0x01, "[EqualizerRack1_[Channel1]_Effect1]", "parameter1", 0x07, 0xFFFF, this.parameterHandler.bind(this)); + this.registerInputScaler(InputReport0x01, "[EqualizerRack1_[Channel2]_Effect1]", "parameter3", 0x0D, 0xFFFF, this.parameterHandler.bind(this)); + this.registerInputScaler(InputReport0x01, "[EqualizerRack1_[Channel2]_Effect1]", "parameter2", 0x0F, 0xFFFF, this.parameterHandler.bind(this)); + this.registerInputScaler(InputReport0x01, "[EqualizerRack1_[Channel2]_Effect1]", "parameter1", 0x11, 0xFFFF, this.parameterHandler.bind(this)); + + // FX knobs + this.registerInputScaler(InputReport0x01, "[QuickEffectRack1_[Channel1]]", "super1", 0x09, 0xFFFF, this.parameterHandler.bind(this)); + this.registerInputScaler(InputReport0x01, "[QuickEffectRack1_[Channel2]]", "super1", 0x13, 0xFFFF, this.parameterHandler.bind(this)); + + // Gain knobs + this.registerInputScaler(InputReport0x01, "[Channel1]", "pregain", 0x01, 0xFFFF, this.parameterHandler.bind(this)); + this.registerInputScaler(InputReport0x01, "[Channel2]", "pregain", 0x0B, 0xFFFF, this.parameterHandler.bind(this)); + + // Headphone mix + this.registerInputScaler(InputReport0x01, "[Master]", "headMix", 0x15, 0xFFFF, this.parameterHandler.bind(this)); + + // Volume faders + this.registerInputScaler(InputReport0x01, "[Channel1]", "volume", 0x17, 0xFFFF, this.parameterHandler.bind(this)); + this.registerInputScaler(InputReport0x01, "[Channel2]", "volume", 0x19, 0xFFFF, this.parameterHandler.bind(this)); + + // Crossfader + this.registerInputScaler(InputReport0x01, "[Master]", "crossfader", 0x1B, 0xFFFF, this.parameterHandler.bind(this)); + + this.controller.registerInputPacket(InputReport0x01); + } + + registerOutputPackets() { + const OutputReport0x80 = new HIDPacket("OutputReport0x80", 0x80); + + OutputReport0x80.addOutput("[ControlX]", "mode", 0x13, "B"); + + OutputReport0x80.addOutput("[Channel1]", "pfl", 0x0F, "B"); + OutputReport0x80.addOutput("[Channel2]", "pfl", 0x10, "B"); + + OutputReport0x80.addOutput("[Channel1]", "play_indicator", 0x11, "B"); + OutputReport0x80.addOutput("[Channel2]", "play_indicator", 0x14, "B"); + + OutputReport0x80.addOutput("[QuickEffectRack1_[Channel1]]", "enabled", 0x12, "B"); + OutputReport0x80.addOutput("[QuickEffectRack1_[Channel2]]", "enabled", 0x15, "B"); + + OutputReport0x80.addOutput("[Channel1]", "vu-30", 0x01, "B"); + OutputReport0x80.addOutput("[Channel1]", "vu-15", 0x02, "B"); + OutputReport0x80.addOutput("[Channel1]", "vu-6", 0x03, "B"); + OutputReport0x80.addOutput("[Channel1]", "vu-3", 0x04, "B"); + OutputReport0x80.addOutput("[Channel1]", "vu0", 0x05, "B"); + OutputReport0x80.addOutput("[Channel1]", "vu3", 0x06, "B"); + OutputReport0x80.addOutput("[Channel1]", "vu6", 0x07, "B"); + + OutputReport0x80.addOutput("[Channel2]", "vu-30", 0x08, "B"); + OutputReport0x80.addOutput("[Channel2]", "vu-15", 0x09, "B"); + OutputReport0x80.addOutput("[Channel2]", "vu-6", 0x0A, "B"); + OutputReport0x80.addOutput("[Channel2]", "vu-3", 0x0B, "B"); + OutputReport0x80.addOutput("[Channel2]", "vu0", 0x0C, "B"); + OutputReport0x80.addOutput("[Channel2]", "vu3", 0x0D, "B"); + OutputReport0x80.addOutput("[Channel2]", "vu6", 0x0E, "B"); + + this.controller.registerOutputPacket(OutputReport0x80); + + engine.makeConnection("[QuickEffectRack1_[Channel1]]", "enabled", this.outputHandler.bind(this)); + engine.makeConnection("[QuickEffectRack1_[Channel2]]", "enabled", this.outputHandler.bind(this)); + + engine.makeConnection("[Channel1]", "pfl", this.outputHandler.bind(this)); + engine.makeConnection("[Channel2]", "pfl", this.outputHandler.bind(this)); + + this.vuLeftConnection = engine.makeUnbufferedConnection("[Channel1]", "vu_meter", this.vuMeterHandler.bind(this)); + this.vuRightConnection = engine.makeUnbufferedConnection("[Channel2]", "vu_meter", this.vuMeterHandler.bind(this)); + + this.lightDeck(false); + } + + readCurrentPosition() { + // Sync on-screen controls with controller knob positions + const report0x01 = new Uint8Array(controller.getInputReport(0x01)); + // The first packet is ignored by HIDController + this.controller.parsePacket([0x01, ...Array.from(report0x01.map(x => x ^ 0xFF))]); + this.controller.parsePacket([0x01, ...Array.from(report0x01)]); + } + + enableSoftTakeover() { + // Soft takeover for all knobs and faders + engine.softTakeover("[EqualizerRack1_[Channel1]_Effect1]", "parameter3", true); + engine.softTakeover("[EqualizerRack1_[Channel1]_Effect1]", "parameter2", true); + engine.softTakeover("[EqualizerRack1_[Channel1]_Effect1]", "parameter1", true); + + engine.softTakeover("[EqualizerRack1_[Channel2]_Effect1]", "parameter3", true); + engine.softTakeover("[EqualizerRack1_[Channel2]_Effect1]", "parameter2", true); + engine.softTakeover("[EqualizerRack1_[Channel2]_Effect1]", "parameter1", true); + + engine.softTakeover("[QuickEffectRack1_[Channel1]]", "super1", true); + engine.softTakeover("[QuickEffectRack1_[Channel2]]", "super1", true); + + engine.softTakeover("[Channel1]", "pregain", true); + engine.softTakeover("[Channel2]", "pregain", true); + + engine.softTakeover("[Master]", "headMix", true); + + engine.softTakeover("[Channel1]", "volume", true); + engine.softTakeover("[Channel2]", "volume", true); + + engine.softTakeover("[Master]", "crossfader", true); + } + + registerInputButton(inputReport, group, name, offset, bitmask, callback) { + inputReport.addControl(group, name, offset, "B", bitmask); + inputReport.setCallback(group, name, callback); + } + + registerInputScaler(inputReport, group, name, offset, bitmask, callback) { + inputReport.addControl(group, name, offset, "H", bitmask); + inputReport.setCallback(group, name, callback); + } + + modeHandler(field) { + this.modePressed = field.value; + this.outputHandler(field.value, field.group, "mode"); + } + + headphoneHandler(field) { + if (field.value === 0) { + return; + } + // Go to cue and stop when modifier is active + if (this.modePressed) { + engine.setValue(field.group, "cue_gotoandstop", field.value); + } else { + script.toggleControl(field.group, "pfl"); + } + } + + fxHandler(field) { + if (field.value === 0) { + // Always clear play indicator on button release + this.controller.setOutput(field.group, "play_indicator", 0x00, true); + return; + } + // Control playback when modifier is active + if (this.modePressed) { + // Match play indicator (red led) brightness to fx indicator (blue led) + const ledBrightness = engine.getValue("[QuickEffectRack1_" + field.group + "]", "enabled") ? 0x7F : 0x0A; + this.controller.setOutput(field.group, "play_indicator", ledBrightness, true); + script.toggleControl(field.group, "play"); + } else { + script.toggleControl("[QuickEffectRack1_" + field.group + "]", "enabled"); + } + } + + vuMeterHandler(value, group, _key) { + const vuKeys = Object.keys(this.vuMeterThresholds); + for (let i = 0; i < vuKeys.length; ++i) { + // Avoid spamming HID by only sending last LED update + const last = i === (vuKeys.length - 1); + if (this.vuMeterThresholds[vuKeys[i]] > value) { + this.controller.setOutput(group, vuKeys[i], 0x00, last); + } else { + this.controller.setOutput(group, vuKeys[i], 0x7F, last); + } + } + } + + parameterHandler(field) { + engine.setParameter(field.group, field.name, field.value / 4095); + } + + outputHandler(value, group, key) { + let ledValue; + if (value === 0 || value === false) { + // Off value (dimmed) + ledValue = 0x0A; + } else if (value === 1 || value === true) { + // On value + ledValue = 0x7F; + } + this.controller.setOutput(group, key, ledValue, true); + } + + lightDeck(switchOff) { + let softLight = 0x0A; + let fullLight = 0x7F; + let ledBrightness; + + if (switchOff) { + softLight = 0x00; + fullLight = 0x00; + } + + this.controller.setOutput("[ControlX]", "mode", softLight, true); + + ledBrightness = engine.getValue("[QuickEffectRack1_[Channel1]]", "enabled") ? fullLight : softLight; + this.controller.setOutput("[QuickEffectRack1_[Channel1]]", "enabled", ledBrightness, true); + ledBrightness = engine.getValue("[QuickEffectRack1_[Channel2]]", "enabled") ? fullLight : softLight; + this.controller.setOutput("[QuickEffectRack1_[Channel2]]", "enabled", ledBrightness, true); + + ledBrightness = engine.getValue("[Channel1]", "pfl") ? fullLight : softLight; + this.controller.setOutput("[Channel1]", "pfl", ledBrightness, true); + ledBrightness = engine.getValue("[Channel2]", "pfl") ? fullLight : softLight; + this.controller.setOutput("[Channel2]", "pfl", ledBrightness, true); + } + + inputReportCallback(packet, data) { + for (const name in data) { + if (Object.hasOwnProperty.call(data, name)) { + this.controller.processButton(data[name]); + } + } + } + + shutdown() { + // Deactivate all LEDs + this.lightDeck(true); + console.log(this.id + " shut down"); + } + + incomingData(data, length) { + this.controller.parsePacket(data, length); + } +} + +var TraktorZ1 = new TraktorZ1Class; // eslint-disable-line no-var, no-unused-vars diff --git a/res/controllers/Vestax-Spin-scripts.js b/res/controllers/Vestax-Spin-scripts.js index e8f18e4eae7..ce3a91eecb8 100644 --- a/res/controllers/Vestax-Spin-scripts.js +++ b/res/controllers/Vestax-Spin-scripts.js @@ -335,7 +335,7 @@ VestaxSpin.Button.prototype.handleWheelTouch = function() { } } this.timer = engine.beginTimer(VestaxSpin.SCRATCH_TIMER_PERIOD, - "VestaxSpin.GetDeck(\"" + this.group + "\").buttons[\"wheeltouch\"].callback()"); + () => VestaxSpin.GetDeck(this.group).buttons.wheeltouch.callback()); } } diff --git a/res/controllers/Vestax-VCI-100-3DEX-scripts.js b/res/controllers/Vestax-VCI-100-3DEX-scripts.js index 2e56c695fc1..60159312190 100644 --- a/res/controllers/Vestax-VCI-100-3DEX-scripts.js +++ b/res/controllers/Vestax-VCI-100-3DEX-scripts.js @@ -39,7 +39,7 @@ midi.sendShortMsg(0x80,0x64,0x7F);// reloop/exit button led off } -engine.beginTimer(150, "VestaxVCI1003DEX.loopLeds()",false) +engine.beginTimer(150, VestaxVCI1003DEX.loopLeds,false) //timer for loop leds end diff --git a/res/controllers/Vestax-VCI-100MKII-scripts.js b/res/controllers/Vestax-VCI-100MKII-scripts.js index b8c44ff9b72..9fd2b540949 100644 --- a/res/controllers/Vestax-VCI-100MKII-scripts.js +++ b/res/controllers/Vestax-VCI-100MKII-scripts.js @@ -48,7 +48,7 @@ VCI102.selectTimer = 0; VCI102.selectIter = function(select) { if (select) { select(); - VCI102.selectTimer = engine.beginTimer(500, function() { + VCI102.selectTimer = engine.beginTimer(500, () => { VCI102.selectTimer = engine.beginTimer(40, select); }, true); } else { @@ -98,7 +98,7 @@ VCI102.slip = function(value, group, key) { if (engine.getValue(group, "slip_enabled") && !VCI102.slipSrc[ch]) { VCI102.slipReady[ch] = false; engine.setValue(group, "slip_enabled", 0); - engine.beginTimer(60, function() { + engine.beginTimer(60, () => { engine.setValue(group, "slip_enabled", 1); VCI102.slipReady[ch] = true; }, true); @@ -124,7 +124,7 @@ VCI102.scratchEnable = function(ch, midino, value, status, group) { VCI102.slip(value, group); } } else if (engine.isScratching(deck)) { - VCI102.scratchTimer[ch] = engine.beginTimer(20, function() { + VCI102.scratchTimer[ch] = engine.beginTimer(20, () => { var vel = Math.abs(engine.getValue(group, "scratch2")); if (vel < 1 && (vel < 1 / 64 || engine.getValue(group, "play"))) { if (VCI102.scratchTimer[ch]) { diff --git a/res/controllers/Vestax-VCI-300-scripts.js b/res/controllers/Vestax-VCI-300-scripts.js index e3abc304ac8..15ea0a23334 100644 --- a/res/controllers/Vestax-VCI-300-scripts.js +++ b/res/controllers/Vestax-VCI-300-scripts.js @@ -402,11 +402,9 @@ VestaxVCI300.Deck.prototype.disableScratching = function() { if ((!this.isPlaying() && (VestaxVCI300.JOG_SCRATCH2_ABS_MIN < Math.abs(scratch2))) || (scratch2 < VestaxVCI300.JOG_SCRATCH2_PLAY_MIN) || (scratch2 > VestaxVCI300.JOG_SCRATCH2_PLAY_MAX)) { - var timeoutCallback = - "VestaxVCI300.onScratchingTimeoutDeck" + this.number + "()"; this.scratchTimer = engine.beginTimer( VestaxVCI300.JOG_SCRATCH_TIMEOUT, - timeoutCallback, + VestaxVCI300["onScratchingTimeoutDeck" + this.number], true); } if (0 === this.scratchTimer) { diff --git a/res/controllers/Vestax-VCI-400-scripts.js b/res/controllers/Vestax-VCI-400-scripts.js index 804baf6d15a..815b8d463ff 100644 --- a/res/controllers/Vestax-VCI-400-scripts.js +++ b/res/controllers/Vestax-VCI-400-scripts.js @@ -621,7 +621,7 @@ VestaxVCI400.Deck.prototype.onWheelTouch = function(value) { this.finishWheelTouch(); } else { this.wheelTouchInertiaTimer = engine.beginTimer( - inertiaTime, "VestaxVCI400.Decks." + this.deckIdentifier + ".finishWheelTouch()", true); + inertiaTime, () => { VestaxVCI400.Decks[this.deckIdentifier].finishWheelTouch(); }, true); } } }; @@ -631,7 +631,7 @@ VestaxVCI400.Deck.prototype.finishWheelTouch = function() { if (this.vinylActive) { // Vinyl button still being pressed, don't disable scratch mode yet. this.wheelTouchInertiaTimer = engine.beginTimer( - 100, "VestaxVCI400.Decks." + this.deckIdentifier + ".finishWheelTouch()", true); + 100, () => { VestaxVCI400.Decks[this.deckIdentifier].finishWheelTouch(); }, true); return; } var play = engine.getValue(this.group, "play"); @@ -648,7 +648,7 @@ VestaxVCI400.Deck.prototype.finishWheelTouch = function() { } else { // Check again soon. this.wheelTouchInertiaTimer = engine.beginTimer( - 100, "VestaxVCI400.Decks." + this.deckIdentifier + ".finishWheelTouch()", true); + 100, () => { VestaxVCI400.Decks[this.deckIdentifier].finishWheelTouch(); }, true); } } }; diff --git a/res/controllers/Yaeltex-MiniMixxx-scripts.js b/res/controllers/Yaeltex-MiniMixxx-scripts.js index 65550567a7e..20e55ee7869 100644 --- a/res/controllers/Yaeltex-MiniMixxx-scripts.js +++ b/res/controllers/Yaeltex-MiniMixxx-scripts.js @@ -297,10 +297,10 @@ MiniMixxx.EncoderModeGain = class extends MiniMixxx.Mode { engine.stopTimer(this.idleTimer); } this.showGain = true; - this.idleTimer = engine.beginTimer(1000, function() { + this.idleTimer = engine.beginTimer(1000, () => { this.showGain = false; this.vuIndicator(engine.getValue(this.channel, "vu_meter")); - }.bind(this), true); + }, true); midi.sendShortMsg(0xBF, this.idx, this.color); midi.sendShortMsg(0xB0, this.idx, script.absoluteNonLinInverse(value, 0, 1.0, 4.0)); } @@ -966,13 +966,13 @@ MiniMixxx.ButtonModeSync = class extends MiniMixxx.ButtonMode { if (engine.getValue(this.channel, "sync_enabled") === 0) { engine.setValue(this.channel, "sync_enabled", 1); // Start timer to measure how long button is pressed - this.syncPressedTimer = engine.beginTimer(300, function() { + this.syncPressedTimer = engine.beginTimer(300, () => { engine.setValue(this.channel, "sync_enabled", 1); // Reset sync button timer state if active if (this.syncPressedTimer !== 0) { this.syncPressedTimer = 0; } - }.bind(this), true); + }, true); } else { // Deactivate sync lock // LED is turned off by the callback handler for sync_enabled diff --git a/res/controllers/common-controller-scripts.js b/res/controllers/common-controller-scripts.js index 68eed589541..3a963c6f85d 100644 --- a/res/controllers/common-controller-scripts.js +++ b/res/controllers/common-controller-scripts.js @@ -243,9 +243,7 @@ script.triggerControl = function(group, control, delay) { delay = 200; } engine.setValue(group, control, 1); - engine.beginTimer(delay, function() { - engine.setValue(group, control, 0); - }, true); + engine.beginTimer(delay, () => engine.setValue(group, control, 0) , true); }; /* -------- ------------------------------------------------------ diff --git a/res/controllers/common-hid-packet-parser.js b/res/controllers/common-hid-packet-parser.js index 7070d3ec4b1..2b66d00fade 100644 --- a/res/controllers/common-hid-packet-parser.js +++ b/res/controllers/common-hid-packet-parser.js @@ -1233,38 +1233,6 @@ class HIDController { */ this.deckSwitchMap = {1: 2, 2: 1, 3: 4, 4: 3, undefined: 1}; - /** - * Standard target groups available in mixxx. - * - * This is used by HID packet parser to recognize group parameters we should try sending to mixxx. - * @type {string[]} - */ - this.valid_groups = [ - "[Channel1]", - "[Channel2]", - "[Channel3]", - "[Channel4]", - "[Sampler1]", - "[Sampler2]", - "[Sampler3]", - "[Sampler4]", - "[Sampler5]", - "[Sampler6]", - "[Sampler7]", - "[Sampler8]", - "[Master]", - "[PreviewDeck1]", - "[Effects]", - "[Playlist]", - "[Flanger]", - "[Microphone]", - "[EffectRack1_EffectUnit1]", - "[EffectRack1_EffectUnit2]", - "[EffectRack1_EffectUnit3]", - "[EffectRack1_EffectUnit4]", - "[InternalClock]" - ]; - // /** * Set to value in ms to update Outputs periodically @@ -1357,34 +1325,36 @@ class HIDController { return `[Channel${deck}]`; } /** - * Map virtual deck names to real deck group. If group is already - * a real mixxx group value, just return it as it without mapping. - * @param {string} group Control group name e.g. "[Channel1]" + * Map virtual deck names ("deck, "deck1", "deck2") to real deck group. If group is already a + * real mixxx group value, just return it as it without mapping. + * @param {string} group Control group name e.g. "[Channel1]" or "deck" or "deck1". * @returns {string} Channel */ resolveGroup(group) { - const channel_name = /\[Channel[0-9]+\]/; - if (group !== undefined && group.match(channel_name)) { - return group; - } - if (this.valid_groups.indexOf(group) !== -1) { - return group; - } if (group === "deck" || group === undefined) { if (this.activeDeck === undefined) { return undefined; } return `[Channel${this.activeDeck}]`; } - if (this.activeDeck === 1 || this.activeDeck === 2) { - if (group === "deck1") { return "[Channel1]"; } - if (group === "deck2") { return "[Channel2]"; } - } - if (this.activeDeck === 3 || this.activeDeck === 4) { - if (group === "deck1") { return "[Channel3]"; } - if (group === "deck2") { return "[Channel4]"; } + if (group === "deck1") { + if (this.activeDeck === 1 || this.activeDeck === 2) { + return "[Channel1]"; + } + if (this.activeDeck === 3 || this.activeDeck === 4) { + return "[Channel3]"; + } + return undefined; + } else if (group === "deck2") { + if (this.activeDeck === 1 || this.activeDeck === 2) { + return "[Channel2]"; + } + if (this.activeDeck === 3 || this.activeDeck === 4) { + return "[Channel4]"; + } + return undefined; } - return undefined; + return group; } /** * Find Output control matching give group and name @@ -1741,16 +1711,10 @@ class HIDController { return this.resolveGroup(field.mapped_group); } const group = field.group; - if (group === undefined) { - if (this.activeDeck !== undefined) { - return `[Channel${this.activeDeck}]`; - } - } - if (this.valid_groups.indexOf(group) !== -1) { - // console.log(`Resolving group ${group}`); - return this.resolveGroup(group); + if (group === "deck" || group === "deck1" || group === "deck2") { + return group; } - return group; + return this.resolveGroup(group); } /** * Get active control name from field @@ -2111,9 +2075,12 @@ class HIDController { continue; } const bitControlGroup = this.resolveGroup(bit.mapped_group); + if (bitControlGroup === undefined) { + console.warn("HIDController.switchDeck: resolvedGroup(bit.mapped_group) returned undefined"); + } engine.connectControl( bitControlGroup, bit.mapped_name, bit.mapped_callback, true); - engine.connectControl(new_group, bit.mapped_name, bit.mapped_callback); + engine.makeConnection(new_group, bit.mapped_name, bit.mapped_callback); const value = engine.getValue(new_group, bit.mapped_name); console.log(`Bit ${bit.group}.${bit.name} value ${value}`); if (value) { @@ -2134,9 +2101,12 @@ class HIDController { continue; } const fieldControlGroup = this.resolveGroup(field.mapped_group); + if (fieldControlGroup === undefined) { + console.warn("HIDController.switchDeck: resolvedGroup(field.mapped_group) returned undefined"); + } engine.connectControl( fieldControlGroup, field.mapped_name, field.mapped_callback, true); - engine.connectControl(new_group, field.mapped_name, field.mapped_callback); + engine.makeConnection(new_group, field.mapped_name, field.mapped_callback); const value = engine.getValue(new_group, field.mapped_name); if (value) { this.setOutput( @@ -2176,10 +2146,13 @@ class HIDController { return; } const controlgroup = this.resolveGroup(m_group); + if (controlgroup === undefined) { + console.warn("HIDController.linkOutput: resolvedGroup(m_group) returned undefined"); + } field.mapped_group = m_group; field.mapped_name = m_name; field.mapped_callback = callback; - engine.connectControl(controlgroup, m_name, callback); + engine.makeConnection(controlgroup, m_name, callback); if (engine.getValue(controlgroup, m_name)) { this.setOutput(m_group, m_name, this.LEDColors.on); } else { @@ -2203,6 +2176,9 @@ class HIDController { return; } const controlgroup = this.resolveGroup(field.mapped_group); + if (controlgroup === undefined) { + console.warn("HIDController.unlinkOutput: resolvedGroup(field.mapped_group) returned undefined"); + } engine.connectControl(controlgroup, field.mapped_name, callback, true); field.mapped_group = undefined; field.mapped_name = undefined; diff --git a/res/controllers/midi-components-0.0.js b/res/controllers/midi-components-0.0.js index e0cc0d7bcff..ab5c11ed7c5 100644 --- a/res/controllers/midi-components-0.0.js +++ b/res/controllers/midi-components-0.0.js @@ -190,10 +190,10 @@ if (this.isPress(channel, control, value, status)) { this.inToggle(); this.isLongPressed = false; - this.longPressTimer = engine.beginTimer(this.longPressTimeout, function() { + this.longPressTimer = engine.beginTimer(this.longPressTimeout, () => { this.isLongPressed = true; this.longPressTimer = 0; - }.bind(this), true); + }, true); } else { if (this.isLongPressed) { this.inToggle(); @@ -255,10 +255,10 @@ if (this.isPress(channel, control, value, status)) { if (engine.getValue(this.group, "sync_enabled") === 0) { engine.setValue(this.group, "beatsync", 1); - this.longPressTimer = engine.beginTimer(this.longPressTimeout, function() { + this.longPressTimer = engine.beginTimer(this.longPressTimeout, () => { engine.setValue(this.group, "sync_enabled", 1); this.longPressTimer = 0; - }.bind(this), true); + }, true); } else { engine.setValue(this.group, "sync_enabled", 0); } diff --git a/res/linux/org.mixxx.Mixxx.desktop b/res/linux/org.mixxx.Mixxx.desktop index 06cc99ced91..4218ed78544 100644 --- a/res/linux/org.mixxx.Mixxx.desktop +++ b/res/linux/org.mixxx.Mixxx.desktop @@ -13,4 +13,5 @@ Terminal=false Icon=mixxx Type=Application StartupNotify=true +StartupWMClass=org.mixxx.mixxx Categories=Qt;AudioVideo;Audio;Midi;Mixer;Player;Recorder;Sequencer; diff --git a/res/skins/Deere/deck_tempo_column.xml b/res/skins/Deere/deck_tempo_column.xml index 8c27847e5e1..886fa154425 100644 --- a/res/skins/Deere/deck_tempo_column.xml +++ b/res/skins/Deere/deck_tempo_column.xml @@ -15,21 +15,31 @@ TempoControlButtons vertical - + + horizontal + RateTempButtons + + + + + RateTempButtons @@ -93,7 +103,7 @@ 50f,-1me 40,200 slider-vertical.svg - handle-vertical-blue.svg + handle-volume-deck.svg ,rate diff --git a/res/skins/Deere/handle-vertical-purple.svg b/res/skins/Deere/handle-vertical-purple.svg index 1ccd440a239..8bd56dce03e 100644 --- a/res/skins/Deere/handle-vertical-purple.svg +++ b/res/skins/Deere/handle-vertical-purple.svg @@ -1,6 +1,5 @@ - - - - + + + diff --git a/res/skins/Deere/handle-volume-deck1.svg b/res/skins/Deere/handle-volume-deck1.svg new file mode 100644 index 00000000000..c595936fb43 --- /dev/null +++ b/res/skins/Deere/handle-volume-deck1.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/res/skins/Deere/handle-volume-deck2.svg b/res/skins/Deere/handle-volume-deck2.svg new file mode 100644 index 00000000000..10f79b79b87 --- /dev/null +++ b/res/skins/Deere/handle-volume-deck2.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/res/skins/Deere/handle-volume-deck3.svg b/res/skins/Deere/handle-volume-deck3.svg new file mode 100644 index 00000000000..8bd56dce03e --- /dev/null +++ b/res/skins/Deere/handle-volume-deck3.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/res/skins/Deere/handle-volume-deck4.svg b/res/skins/Deere/handle-volume-deck4.svg new file mode 100644 index 00000000000..6ee09a405d6 --- /dev/null +++ b/res/skins/Deere/handle-volume-deck4.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/res/skins/Deere/icon/ic_sync_leader_off.svg b/res/skins/Deere/icon/ic_sync_leader_off.svg new file mode 100644 index 00000000000..9cc351d83c1 --- /dev/null +++ b/res/skins/Deere/icon/ic_sync_leader_off.svg @@ -0,0 +1,23 @@ + + + + + + + + diff --git a/res/skins/Deere/icon/ic_sync_leader_off_plain.svg b/res/skins/Deere/icon/ic_sync_leader_off_plain.svg new file mode 100644 index 00000000000..c64923c2ac0 --- /dev/null +++ b/res/skins/Deere/icon/ic_sync_leader_off_plain.svg @@ -0,0 +1,26 @@ + + + + + + + + + + diff --git a/res/skins/Deere/icon/ic_sync_leader_on.svg b/res/skins/Deere/icon/ic_sync_leader_on.svg new file mode 100644 index 00000000000..375321e7761 --- /dev/null +++ b/res/skins/Deere/icon/ic_sync_leader_on.svg @@ -0,0 +1,23 @@ + + + + + + + + diff --git a/res/skins/Deere/mixer.xml b/res/skins/Deere/mixer.xml index aef51ded70c..d1b8e6f3a04 100644 --- a/res/skins/Deere/mixer.xml +++ b/res/skins/Deere/mixer.xml @@ -176,7 +176,7 @@ 1me,40f 200, slider-crossfader.svg - handle-crossfader-orange.svg + handle-crossfader-grey.svg true [Master],crossfader diff --git a/res/skins/Deere/mixer_column_volume_gain.xml b/res/skins/Deere/mixer_column_volume_gain.xml index 9e9ae1d57c3..3afab70c722 100644 --- a/res/skins/Deere/mixer_column_volume_gain.xml +++ b/res/skins/Deere/mixer_column_volume_gain.xml @@ -30,7 +30,7 @@ 40,50 40,150 slider-vertical.svg - handle-vertical-orange.svg + handle-volume-deck.svg false ,volume diff --git a/res/skins/Deere/mixer_controls_4decks_left.xml b/res/skins/Deere/mixer_controls_4decks_left.xml index 405203976b0..56ac54e09d2 100644 --- a/res/skins/Deere/mixer_controls_4decks_left.xml +++ b/res/skins/Deere/mixer_controls_4decks_left.xml @@ -183,7 +183,7 @@ 40,50 40,-1 slider-vertical.svg - handle-vertical-orange.svg + handle-volume-deck.svg false ,volume @@ -250,7 +250,7 @@ 40,50 40,-1 slider-vertical.svg - handle-vertical-orange.svg + handle-volume-deck.svg false ,volume diff --git a/res/skins/Deere/mixer_controls_4decks_right.xml b/res/skins/Deere/mixer_controls_4decks_right.xml index bd77b73f520..25e76a249f9 100644 --- a/res/skins/Deere/mixer_controls_4decks_right.xml +++ b/res/skins/Deere/mixer_controls_4decks_right.xml @@ -171,7 +171,7 @@ 40,50 40,-1 slider-vertical.svg - handle-vertical-orange.svg + handle-volume-deck.svg false ,volume @@ -249,7 +249,7 @@ 40,50 40,-1 slider-vertical.svg - handle-vertical-orange.svg + handle-volume-deck.svg false ,volume diff --git a/res/skins/Deere/skin.xml b/res/skins/Deere/skin.xml index 2a68ad0ce05..11ff0eaa8f1 100644 --- a/res/skins/Deere/skin.xml +++ b/res/skins/Deere/skin.xml @@ -29,6 +29,7 @@ 1 1 1 + 0 1 0 diff --git a/res/skins/Deere/style.qss b/res/skins/Deere/style.qss index 77b2c1d4cdd..293ec874de6 100644 --- a/res/skins/Deere/style.qss +++ b/res/skins/Deere/style.qss @@ -1625,6 +1625,17 @@ WPushButton[value="2"], background-color: #006596; border: 1px solid #006596; } +WPushButton#SyncLeader[value="1"] { + background-color: #4B4B4B; + border: 1px solid #0092d9; +} +WPushButton#SyncLeader[value="0"] { + image: url(skin:/../Deere/icon/ic_sync_leader_off.svg) no-repeat center center; +} +WPushButton#SyncLeader[value="1"], +WPushButton#SyncLeader[value="2"] { + image: url(skin:/../Deere/icon/ic_sync_leader_on.svg) no-repeat center center; +} WPushButton[value="1"]:hover, WPushButton[value="2"]:hover, @@ -2028,6 +2039,16 @@ WSearchLineEdit QAbstractScrollArea, /* remove OS focus indicator */ outline: none; } + /* required on Windows since the QAbstractItemViews don't inherit styles from + the respective QComboBoxes */ + WEffectSelector QAbstractItemView, + WEffectChainPresetSelector QAbstractItemView, + WSearchLineEdit QAbstractItemView { + selection-color: #fff; + selection-background-color: #565353; + border: 0px; + outline: none; + } /* Remove 3D border from unchecked effects checkmark space */ WEffectSelector::item:selected, WEffectChainPresetSelector::item:selected, diff --git a/res/skins/Deere/vumeter_main.xml b/res/skins/Deere/vumeter_main.xml index 702dd715287..70959a1ecda 100644 --- a/res/skins/Deere/vumeter_main.xml +++ b/res/skins/Deere/vumeter_main.xml @@ -15,13 +15,13 @@ horizontal