summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt124
-rwxr-xr-xbuild18
-rw-r--r--debian/changelog8
-rw-r--r--debian/copyright19
-rw-r--r--debian/copyright_hints45
-rw-r--r--docs/changelog.yml24
-rw-r--r--faust-src/tonedsp.dsp17
-rw-r--r--faust-src/volumedsp.dsp14
-rw-r--r--jacktrip.pro12
-rw-r--r--linux/icons/jacktrip_48x48_alt.pngbin0 -> 692 bytes
-rw-r--r--linux/icons/jacktrip_alt.svg96
-rwxr-xr-xmacos/assemble_app.sh118
-rw-r--r--macos/jacktrip_alt.icnsbin0 -> 67558 bytes
-rw-r--r--macos/jacktrip_alt.iconset/icon_128x128.pngbin0 -> 1626 bytes
-rw-r--r--macos/jacktrip_alt.iconset/icon_128x128@2x.pngbin0 -> 2975 bytes
-rw-r--r--macos/jacktrip_alt.iconset/icon_16x16.pngbin0 -> 259 bytes
-rw-r--r--macos/jacktrip_alt.iconset/icon_16x16@2x.pngbin0 -> 450 bytes
-rw-r--r--macos/jacktrip_alt.iconset/icon_256x256.pngbin0 -> 2975 bytes
-rw-r--r--macos/jacktrip_alt.iconset/icon_256x256@2x.pngbin0 -> 5799 bytes
-rw-r--r--macos/jacktrip_alt.iconset/icon_32x32.pngbin0 -> 450 bytes
-rw-r--r--macos/jacktrip_alt.iconset/icon_32x32@2x.pngbin0 -> 844 bytes
-rw-r--r--macos/jacktrip_alt.iconset/icon_512x512.pngbin0 -> 5799 bytes
-rw-r--r--macos/jacktrip_alt.iconset/icon_512x512@2x.pngbin0 -> 13273 bytes
-rwxr-xr-xmacos/sign-stuff.sh62
-rw-r--r--meson.build6
-rw-r--r--releases/edge/mac-manifests.json28
-rw-r--r--releases/edge/win-manifests.json28
-rw-r--r--releases/stable/linux-manifests.json15
-rw-r--r--releases/stable/mac-manifests.json18
-rw-r--r--releases/stable/win-manifests.json18
-rw-r--r--rtaudio.pro1
-rw-r--r--src/AudioInterface.cpp18
-rw-r--r--src/AudioInterface.h4
-rw-r--r--src/Auth.cpp2
-rw-r--r--src/JackAudioInterface.cpp36
-rw-r--r--src/JackAudioInterface.h9
-rw-r--r--src/JackTripWorker.cpp5
-rw-r--r--src/JackTripWorker.h10
-rw-r--r--src/Meter.cpp9
-rw-r--r--src/RtAudioInterface.cpp9
-rw-r--r--src/RtAudioInterface.h4
-rw-r--r--src/Settings.cpp1
-rw-r--r--src/Tone.cpp95
-rw-r--r--src/Tone.h96
-rw-r--r--src/UdpHubListener.cpp5
-rw-r--r--src/UdpHubListener.h5
-rw-r--r--src/Volume.cpp113
-rw-r--r--src/Volume.h101
-rw-r--r--src/compressordsp.h1174
-rw-r--r--src/dblsqd/feed.cpp11
-rw-r--r--src/dblsqd/semver.cpp15
-rw-r--r--src/dblsqd/semver.h2
-rw-r--r--src/freeverbdsp.h1485
-rw-r--r--src/freeverbmonodsp.h1412
-rw-r--r--src/gui/Connected.qml158
-rw-r--r--src/gui/Settings.qml95
-rw-r--r--src/gui/Setup.qml166
-rw-r--r--src/gui/Studio.qml8
-rw-r--r--src/gui/about.cpp2
-rw-r--r--src/gui/about.ui2
-rw-r--r--src/gui/alt/Jacktrip.ai (renamed from src/gui/Jacktrip.ai)0
-rw-r--r--src/gui/alt/about.pngbin0 -> 1626 bytes
-rw-r--r--src/gui/alt/about@2x.pngbin0 -> 2975 bytes
-rw-r--r--src/gui/alt/icon.pngbin0 -> 450 bytes
-rw-r--r--src/gui/micoff.svg17
-rw-r--r--src/gui/qjacktrip.cpp60
-rw-r--r--src/gui/qjacktrip.h11
-rw-r--r--src/gui/qjacktrip.qrc1
-rw-r--r--src/gui/qjacktrip.ui1127
-rw-r--r--src/gui/qjacktrip_novs.ui1880
-rw-r--r--src/gui/virtualstudio.cpp288
-rw-r--r--src/gui/virtualstudio.h53
-rw-r--r--src/gui/vsAudioInterface.cpp383
-rw-r--r--src/gui/vsAudioInterface.h143
-rw-r--r--src/gui/vsConstants.h50
-rw-r--r--src/gui/vsDevice.cpp155
-rw-r--r--src/gui/vsDevice.h15
-rw-r--r--src/gui/vsWebSocket.cpp2
-rw-r--r--src/jacktrip_globals.h2
-rw-r--r--src/limiterdsp.h1065
-rw-r--r--src/main.cpp43
-rw-r--r--src/meterdsp.h395
-rw-r--r--src/tonedsp.h2237
-rw-r--r--src/volumedsp.h1986
-rw-r--r--src/zitarevdsp.h1903
-rw-r--r--src/zitarevmonodsp.h2011
-rwxr-xr-xwin/build_installer.bat29
-rw-r--r--win/dialog_alt.bmpbin0 -> 615402 bytes
-rw-r--r--win/files.wxs96
-rwxr-xr-xwin/getCsv.sh2
-rw-r--r--win/jacktrip.wxs4
-rw-r--r--win/jacktrip_alt.icobin0 -> 93096 bytes
92 files changed, 13215 insertions, 6466 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 81717bf..b33c429 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,44 +1,72 @@
cmake_minimum_required(VERSION 3.12)
-set(CMAKE_OSX_DEPLOYMENT_TARGET 10.13)
-set(CMAKE_OSX_ARCHITECTURES arm64;x86_64)
+set(CMAKE_OSX_DEPLOYMENT_TARGET 10.14)
project(QJackTrip)
set(nogui FALSE)
set(rtaudio TRUE)
set(weakjack TRUE)
-set(novs TRUE)
+set(novs FALSE)
+set(noupdater FALSE)
+set(psi FALSE)
+set(QtVersion "5")
+
+if (${QtVersion} MATCHES "5")
+ set(CMAKE_OSX_DEPLOYMENT_TARGET 10.13)
+ set(CMAKE_OSX_ARCHITECTURES arm64;x86_64)
+endif ()
message(STATUS "Hello Aaron! For anyone else, heed the following warning:")
message(WARNING "The CMake build of JackTrip is currently NOT officially supported. Meson or QMake are recommended for a full featured build."
"https://jacktrip.github.io/jacktrip/Build/Meson_build/")
-add_compile_definitions(PSI)
-add_compile_definitions(NO_UPDATER)
-#add_compile_definitions(BUILD_TYPE="psi-borg.org NO_VS binary")
-#string(TIMESTAMP BUILD_DATE "%Y%m%d")
-#set(BUILD_NUMBER "00")
-#add_compile_definitions(BUILD_ID="${BUILD_DATE}${BUILD_NUMBER}")
-#add_compile_definitions(NDEBUG)
-add_compile_definitions(QT_OPENSOURCE)
-
if (nogui)
add_compile_definitions(NO_GUI)
set(novs TRUE)
+ set(noupdater TRUE)
endif ()
-if (rtaudio)
- add_compile_definitions(RT_AUDIO)
+if (novs)
+ set(QRC_FILE "src/gui/qjacktrip_novs.qrc")
+else ()
+ set(QRC_FILE "src/gui/qjacktrip.qrc")
endif ()
-if (weakjack)
- add_compile_definitions(USE_WEAK_JACK)
- include_directories("externals/weakjack")
-endif()
+if (psi)
+ add_compile_definitions(PSI)
+ set(novs TRUE)
+ if (novs)
+ add_compile_definitions(BUILD_TYPE="psi-borg.org NO_VS binary")
+ else ()
+ add_compile_definitions(BUILD_TYPE="psi-borg.org binary")
+ endif ()
+
+ file(READ "${QRC_FILE}" QRC_CONTENTS)
+ string(REPLACE "<file>about@2x.png" "<file alias=\"about@2x.png\">alt/about@2x.png" QRC_CONTENTS "${QRC_CONTENTS}")
+ string(REPLACE "<file>about.png" "<file alias=\"about.png\">alt/about.png" QRC_CONTENTS "${QRC_CONTENTS}")
+ string(REPLACE "<file>icon.png" "<file alias=\"icon.png\">alt/icon.png" QRC_CONTENTS "${QRC_CONTENTS}")
+ file(WRITE "${QRC_FILE}" "${QRC_CONTENTS}")
+ string(TIMESTAMP BUILD_DATE "%Y%m%d")
+ set(BUILD_NUMBER "00")
+ add_compile_definitions(BUILD_ID="${BUILD_DATE}${BUILD_NUMBER}")
+ add_compile_definitions(NDEBUG)
+else ()
+ file(READ "${QRC_FILE}" QRC_CONTENTS)
+ string(REPLACE "<file alias=\"about@2x.png\">alt/about@2x.png" "<file>about@2x.png" QRC_CONTENTS "${QRC_CONTENTS}")
+ string(REPLACE "<file alias=\"about.png\">alt/about.png" "<file>about.png" QRC_CONTENTS "${QRC_CONTENTS}")
+ string(REPLACE "<file alias=\"icon.png\">alt/icon.png" "<file>icon.png" QRC_CONTENTS "${QRC_CONTENTS}")
+ file(WRITE "${QRC_FILE}" "${QRC_CONTENTS}")
+endif ()
if (novs)
add_compile_definitions(NO_VS)
endif ()
+if (noupdater)
+ add_compile_definitions(NO_UPDATER)
+endif ()
+
+add_compile_definitions(QT_OPENSOURCE)
+
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set (ENV{PKG_CONFIG_PATH} "/usr/local/lib/pkgconfig")
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
@@ -50,13 +78,18 @@ elseif (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
include_directories("C:/Program Files (x86)/Jack/includes")
set (jacklib "C:/Program Files (x86)/Jack/lib/libjack64.lib")
endif ()
- set (CMAKE_PREFIX_PATH "C:/Qt/5.15.2/mingw81_64/lib/cmake")
+ file(GLOB QtDirs "C:/Qt/${QtVersion}.*.*/mingw*_64")
+ list(GET QtDirs 0 QtDir)
+ message(STATUS "Using Qt found at ${QtDir}")
+ set (CMAKE_PREFIX_PATH "${QtDir}")
if (rtaudio)
include_directories("C:/Program Files (x86)/RtAudio/include")
set (rtaudiolib "C:/Program Files (x86)/RtAudio/lib/librtaudio.dll.a")
endif ()
endif ()
+string(PREPEND QtVersion "Qt")
+
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
find_package(PkgConfig REQUIRED)
pkg_check_modules(JACK REQUIRED IMPORTED_TARGET jack)
@@ -81,14 +114,14 @@ set(CMAKE_AUTORCC ON)
# Find the QtWidgets library
if (NOT nogui)
- find_package(Qt5Widgets CONFIG REQUIRED)
+ find_package(${QtVersion}Widgets CONFIG REQUIRED)
if (NOT novs)
- find_package(Qt5Quick CONFIG REQUIRED)
- find_package(Qt5NetworkAuth CONFIG REQUIRED)
- find_package(Qt5WebSockets CONFIG REQUIRED)
+ find_package(${QtVersion}Quick CONFIG REQUIRED)
+ find_package(${QtVersion}NetworkAuth CONFIG REQUIRED)
+ find_package(${QtVersion}WebSockets CONFIG REQUIRED)
endif ()
endif ()
-find_package(Qt5Network CONFIG REQUIRED)
+find_package(${QtVersion}Network CONFIG REQUIRED)
set(qjacktrip_SRC
src/main.cpp
@@ -109,21 +142,24 @@ set(qjacktrip_SRC
src/Regulator.cpp
src/Compressor.cpp
src/Limiter.cpp
- src/Meter.cpp
src/Reverb.cpp
src/AudioTester.cpp
src/Patcher.cpp
src/SslServer.cpp
src/Auth.cpp
+ src/ProcessPlugin.cpp
)
if (rtaudio)
+ add_compile_definitions(RT_AUDIO)
set (qjacktrip_SRC ${qjacktrip_SRC}
src/RtAudioInterface.cpp
)
endif ()
if (weakjack)
+ add_compile_definitions(USE_WEAK_JACK)
+ include_directories("externals/weakjack")
set (qjacktrip_SRC ${qjacktrip_SRC}
externals/weakjack/weak_libjack.c
)
@@ -145,17 +181,38 @@ if (NOT nogui)
src/gui/vsPing.cpp
src/gui/vsPinger.cpp
src/gui/vsDevice.cpp
+ src/gui/vsAudioInterface.cpp
src/gui/vsUrlHandler.cpp
src/gui/vsWebSocket.cpp
src/gui/qjacktrip.qrc
+ src/Meter.cpp
+ src/Volume.cpp
+ src/Tone.cpp
# Need to include this for AUTOMOC to do its thing
src/JTApplication.h
+ src/gui/vsQmlClipboard.h
)
else ()
set (qjacktrip_SRC ${qjacktrip_SRC} src/gui/qjacktrip_novs.qrc)
endif ()
+
+ if (NOT noupdater)
+ set (qjacktrip_SRC ${qjacktrip_SRC}
+ src/dblsqd/feed.cpp
+ src/dblsqd/release.cpp
+ src/dblsqd/semver.cpp
+ src/dblsqd/update_dialog.cpp
+ )
+ endif ()
if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
+ file(READ "win/qjacktrip.rc" RC_CONTENTS)
+ if (psi)
+ string(REPLACE "jacktrip.ico" "jacktrip_alt.ico" RC_CONTENTS "${RC_CONTENTS}")
+ else ()
+ string(REPLACE "jacktrip_alt.ico" "jacktrip.ico" RC_CONTENTS "${RC_CONTENTS}")
+ endif ()
+ file(WRITE "win/qjacktrip.rc" "${RC_CONTENTS}")
set (qjacktrip_SRC ${qjacktrip_SRC} win/qjacktrip.rc)
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set (qjacktrip_SRC ${qjacktrip_SRC} src/gui/NoNap.mm)
@@ -170,11 +227,11 @@ add_compile_definitions(WAIRTOHUB)
add_executable(jacktrip ${qjacktrip_SRC})
# Set our libraries for our linker
-set (qjacktrip_LIBS Qt5::Network)
+set (qjacktrip_LIBS ${QtVersion}::Network)
if (NOT nogui)
- set (qjacktrip_LIBS ${qjacktrip_LIBS} Qt5::Widgets)
+ set (qjacktrip_LIBS ${qjacktrip_LIBS} ${QtVersion}::Widgets)
if (NOT novs)
- set (qjacktrip_LIBS ${qjacktrip_LIBS} Qt5::Quick Qt5::NetworkAuth Qt5::WebSockets)
+ set (qjacktrip_LIBS ${qjacktrip_LIBS} ${QtVersion}::Quick ${QtVersion}::NetworkAuth ${QtVersion}::WebSockets)
endif ()
endif ()
@@ -199,5 +256,16 @@ endif ()
target_link_libraries(jacktrip ${qjacktrip_LIBS})
+if (${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+ add_custom_command(
+ TARGET jacktrip POST_BUILD
+ COMMAND help2man --no-info --section=1 --output=jacktrip.1 ./jacktrip
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
+ )
+endif ()
+
# Install the executable
install(TARGETS jacktrip DESTINATION bin)
+if (${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+ install(FILES ${CMAKE_BINARY_DIR}/jacktrip.1 DESTINATION share/man/man1)
+endif ()
diff --git a/build b/build
index b4141be..cd05509 100755
--- a/build
+++ b/build
@@ -102,15 +102,9 @@ if [[ $platform == 'linux' ]]; then
echo "Using qmake"
QCMD=qmake
fi
-QSPEC=linux-g++
MCMD=make
elif [[ $platform == 'macosx' ]]; then
QCMD=qmake
- QSPEC=macx-clang
- arch=`arch`
- if [[ "$arch" == 'arm64' ]]; then
- QSPEC=macx-clang-arm64
- fi
# if qmake is not in path, try homebrew qt5
echo "path to qmake"
echo "$(which qmake)"
@@ -128,13 +122,16 @@ elif [[ $platform == 'macosx' ]]; then
MCMD=make
elif [[ $platform == 'mingw' ]]; then
QCMD=qmake
- QSPEC=win32-g++
MCMD=mingw32-make
elif [[ $platform == 'unknown' ]]; then
echo "Unregonized platform, exiting"
exit
fi
+# detect spec
+QSPEC=`$QCMD -query | grep QMAKE_SPEC`
+QSPEC=${QSPEC##QMAKE_SPEC:}
+
# check for RtAudio
if [[ $RTAUDIO == 1 ]]; then
pkg-config --exists rtaudio 2> /dev/null
@@ -167,13 +164,14 @@ cd builddir
set -e
# Build
+QCMDARGS=(-spec $QSPEC $CONFIG "$UNKNOWN_OPTIONS" $PRO_FILE)
echo "qmake command:"
-echo "$QCMD -spec $QSPEC $CONFIG $PRO_FILE" $UNKNOWN_OPTIONS
+echo $QCMD ${QCMDARGS[@]}
if [[ $clean == 1 ]]; then
- $QCMD -spec $QSPEC $CONFIG $PRO_FILE $UNKNOWN_OPTIONS
+ $QCMD ${QCMDARGS[@]}
$MCMD clean
fi
-$QCMD -spec $QSPEC $CONFIG $PRO_FILE $UNKNOWN_OPTIONS
+$QCMD ${QCMDARGS[@]}
$MCMD release
if [[ "$install" == 1 ]]; then
echo "*** Installing JackTrip ***"
diff --git a/debian/changelog b/debian/changelog
index 759c233..5d26b32 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+jacktrip (1.6.6+ds0-1) unstable; urgency=medium
+
+ * New upstream version 1.6.6+ds0
+ * Update d/copyright
+ + Regenerate d/copyright_hints
+
+ -- IOhannes m zmölnig (Debian/GNU) <umlaeute@debian.org> Thu, 10 Nov 2022 11:15:20 +0100
+
jacktrip (1.6.4+ds0-1) unstable; urgency=medium
* New upstream version 1.6.4+ds0
diff --git a/debian/copyright b/debian/copyright
index 65cf8cc..65ded1a 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -18,16 +18,21 @@ Copyright: 2020, Julius Smith
License: Expat
Files: src/*dsp.h
-Copyright: 2003-2017, GRAME, Centre National de Creation Musicale
+Copyright: 2003-2022, GRAME, Centre National de Creation Musicale
2020, Julius Smith
-License: Expat and GPL-3+ with FAUST exception
+License: Expat and GPL-2+ with FAUST exception
-Files: src/meterdsp.h
+Files: src/compressordsp.h
+ src/meterdsp.h
+ src/volumedsp.h
Copyright: 2003-2022, GRAME, Centre National de Creation Musicale
License: Expat and LGPL-2.1+ with FAUST exception
-Files: src/gui/*
- macos/assemble_app.sh
+Files: src/gui/NoNap.*
+ src/gui/about.*
+ src/gui/messageDialog.*
+ src/gui/qjacktrip.*
+ src/gui/textbuf.*
Copyright: 2020-2021, Aaron Wyatt.
License: GPL-3+
@@ -67,7 +72,7 @@ Comment:
On Debian systems, the complete text of the GNU General Public License
(GPL) version 3 can be found in "/usr/share/common-licenses/GPL-3".
-License: GPL-3+ with FAUST exception
+License: GPL-2+ with FAUST exception
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -82,7 +87,7 @@ License: GPL-3+ with FAUST exception
architecture section is not modified.
Comment:
On Debian systems, the complete text of the GNU General Public License
- (GPL) version 3 can be found in "/usr/share/common-licenses/GPL-3".
+ (GPL) version 2 can be found in "/usr/share/common-licenses/GPL-2".
License: LGPL-2.1+ with FAUST exception
This program is free software; you can redistribute it and/or modify
diff --git a/debian/copyright_hints b/debian/copyright_hints
index c82444a..48977c0 100644
--- a/debian/copyright_hints
+++ b/debian/copyright_hints
@@ -44,6 +44,9 @@ Files: documentation/documentation.cpp
src/UdpHubListener.h
src/gui/virtualstudio.cpp
src/gui/virtualstudio.h
+ src/gui/vsAudioInterface.cpp
+ src/gui/vsAudioInterface.h
+ src/gui/vsConstants.h
src/gui/vsDevice.cpp
src/gui/vsDevice.h
src/gui/vsPing.cpp
@@ -99,7 +102,9 @@ Files: README.md
foo/meson-private/sanitycheckcpp.cc
linux/add_changelog_to_metainfo.py
macos/JackTrip.app_template/Contents/PkgInfo
+ macos/assemble_app.sh
macos/package/postinstall.sh
+ macos/sign-stuff.sh
scripts/README.md
scripts/hubMode/art.sh
scripts/hubMode/startJacktripHubClient.sh
@@ -123,6 +128,7 @@ Files: README.md
src/gui/vsQmlClipboard.h
src/makeXcodeproj.sh
win/CodeSignTool/CodeSignTool.sh
+ win/getCsv.sh
Copyright: NONE
License: UNKNOWN
FIXME
@@ -137,6 +143,10 @@ Files: src/AudioTester.cpp
src/Meter.h
src/Reverb.cpp
src/Reverb.h
+ src/Tone.cpp
+ src/Tone.h
+ src/Volume.cpp
+ src/Volume.h
Copyright: 2020, Julius Smith, Juan-Pablo Caceres, Chris Chafe.
License: Expat
FIXME
@@ -154,12 +164,21 @@ Copyright: 2020, Aaron Wyatt.
License: GPL-3+
FIXME
-Files: src/freeverbmonodsp.h
+Files: src/freeverbdsp.h
+ src/freeverbmonodsp.h
src/limiterdsp.h
+ src/tonedsp.h
src/zitarevdsp.h
src/zitarevmonodsp.h
-Copyright: 2003-2017, GRAME, Centre National de Creation Musicale
-License: GPL-3+ with FAUST exception
+Copyright: 2003-2022, GRAME, Centre National de Creation Musicale
+License: (GPL-2+ and/or LGPL-2.1+) with FAUST exception
+ FIXME
+
+Files: src/compressordsp.h
+ src/meterdsp.h
+ src/volumedsp.h
+Copyright: 2003-2022, GRAME, Centre National de Creation Musicale
+License: (Expat and/or GPL-2+ and/or LGPL-2.1+) with FAUST exception
FIXME
Files: docs/Build/Linux.md
@@ -176,21 +195,6 @@ Copyright: 2007-2010, Juan-Pablo Caceres.
License: Expat
FIXME
-Files: src/compressordsp.h
-Copyright: 2003-2017, GRAME, Centre National de Creation Musicale
-License: (Expat and/or GPL-3+) with FAUST exception
- FIXME
-
-Files: src/meterdsp.h
-Copyright: 2003-2022, GRAME, Centre National de Creation Musicale
-License: (Expat and/or LGPL-2.1+) with FAUST exception
- FIXME
-
-Files: src/freeverbdsp.h
-Copyright: 2003-2017, GRAME, Centre National de Creation Musicale
-License: (GPL-3+ and/or LGPL) with FAUST exception
- FIXME
-
Files: src/Effects.h
Copyright: 2020, Julius Smith.
License: Expat
@@ -202,11 +206,6 @@ Copyright: 2020, Aaron Wyatt
License: Expat and/or LGPL
FIXME
-Files: macos/assemble_app.sh
-Copyright: 2020-2021, Aaron Wyatt et al."
-License: GPL-3
- FIXME
-
Files: src/gui/about.cpp
Copyright: 2020, Aaron Wyatt.
License: GPL-3+ and/or LGPL
diff --git a/docs/changelog.yml b/docs/changelog.yml
index b424738..ce32d2b 100644
--- a/docs/changelog.yml
+++ b/docs/changelog.yml
@@ -1,3 +1,27 @@
+- Version: "1.6.6"
+ Date: 2022-11-01
+ Description:
+ - (fixed) Notarization scripts for macOS
+ - Note - this version replaces 1.6.5, as that release was mistakenly deleted
+- Version: "1.6.5"
+ Date: 2022-10-28
+ Description:
+ - (added) Input/output volume control and input mute in VS
+ - (added) Volume plugin
+ - (added) Linux manifests used for download links
+ - (added) VS Test mode for jacktrip.org users
+ - (added) Qt6 support for NO_VS builds
+ - (added) Show Qt version in About dialog
+ - (updated) VS - makes inactive, admin'd studios visible by default
+ - (updated) using -q auto3 for buffer length with plc
+ - (updated) updated notarization process to use notarytool
+ - (updated) link to Qt source as it has changed
+ - (updated) Classic GUI reverts some pre-VS changes
+ - (updated) QMake build scripts more in line with documentation
+ - (fixed) new user screen in VS mode
+ - (fixed) logout freezing jacktrip
+ - (fixed) NO_VS builds work without setting NO_UPDATER
+ - (fixed) volume meter-related crash
- Version: "1.6.4"
Date: 2022-09-16
Description:
diff --git a/faust-src/tonedsp.dsp b/faust-src/tonedsp.dsp
new file mode 100644
index 0000000..0f7a902
--- /dev/null
+++ b/faust-src/tonedsp.dsp
@@ -0,0 +1,17 @@
+// Source: https://faustdoc.grame.fr/examples/smartKeyboard/#turenas
+
+import("stdfaust.lib");
+
+y = hslider("y",0,0,1,0.01);
+freq = hslider("freq",400,50,2000,0.01);
+gate = button("gate");
+res = hslider("res[acc: 0 0 -10 0 10]",2.5,0.01,5,0.01);
+nModes = 6;
+maxModeSpread = 5;
+modeSpread = y*maxModeSpread;
+modeFreqRatios = par(i,nModes,1+(i+1)/nModes*modeSpread);
+minModeGain = 0.3;
+modeGains = par(i,nModes,1-(i+1)/(nModes*minModeGain));
+modeRes = res : si.smoo;
+
+process = sy.additiveDrum(freq,modeFreqRatios,modeGains,0.8,0.001,modeRes,gate)*0.05;
diff --git a/faust-src/volumedsp.dsp b/faust-src/volumedsp.dsp
new file mode 100644
index 0000000..1a1a617
--- /dev/null
+++ b/faust-src/volumedsp.dsp
@@ -0,0 +1,14 @@
+declare name "volume";
+declare version "1.0";
+declare author "Matt Horton, adapted from GRAME";
+declare license "MIT Style STK-4.2";
+declare description "Volume Control Faust Plugin for JackTrip, based on Faust examples";
+
+
+import("stdfaust.lib");
+mute = checkbox("[1] Mute");
+gain(v) = v : ba.db2linear : si.smoo : _;
+gainVMute(v) = _ * gain(v), 0 : select2(mute) : _;
+zeroCutoff(v) = _ , 0 : select2(v == -40) : _;
+volume = hslider("[0] Volume", 0, -40, 0, 0.1);
+process = _ <: vgroup("Volume Control", _ : gainVMute(volume) : zeroCutoff(volume));
diff --git a/jacktrip.pro b/jacktrip.pro
index 80fc9c1..77cb80d 100644
--- a/jacktrip.pro
+++ b/jacktrip.pro
@@ -103,11 +103,7 @@ bundled_rtaudio {
macx {
message(Building on MAC OS X)
- QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.9
- #QMAKE_MAC_SDK = macosx10.9
CONFIG -= app_bundle
- #CONFIG += x86 #ppc #### If you have both libraries installed, you
- # can change between 32bits (x86) or 64bits(x86_64) Change this to go back to 32 bits (x86)
LIBS += -framework CoreAudio -framework CoreFoundation
!nogui {
LIBS += -framework Foundation
@@ -207,6 +203,8 @@ HEADERS += src/DataProtocol.h \
src/Regulator.h \
src/Reverb.h \
src/Meter.h \
+ src/Volume.h \
+ src/Tone.h \
src/AudioTester.h \
src/jacktrip_globals.h \
src/jacktrip_types.h \
@@ -225,6 +223,8 @@ HEADERS += src/DataProtocol.h \
src/limiterdsp.h \
src/freeverbdsp.h \
src/meterdsp.h \
+ src/volumedsp.h \
+ src/tonedsp.h \
src/SslServer.h \
src/Auth.h
#(Removed JackTripThread.h JackTripWorkerMessages.h NetKS.h TestRingBuffer.h ThreadPoolTest.h)
@@ -243,6 +243,7 @@ HEADERS += src/DataProtocol.h \
!novs {
HEADERS += src/gui/virtualstudio.h \
src/gui/vsDevice.h \
+ src/gui/vsAudioInterface.h \
src/gui/vsServerInfo.h \
src/gui/vsQuickView.h \
src/gui/vsWebSocket.h \
@@ -271,6 +272,8 @@ SOURCES += src/DataProtocol.cpp \
src/Regulator.cpp \
src/Reverb.cpp \
src/Meter.cpp \
+ src/Volume.cpp \
+ src/Tone.cpp \
src/AudioTester.cpp \
src/jacktrip_globals.cpp \
src/JackTripWorker.cpp \
@@ -301,6 +304,7 @@ SOURCES += src/DataProtocol.cpp \
!novs {
SOURCES += src/gui/virtualstudio.cpp \
src/gui/vsDevice.cpp \
+ src/gui/vsAudioInterface.cpp \
src/gui/vsServerInfo.cpp \
src/gui/vsQuickView.cpp \
src/gui/vsWebSocket.cpp \
diff --git a/linux/icons/jacktrip_48x48_alt.png b/linux/icons/jacktrip_48x48_alt.png
new file mode 100644
index 0000000..115f265
--- /dev/null
+++ b/linux/icons/jacktrip_48x48_alt.png
Binary files differ
diff --git a/linux/icons/jacktrip_alt.svg b/linux/icons/jacktrip_alt.svg
new file mode 100644
index 0000000..ed23ed8
--- /dev/null
+++ b/linux/icons/jacktrip_alt.svg
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ version="1.1"
+ id="svg2"
+ xml:space="preserve"
+ width="1365.3333"
+ height="1365.3333"
+ viewBox="0 0 1365.3333 1365.3333"><metadata
+ id="metadata8"><rdf:RDF><cc:Work
+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
+ id="defs6"><clipPath
+ clipPathUnits="userSpaceOnUse"
+ id="clipPath24"><path
+ d="M 0,1024 H 1024 V 0 H 0 Z"
+ id="path22" /></clipPath></defs><g
+ id="g10"
+ transform="matrix(1.3333333,0,0,-1.3333333,0,1365.3333)"><path
+ d="m 681.391,888.908 h -31.223 v 19.043 h 31.223 z"
+ style="fill:#d3d3d3;fill-opacity:1;fill-rule:nonzero;stroke:none"
+ id="path12" /><g
+ id="g14"
+ transform="translate(665,280)"><path
+ d="M 0,0 V 252.232"
+ style="fill:none;stroke:#000000;stroke-width:42;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
+ id="path16" /></g><g
+ id="g18"><g
+ id="g20"
+ clip-path="url(#clipPath24)"><g
+ id="g26"
+ transform="translate(312.3477,281.6523)"><path
+ d="M 0,0 C 0,-97.73 79.082,-176.812 176.812,-176.812"
+ style="fill:none;stroke:#000000;stroke-width:42;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
+ id="path28" /></g><g
+ id="g30"
+ transform="translate(487.96,105.0908)"><path
+ d="M 0,0 C 97.73,0 176.812,79.081 176.812,176.812"
+ style="fill:none;stroke:#000000;stroke-width:42;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
+ id="path32" /></g><g
+ id="g34"
+ transform="translate(626.5,747.5)"><path
+ d="m 0,0 v -104.385 -81.524 c 0,-14.58 12.403,-26.4 27.703,-26.4 h 23.594 c 15.3,0 27.703,11.82 27.703,26.4 V 0 Z"
+ style="fill:#5f709b;fill-opacity:1;fill-rule:nonzero;stroke:none"
+ id="path36" /></g><g
+ id="g38"
+ transform="translate(626.5,747.5)"><path
+ d="m 0,0 v -104.385 -81.524 c 0,-14.58 12.403,-26.4 27.703,-26.4 h 23.594 c 15.3,0 27.703,11.82 27.703,26.4 V 0 Z"
+ style="fill:none;stroke:#000000;stroke-width:16;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
+ id="path40" /></g><path
+ d="m 686,752 h -40 v 76 h 40 z"
+ style="fill:#d3d3d3;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:10;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
+ id="path42" /><path
+ d="m 686,834 h -40 v 24 h 40 z"
+ style="fill:#d3d3d3;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:10;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
+ id="path44" /><path
+ d="m 686,864 h -40 v 24 h 40 z"
+ style="fill:#d3d3d3;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:10;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
+ id="path46" /><g
+ id="g48"
+ transform="translate(652.6396,908.0542)"><path
+ d="M 0,0 -6.786,-16.832"
+ style="fill:#d3d3d3;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:10;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
+ id="path50" /></g><g
+ id="g52"
+ transform="translate(686.5176,891.2578)"><path
+ d="M 0,0 -6.786,16.832"
+ style="fill:#d3d3d3;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:10;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
+ id="path54" /></g><g
+ id="g56"
+ transform="translate(655.8232,902.8623)"><path
+ d="m 0,0 c -6.428,3.598 -10.772,10.473 -10.772,18.363 0,11.615 9.416,21.03 21.031,21.03 11.614,0 21.03,-9.415 21.03,-21.03 0,-8.028 -4.497,-15.004 -11.109,-18.549"
+ style="fill:#d3d3d3;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:10;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
+ id="path58" /></g><g
+ id="g60"
+ transform="translate(260.0122,300.8564)"><path
+ d="M 0,0 H 104.874"
+ style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:25;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
+ id="path62" /></g><g
+ id="g64"
+ transform="translate(303.1138,271.2197)"><path
+ d="M 0,0 C 0,15.936 -18.204,28.829 -40.7,28.829"
+ style="fill:none;stroke:#000000;stroke-width:22;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
+ id="path66" /></g><g
+ id="g68"
+ transform="translate(322.312,272.6973)"><path
+ d="M 0,0 C 0,14.682 16.772,26.562 37.5,26.562"
+ style="fill:none;stroke:#000000;stroke-width:22;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
+ id="path70" /></g><path
+ d="m 315.307,279.838 h -6.542 v 13.629 h 6.542 z"
+ style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:25;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
+ id="path72" /></g></g></g></svg>
diff --git a/macos/assemble_app.sh b/macos/assemble_app.sh
index bf93244..dc0928c 100755
--- a/macos/assemble_app.sh
+++ b/macos/assemble_app.sh
@@ -8,14 +8,18 @@ NOTARIZE=false
#If you're lazy like I am, you can pre-populate these variables to save you stuffing about with command line options.
#CERTIFICATE=""
#PACKAGE_CERT=""
-#USERNAME=""
-#PASSWORD=""
-#ASC_PROVIDER=""
+USERNAME=""
+PASSWORD=""
+TEAM_ID=""
+KEY_STORE="AC_PASSWORD"
+TEMP_KEYCHAIN=""
+USE_DEFAULT_KEYCHAIN=false
BINARY="../builddir/jacktrip"
+PSI=false
OPTIND=1
-while getopts ":inhc:d:u:p:a:b:" opt; do
+while getopts ":inhqklc:d:u:p:t:b:" opt; do
case $opt in
i)
BUILD_INSTALLER=true
@@ -23,6 +27,12 @@ while getopts ":inhc:d:u:p:a:b:" opt; do
n)
NOTARIZE=true
;;
+ k)
+ TEMP_KEYCHAIN="$(pwd)/notarytool_temp.db"
+ ;;
+ l)
+ USE_DEFAULT_KEYCHAIN=true
+ ;;
c)
CERTIFICATE=$OPTARG
;;
@@ -35,12 +45,15 @@ while getopts ":inhc:d:u:p:a:b:" opt; do
p)
PASSWORD=$OPTARG
;;
- a)
- ASC_PROVIDER=$OPTARG
+ t)
+ TEAM_ID=$OPTARG
;;
b)
BINARY=$OPTARG
;;
+ q)
+ PSI=true
+ ;;
\?)
echo "Invalid option -$OPTARG ignored."
;;
@@ -57,13 +70,22 @@ while getopts ":inhc:d:u:p:a:b:" opt; do
echo " -n Send a notarization request to Apple. (Only takes effect if building an installer.)"
echo " -c <certname> Name of the developer certificate to use for code signing. (No signing by default.)"
echo " -d <certname> Name of the certificate to use for package signing. (No signing by default.)"
+ echo
+ echo "Important: If supplying one of the next three options, you must supply all of them."
echo " -u <username> Apple ID username (email address) for installer notarization."
echo " -p <password> App specific password for installer notarization."
- echo " -a <ascprovider> ASC provider for notarization. (Only required if you belong to multiple dev teams.)"
+ echo " -t <teamid> Team ID for notarization."
+ echo
+ echo " -k Use a temporary keychain to store notarization credentials. (Overrides -l.)"
+ echo " -l Use the default keychain instead of the login keychain to store credentials."
echo " -h Display this help screen and exit."
echo
echo "By default, appname is set to JackTrip and bundlename is org.jacktrip.jacktrip."
echo "(These should be left as is for official builds.)"
+ echo
+ echo "The username, password, and team ID are saved in the login keychain by notarytool."
+ echo "They only need to be supplied once, or in the event that you need to change them."
+ echo "(They need to be supplied every time if you opt to use a temporary keychain.)"
exit 0
;;
@@ -97,6 +119,8 @@ cp -f $BINARY "$APPNAME.app/Contents/MacOS/"
cp -f ../LICENSE.md "$APPNAME.app/Contents/Resources/"
cp -Rf ../LICENSES "$APPNAME.app/Contents/Resources/"
+[ $PSI = true ] && cp jacktrip_alt.icns "$APPNAME.app/Contents/Resources/jacktrip.icns"
+
DYNAMIC_QT=$(otool -L $BINARY | grep QtCore)
DYNAMIC_VS=$(otool -L $BINARY | grep QtQml)
@@ -109,15 +133,17 @@ sed -i '' "s/%BUNDLENAME%/$APPNAME/" "$APPNAME.app/Contents/Info.plist"
sed -i '' "s/%BUNDLEID%/$BUNDLE_ID/" "$APPNAME.app/Contents/Info.plist"
if [ ! -z "$DYNAMIC_QT" ]; then
+ QT_VERSION="qt$(echo "$DYNAMIC_QT" | sed -E '1!d;s/.*compatibility version ([0-9]+)\.[0-9]+\.[0-9]+.*/\1/g')"
+ echo "Detected a Qt$QT_VERSION binary"
DEPLOY_CMD="$(which macdeployqt)"
if [ -z "$DEPLOY_CMD" ]; then
# Attempt to find macdeployqt. Try macports location first, then brew.
- if [ -x "/opt/local/libexec/qt5/bin/macdeployqt" ]; then
- DEPLOY_CMD="/opt/local/libexec/qt5/bin/macdeployqt"
- elif [ ! -z $(which brew) ] && [ ! -z $(brew --prefix qt5) ]; then
- DEPLOY_CMD="$(brew --prefix qt5)/bin/macdeployqt"
+ if [ -x "/opt/local/libexec/$QT_VERSION/bin/macdeployqt" ]; then
+ DEPLOY_CMD="/opt/local/libexec/$QT_VERSION/bin/macdeployqt"
+ elif [ ! -z $(which brew) ] && [ ! -z $(brew --prefix $QT_VERSION) ]; then
+ DEPLOY_CMD="$(brew --prefix $QT_VERSION)/bin/macdeployqt"
else
- echo "The Qt bin folder needs to be in your PATH for this script to work."
+ echo "Error: The Qt bin folder needs to be in your PATH for this script to work."
exit 1
fi
fi
@@ -135,7 +161,12 @@ fi
[ $BUILD_INSTALLER = true ] || exit 0
# If you have Packages installed, you can build an installer for the newly created app bundle.
-[ -z $(which packagesbuild) ] && { echo "You need to have Packages installed to build a package."; exit 1; }
+[ -z $(which packagesbuild) ] && { echo "Error: You need to have Packages installed to build a package."; exit 1; }
+
+if [ $PSI = true ]; then
+ cp "package/postinstall.sh" "package/postinstall.sh.bak"
+ sed -i '' "s/^open/#open/" "package/postinstall.sh"
+fi
# Needed for notarization.
[ ! -z "$CERTIFICATE" ] && codesign -f -s "$CERTIFICATE" --entitlements entitlements.plist --options "runtime" "$APPNAME.app"
@@ -165,6 +196,7 @@ sed -i '' "s/%BUNDLENAME%/$APPNAME/" package/JackTrip.pkgproj
sed -i '' "s/%BUNDLEID%/$BUNDLE_ID/" package/JackTrip.pkgproj
packagesbuild package/JackTrip.pkgproj
+[ $PSI = true ] && mv "package/postinstall.sh.bak" "package/postinstall.sh"
if pkgutil --check-signature package/build/JackTrip.pkg; then
echo "Package already signed."
SIGNED=true
@@ -185,41 +217,47 @@ fi
[ $NOTARIZE = true ] || exit 0
-# Submit a notarization request to apple if we have the required credentials.
-if [ -z "$CERTIFICATE" ] || [ -z "$USERNAME" ] || [ -z "$PASSWORD" ] || [ $SIGNED = false ] ; then
- echo "Not sending notarization request: incomplete credentials."
+# Submit a notarization request to apple if we've chosen to and signed our package.
+if [ $SIGNED = false ]; then
+ echo "Not sending notarization request: package not signed."
exit 1
fi
-ASC=""
-if [ ! -z "$ASC_PROVIDER" ]; then
- ASC=" --asc-provider $ASC_PROVIDER"
+if [ ! -z "$USERNAME" ] || [ ! -z "$PASSWORD" ] || [ ! -z "$TEAM_ID" ] || [ ! -z "$TEMP_KEYCHAIN" ]; then
+ if [ -z "$USERNAME" ] || [ -z "$PASSWORD" ] || [ -z "$TEAM_ID" ]; then
+ echo "Error: Missing credentials. Make sure you supply a username, password and team ID."
+ exit 1
+ fi
+fi
+
+KEYCHAIN=""
+if [ ! -z "$TEMP_KEYCHAIN" ]; then
+ echo "Using a temporary keychain"
+ [ -e "$TEMP_KEYCHAIN" ] && rm "$TEMP_KEYCHAIN"
+ security create-keychain -p "supersecretpassword" "$TEMP_KEYCHAIN"
+ security set-keychain-settings -lut 3600 "$TEMP_KEYCHAIN"
+ security unlock-keychain -p "supersecretpassword" "$TEMP_KEYCHAIN"
+ KEYCHAIN=" --keychain \"$TEMP_KEYCHAIN\""
+elif [ $USE_DEFAULT_KEYCHAIN = true ]; then
+ echo "Using the default keychain"
+ DEFAULT_KEYCHAIN=$(security default-keychain | cut -d '"' -f2)
+ KEYCHAIN=" --keychain \"$DEFAULT_KEYCHAIN\""
fi
-CREDENTIALS="--username $USERNAME --password $PASSWORD$ASC"
-echo "Sending notarization request"
-UUID=$(xcrun altool --notarize-app --primary-bundle-id "$BUNDLE_ID" $CREDENTIALS --file "package/build/$APPNAME.pkg" | awk '/RequestUUID/{print $NF}')
-if [ -z "$UUID" ]; then
- echo "Error sending notarization request"
- exit 1
+if [ ! -z "$USERNAME" ]; then
+ # We have new credentials. Store them in the keychain so we can use them.
+ ARGS="notarytool store-credentials \"$KEY_STORE\" --apple-id \"$USERNAME\" --password \"$PASSWORD\" --team-id \"$TEAM_ID\"$KEYCHAIN"
+ echo $ARGS | xargs xcrun
fi
-echo "Package uploaded"
-echo "Request UUID is $UUID"
-echo "Awaiting response from Apple"
-STATUS="in progress"
-ELAPSED=0
-while [ "$STATUS" = "in progress" ]; do
- sleep 60
- ((ELAPSED++))
- STATUS=$(xcrun altool --notarization-info "$UUID" $CREDENTIALS | awk '/Status:/{for(i = 2; i <= NF - 1; i++) printf $i" "; print $NF}')
- echo "Waited $ELAPSED minute(s). Current status: $STATUS"
-done
-#read -n1 -rsp "Press any key to staple the notarization once it's been approved..."
-#echo
-if [ "$STATUS" = "success" ]; then
+echo "Sending notarization request"
+ARGS="notarytool submit \"package/build/$APPNAME.pkg\" --keychain-profile \"$KEY_STORE\" --wait$KEYCHAIN"
+echo $ARGS | xargs xcrun
+if [ $? -eq 0 ]; then
+ [ ! -z "$TEMP_KEYCHAIN" ] && security delete-keychain "$TEMP_KEYCHAIN"
xcrun stapler staple "package/build/$APPNAME.pkg"
else
- echo "Notarization failed"
+ [ ! -z "$TEMP_KEYCHAIN" ] && security delete-keychain "$TEMP_KEYCHAIN"
+ echo "Error: Notarization failed"
exit 1
fi
diff --git a/macos/jacktrip_alt.icns b/macos/jacktrip_alt.icns
new file mode 100644
index 0000000..4f205c1
--- /dev/null
+++ b/macos/jacktrip_alt.icns
Binary files differ
diff --git a/macos/jacktrip_alt.iconset/icon_128x128.png b/macos/jacktrip_alt.iconset/icon_128x128.png
new file mode 100644
index 0000000..99d8c77
--- /dev/null
+++ b/macos/jacktrip_alt.iconset/icon_128x128.png
Binary files differ
diff --git a/macos/jacktrip_alt.iconset/icon_128x128@2x.png b/macos/jacktrip_alt.iconset/icon_128x128@2x.png
new file mode 100644
index 0000000..0b2f82c
--- /dev/null
+++ b/macos/jacktrip_alt.iconset/icon_128x128@2x.png
Binary files differ
diff --git a/macos/jacktrip_alt.iconset/icon_16x16.png b/macos/jacktrip_alt.iconset/icon_16x16.png
new file mode 100644
index 0000000..76b0f2f
--- /dev/null
+++ b/macos/jacktrip_alt.iconset/icon_16x16.png
Binary files differ
diff --git a/macos/jacktrip_alt.iconset/icon_16x16@2x.png b/macos/jacktrip_alt.iconset/icon_16x16@2x.png
new file mode 100644
index 0000000..d6a2d90
--- /dev/null
+++ b/macos/jacktrip_alt.iconset/icon_16x16@2x.png
Binary files differ
diff --git a/macos/jacktrip_alt.iconset/icon_256x256.png b/macos/jacktrip_alt.iconset/icon_256x256.png
new file mode 100644
index 0000000..0b2f82c
--- /dev/null
+++ b/macos/jacktrip_alt.iconset/icon_256x256.png
Binary files differ
diff --git a/macos/jacktrip_alt.iconset/icon_256x256@2x.png b/macos/jacktrip_alt.iconset/icon_256x256@2x.png
new file mode 100644
index 0000000..5befa4a
--- /dev/null
+++ b/macos/jacktrip_alt.iconset/icon_256x256@2x.png
Binary files differ
diff --git a/macos/jacktrip_alt.iconset/icon_32x32.png b/macos/jacktrip_alt.iconset/icon_32x32.png
new file mode 100644
index 0000000..d6a2d90
--- /dev/null
+++ b/macos/jacktrip_alt.iconset/icon_32x32.png
Binary files differ
diff --git a/macos/jacktrip_alt.iconset/icon_32x32@2x.png b/macos/jacktrip_alt.iconset/icon_32x32@2x.png
new file mode 100644
index 0000000..233148c
--- /dev/null
+++ b/macos/jacktrip_alt.iconset/icon_32x32@2x.png
Binary files differ
diff --git a/macos/jacktrip_alt.iconset/icon_512x512.png b/macos/jacktrip_alt.iconset/icon_512x512.png
new file mode 100644
index 0000000..5befa4a
--- /dev/null
+++ b/macos/jacktrip_alt.iconset/icon_512x512.png
Binary files differ
diff --git a/macos/jacktrip_alt.iconset/icon_512x512@2x.png b/macos/jacktrip_alt.iconset/icon_512x512@2x.png
new file mode 100644
index 0000000..cf7614e
--- /dev/null
+++ b/macos/jacktrip_alt.iconset/icon_512x512@2x.png
Binary files differ
diff --git a/macos/sign-stuff.sh b/macos/sign-stuff.sh
new file mode 100755
index 0000000..ed020aa
--- /dev/null
+++ b/macos/sign-stuff.sh
@@ -0,0 +1,62 @@
+#!/bin/sh
+
+# Set these for signing
+CERTIFICATE=""
+PACKAGE_CERT=""
+USERNAME=""
+PASSWORD=""
+TEAM_ID=""
+
+if [ -z $1 ]; then
+ echo "You need to provide a version number as an argument"
+ exit 1
+fi
+VERSION="v$1"
+
+if [ ! -z $2 ]; then
+ SCRIPT_BRANCH="$2"
+fi
+
+CHECK=$(echo "$1" | sed "s/-/./g")
+MAJOR=$(echo $CHECK | cut -d. -f1)
+MINOR=$(echo $CHECK | cut -d. -f2)
+REVISION=$(echo $CHECK | cut -d. -f3)
+
+if [ $MAJOR -le 1 ] && [ $MINOR -le 6 ] && [ $REVISION -lt 5 ] && [ -z "$SCRIPT_BRANCH" ]; then
+ echo "\033[1mVersion earlier than 1.6.5 detected\033[0m"
+ echo "\033[1mUsing assemble_app.sh script from dev branch\033[1m"
+ echo
+ SCRIPT_BRANCH="dev"
+fi
+
+if [ -d "$VERSION" ]; then
+ rm -rf $VERSION
+fi
+echo "\033[1mDownloading $VERSION from Github\033[0m"
+git clone --branch $VERSION https://github.com/jacktrip/jacktrip.git $VERSION || { echo "\n\033[1mCould not find tagged release for $VERSION\033[0m"; exit 1; }
+if [ ! -z "$SCRIPT_BRANCH" ]; then
+ if ! curl "https://raw.githubusercontent.com/jacktrip/jacktrip/$SCRIPT_BRANCH/macos/assemble_app.sh" -f -o "$VERSION/macos/assemble_app.sh"; then
+ echo "\033[1mUnable to download assemble_app.sh from $SCRIPT_BRANCH\033[0m"
+ echo "(Does this branch exist?)"
+ exit 1
+ fi
+fi
+echo "\n\033[1mDownloading compiled binary\033[0m"
+if ! curl "https://github.com/jacktrip/jacktrip/releases/download/$VERSION/JackTrip-$VERSION-macOS-x64-application.zip" -f -L -o binary.zip; then
+ echo "\033[1mUnable to download binary\033[0m"
+ exit 1
+fi
+echo "\n\033[1mExtracting binary\033[0m"
+mkdir -p "$VERSION/builddir"
+unzip -j binary.zip "JackTrip.app/Contents/MacOS/jacktrip" -d "$VERSION/builddir"
+rm binary.zip
+echo "\n\033[1mBuilding installer\033[0m"
+cd "$VERSION/macos"
+if ./assemble_app.sh -in -c "$CERTIFICATE" -d "$PACKAGE_CERT" -u "$USERNAME" -p "$PASSWORD" -t "$TEAM_ID"; then
+ echo "\n\033[1mCopying signed package to current directory and performing clean up\033[0m"
+ cp "package/build/JackTrip.pkg" ../../
+else
+ echo "\n\033[1mBuilding installer failed. Performing clean up.\033[0m"
+fi
+cd "../.."
+rm -rf $VERSION
diff --git a/meson.build b/meson.build
index 8bb8b9f..6383039 100644
--- a/meson.build
+++ b/meson.build
@@ -36,6 +36,8 @@ src = [ 'src/DataProtocol.cpp',
'src/Compressor.cpp',
'src/Limiter.cpp',
'src/Meter.cpp',
+ 'src/Volume.cpp',
+ 'src/Tone.cpp',
'src/Reverb.cpp',
'src/main.cpp',
'src/SslServer.cpp',
@@ -45,6 +47,8 @@ moc_h = ['src/DataProtocol.h',
'src/JackTrip.h',
'src/ProcessPlugin.h',
'src/Meter.h',
+ 'src/Volume.h',
+ 'src/Tone.h',
'src/JackTripWorker.h',
'src/PacketHeader.h',
'src/Settings.h',
@@ -110,6 +114,7 @@ else
src += [
'src/gui/virtualstudio.cpp',
'src/gui/vsDevice.cpp',
+ 'src/gui/vsAudioInterface.cpp',
'src/gui/vsServerInfo.cpp',
'src/gui/vsQuickView.cpp',
'src/gui/vsWebSocket.cpp',
@@ -120,6 +125,7 @@ else
moc_h += [
'src/gui/virtualstudio.h',
'src/gui/vsDevice.h',
+ 'src/gui/vsAudioInterface.h',
'src/gui/vsServerInfo.h',
'src/gui/vsQuickView.h',
'src/gui/vsWebSocket.h',
diff --git a/releases/edge/mac-manifests.json b/releases/edge/mac-manifests.json
index 2622246..c38c9a5 100644
--- a/releases/edge/mac-manifests.json
+++ b/releases/edge/mac-manifests.json
@@ -2,6 +2,26 @@
"app_name": "JackTrip",
"releases": [
{
+ "version": "1.6.5-rc.1",
+ "changelog": "Adding volume controls, mute, early Qt6 support, and bug fixes: https://github.com/jacktrip/jacktrip/releases/tag/v1.6.5-rc1",
+ "download": {
+ "date": "2022-10-21T00:00:00Z",
+ "url": "https://github.com/jacktrip/jacktrip/releases/download/v1.6.5-rc1/JackTrip-v1.6.5-rc1-macOS-x64-installer.pkg",
+ "downloadSize": 11481049,
+ "sha256": "cea18dd189d84eb9ca3be115819c597900e7bba7771185b61308518aa0e3d716"
+ }
+ },
+ {
+ "version": "1.6.4",
+ "changelog": "Adding volume meters, bugfixes around Windows hanging, device disconnects, and PLC: https://github.com/jacktrip/jacktrip/releases/tag/v1.6.4",
+ "download": {
+ "date": "2022-09-16T00:00:00Z",
+ "url": "https://files.jacktrip.org/app-builds/JackTrip-v1.6.4-macOS-x64-installer.pkg",
+ "downloadSize": 11554866,
+ "sha256": "e5898f3ff57fc2d734590decb4f82a28ad9208a33cad97152f119716cdcea1a9"
+ }
+ },
+ {
"version": "1.6.4-rc.2",
"changelog": "Adding volume meters, bugfixes around Windows hanging, device disconnects, and PLC: https://github.com/jacktrip/jacktrip/releases/tag/v1.6.4-rc2",
"download": {
@@ -26,7 +46,7 @@
"changelog": "Fixes around Linux desktop file and hub server mode: https://github.com/jacktrip/jacktrip/releases/tag/v1.6.3",
"download": {
"date": "2022-08-23T00:00:00Z",
- "url": "https://github.com/jacktrip/jacktrip/releases/download/v1.6.3/JackTrip-v1.6.3-macOS-x64-installer.pkg",
+ "url": "https://files.jacktrip.org/app-builds/JackTrip-v1.6.3-macOS-x64-installer.pkg",
"downloadSize": 11533023,
"sha256": "0b597c62544e9813949f859cc7b7c13bef893f6896f96b34a19889faf4855116"
}
@@ -36,7 +56,7 @@
"changelog": "Ability to open app via URL schemes, displaying latency stats, and Virtual Studio device support. Learn more here: https://github.com/jacktrip/jacktrip/releases/tag/v1.6.2",
"download": {
"date": "2022-08-17T00:00:00Z",
- "url": "https://github.com/jacktrip/jacktrip/releases/download/v1.6.2/JackTrip-v1.6.2-macOS-x64-installer.pkg",
+ "url": "https://files.jacktrip.org/app-builds/JackTrip-v1.6.2-macOS-x64-installer.pkg",
"downloadSize": 11536442,
"sha256": "450222f4db1922275e07286d0be6ea2df2873a8a39c3b23096bcfbce342b7b3c"
}
@@ -76,7 +96,7 @@
"changelog": "Bugfixes around UDP timeout and 'Logging In' screen navigation. Learn more here: https://github.com/jacktrip/jacktrip/releases/tag/v1.6.1",
"download": {
"date": "2022-06-21T00:00:00Z",
- "url": "https://github.com/jacktrip/jacktrip/releases/download/v1.6.1/JackTrip-v1.6.1-macOS-x64-installer.pkg",
+ "url": "https://files.jacktrip.org/app-builds/JackTrip-v1.6.1-macOS-x64-installer.pkg",
"downloadSize": 11476305,
"sha256": "eaf05c842d6b3ae799208a40b37da1cdb13e3700dcbbd97443c80cad81f4d2ac"
}
@@ -86,7 +106,7 @@
"changelog": "Full integration with JackTrip Virtual Studio. Learn more here: https://github.com/jacktrip/jacktrip/releases/tag/v1.6.0",
"download": {
"date": "2022-06-01T00:00:00Z",
- "url": "https://github.com/jacktrip/jacktrip/releases/download/v1.6.0/JackTrip-v1.6.0-macOS-x64-installer.pkg",
+ "url": "https://files.jacktrip.org/app-builds/JackTrip-v1.6.0-macOS-x64-installer.pkg",
"downloadSize": 11474299,
"sha256": "27259600ecd879106ebbf97754d72d6236075a049eafa0de6271d33f753f13e4"
}
diff --git a/releases/edge/win-manifests.json b/releases/edge/win-manifests.json
index 2331018..9b2f0b0 100644
--- a/releases/edge/win-manifests.json
+++ b/releases/edge/win-manifests.json
@@ -2,6 +2,26 @@
"app_name": "JackTrip",
"releases": [
{
+ "version": "1.6.5-rc.1",
+ "changelog": "Adding volume controls, mute, early Qt6 support, and bug fixes: https://github.com/jacktrip/jacktrip/releases/tag/v1.6.5-rc1",
+ "download": {
+ "date": "2022-10-21T00:00:00Z",
+ "url": "https://github.com/jacktrip/jacktrip/releases/download/v1.6.5-rc1/JackTrip-v1.6.5-rc1-Windows-x64-installer.msi",
+ "downloadSize": 44408832,
+ "sha256": "99404fa7bf1a07df76a1b1048c7a0e64a0d5f552e2ca5dfb12e7cbaac0c6fb24"
+ }
+ },
+ {
+ "version": "1.6.4",
+ "changelog": "Adding volume meters, bugfixes around Windows hanging, device disconnects, and PLC: https://github.com/jacktrip/jacktrip/releases/tag/v1.6.4",
+ "download": {
+ "date": "2022-09-16T00:00:00Z",
+ "url": "https://files.jacktrip.org/app-builds/JackTrip-v1.6.4-Windows-x64-installer.msi",
+ "downloadSize": 43663360,
+ "sha256": "58dcbba584e1cc82373b8aa159800ad360eec7933ce9462e413ca347f09f3c26"
+ }
+ },
+ {
"version": "1.6.4-rc.2",
"changelog": "Adding volume meters, bugfixes around Windows hanging, device disconnects, and PLC: https://github.com/jacktrip/jacktrip/releases/tag/v1.6.4-rc2",
"download": {
@@ -26,7 +46,7 @@
"changelog": "Fixes around Linux desktop file and hub server mode: https://github.com/jacktrip/jacktrip/releases/tag/v1.6.3",
"download": {
"date": "2022-08-23T00:00:00Z",
- "url": "https://github.com/jacktrip/jacktrip/releases/download/v1.6.3/JackTrip-v1.6.3-Windows-x64-installer.msi",
+ "url": "https://files.jacktrip.org/app-builds/JackTrip-v1.6.3-Windows-x64-installer.msi",
"downloadSize": 43606016,
"sha256": "83a4def2a8c8fde24d147d39e70f60ee144e9425828f34eda2340c23ce72b1da"
}
@@ -36,7 +56,7 @@
"changelog": "Ability to open app via URL schemes, displaying latency stats, and Virtual Studio device support. Learn more here: https://github.com/jacktrip/jacktrip/releases/tag/v1.6.2",
"download": {
"date": "2022-08-17T00:00:00Z",
- "url": "https://github.com/jacktrip/jacktrip/releases/download/v1.6.2/JackTrip-v1.6.2-Windows-x64-installer.msi",
+ "url": "https://files.jacktrip.org/app-builds/JackTrip-v1.6.2-Windows-x64-installer.msi",
"downloadSize": 43606016,
"sha256": "2bb06fe3624df447d56da0d72fef1f4328346fd92c6dffccf66ba37253ec5e62"
}
@@ -76,7 +96,7 @@
"changelog": "Bugfixes around UDP timeout and 'Logging In' screen navigation. Learn more here: https://github.com/jacktrip/jacktrip/releases/tag/v1.6.1",
"download": {
"date": "2022-06-21T00:00:00Z",
- "url": "https://github.com/jacktrip/jacktrip/releases/download/v1.6.1/JackTrip-v1.6.1-Windows-x64-installer.msi",
+ "url": "https://files.jacktrip.org/app-builds/JackTrip-v1.6.1-Windows-x64-installer.msi",
"downloadSize": 43368448,
"sha256": "8eac390617488d849c0356e3305c96a59bbe46a8174d02b0321bb1dc86774b87"
}
@@ -86,7 +106,7 @@
"changelog": "Full integration with JackTrip Virtual Studio. Learn more here: https://github.com/jacktrip/jacktrip/releases/tag/v1.6.0",
"download": {
"date": "2022-06-01T00:00:00Z",
- "url": "https://github.com/jacktrip/jacktrip/releases/download/v1.6.0/JackTrip-v1.6.0-Windows-x64-installer.msi",
+ "url": "https://files.jacktrip.org/app-builds/JackTrip-v1.6.0-Windows-x64-installer.msi",
"downloadSize": 43364352,
"sha256": "9562ab654202bfc432e05caa3bd2bf1d0b52c50581b0a567f0546983fe46c078"
}
diff --git a/releases/stable/linux-manifests.json b/releases/stable/linux-manifests.json
new file mode 100644
index 0000000..9cb7d67
--- /dev/null
+++ b/releases/stable/linux-manifests.json
@@ -0,0 +1,15 @@
+{
+ "app_name": "JackTrip",
+ "releases": [
+ {
+ "version": "1.6.4",
+ "changelog": "Adding volume meters, bugfixes around Windows hanging, device disconnects, and PLC: https://github.com/jacktrip/jacktrip/releases/tag/v1.6.4",
+ "download": {
+ "date": "2022-09-16T00:00:00Z",
+ "url": "https://files.jacktrip.org/app-builds/JackTrip-v1.6.4-Linux-x64-binary.zip",
+ "downloadSize": 22233485,
+ "sha256": "f1b9585e4eb72c07c735ee6f4dc94ad1d1a4c70474799eb1111bb5a39a99e295"
+ }
+ }
+ ]
+}
diff --git a/releases/stable/mac-manifests.json b/releases/stable/mac-manifests.json
index 49cf17d..febfe6a 100644
--- a/releases/stable/mac-manifests.json
+++ b/releases/stable/mac-manifests.json
@@ -2,11 +2,21 @@
"app_name": "JackTrip",
"releases": [
{
+ "version": "1.6.4",
+ "changelog": "Adding volume meters, bugfixes around Windows hanging, device disconnects, and PLC: https://github.com/jacktrip/jacktrip/releases/tag/v1.6.4",
+ "download": {
+ "date": "2022-09-16T00:00:00Z",
+ "url": "https://files.jacktrip.org/app-builds/JackTrip-v1.6.4-macOS-x64-installer.pkg",
+ "downloadSize": 11554866,
+ "sha256": "e5898f3ff57fc2d734590decb4f82a28ad9208a33cad97152f119716cdcea1a9"
+ }
+ },
+ {
"version": "1.6.3",
"changelog": "Fixes around Linux desktop file and hub server mode: https://github.com/jacktrip/jacktrip/releases/tag/v1.6.3",
"download": {
"date": "2022-08-23T00:00:00Z",
- "url": "https://github.com/jacktrip/jacktrip/releases/download/v1.6.3/JackTrip-v1.6.3-macOS-x64-installer.pkg",
+ "url": "https://files.jacktrip.org/app-builds/JackTrip-v1.6.3-macOS-x64-installer.pkg",
"downloadSize": 11533023,
"sha256": "0b597c62544e9813949f859cc7b7c13bef893f6896f96b34a19889faf4855116"
}
@@ -16,7 +26,7 @@
"changelog": "Ability to open app via URL schemes, displaying latency stats, and Virtual Studio device support. Learn more here: https://github.com/jacktrip/jacktrip/releases/tag/v1.6.2",
"download": {
"date": "2022-08-17T00:00:00Z",
- "url": "https://github.com/jacktrip/jacktrip/releases/download/v1.6.2/JackTrip-v1.6.2-macOS-x64-installer.pkg",
+ "url": "https://files.jacktrip.org/app-builds/JackTrip-v1.6.2-macOS-x64-installer.pkg",
"downloadSize": 11536442,
"sha256": "450222f4db1922275e07286d0be6ea2df2873a8a39c3b23096bcfbce342b7b3c"
}
@@ -26,7 +36,7 @@
"changelog": "Bugfixes around UDP timeout and 'Logging In' screen navigation. Learn more here: https://github.com/jacktrip/jacktrip/releases/tag/v1.6.1",
"download": {
"date": "2022-06-21T00:00:00Z",
- "url": "https://github.com/jacktrip/jacktrip/releases/download/v1.6.1/JackTrip-v1.6.1-macOS-x64-installer.pkg",
+ "url": "https://files.jacktrip.org/app-builds/JackTrip-v1.6.1-macOS-x64-installer.pkg",
"downloadSize": 11476305,
"sha256": "eaf05c842d6b3ae799208a40b37da1cdb13e3700dcbbd97443c80cad81f4d2ac"
}
@@ -36,7 +46,7 @@
"changelog": "Full integration with JackTrip Virtual Studio. Learn more here: https://github.com/jacktrip/jacktrip/releases/tag/v1.6.0",
"download": {
"date": "2022-06-01T00:00:00Z",
- "url": "https://github.com/jacktrip/jacktrip/releases/download/v1.6.0/JackTrip-v1.6.0-macOS-x64-installer.pkg",
+ "url": "https://files.jacktrip.org/app-builds/JackTrip-v1.6.0-macOS-x64-installer.pkg",
"downloadSize": 11474299,
"sha256": "27259600ecd879106ebbf97754d72d6236075a049eafa0de6271d33f753f13e4"
}
diff --git a/releases/stable/win-manifests.json b/releases/stable/win-manifests.json
index 74cb51d..d5d5454 100644
--- a/releases/stable/win-manifests.json
+++ b/releases/stable/win-manifests.json
@@ -2,11 +2,21 @@
"app_name": "JackTrip",
"releases": [
{
+ "version": "1.6.4",
+ "changelog": "Adding volume meters, bugfixes around Windows hanging, device disconnects, and PLC: https://github.com/jacktrip/jacktrip/releases/tag/v1.6.4",
+ "download": {
+ "date": "2022-09-16T00:00:00Z",
+ "url": "https://files.jacktrip.org/app-builds/JackTrip-v1.6.4-Windows-x64-installer.msi",
+ "downloadSize": 43663360,
+ "sha256": "58dcbba584e1cc82373b8aa159800ad360eec7933ce9462e413ca347f09f3c26"
+ }
+ },
+ {
"version": "1.6.3",
"changelog": "Fixes around Linux desktop file and hub server mode: https://github.com/jacktrip/jacktrip/releases/tag/v1.6.3",
"download": {
"date": "2022-08-23T00:00:00Z",
- "url": "https://github.com/jacktrip/jacktrip/releases/download/v1.6.3/JackTrip-v1.6.3-Windows-x64-installer.msi",
+ "url": "https://files.jacktrip.org/app-builds/JackTrip-v1.6.3-Windows-x64-installer.msi",
"downloadSize": 43606016,
"sha256": "83a4def2a8c8fde24d147d39e70f60ee144e9425828f34eda2340c23ce72b1da"
}
@@ -16,7 +26,7 @@
"changelog": "Ability to open app via URL schemes, displaying latency stats, and Virtual Studio device support. Learn more here: https://github.com/jacktrip/jacktrip/releases/tag/v1.6.2",
"download": {
"date": "2022-08-17T00:00:00Z",
- "url": "https://github.com/jacktrip/jacktrip/releases/download/v1.6.2/JackTrip-v1.6.2-Windows-x64-installer.msi",
+ "url": "https://files.jacktrip.org/app-builds/JackTrip-v1.6.2-Windows-x64-installer.msi",
"downloadSize": 43606016,
"sha256": "2bb06fe3624df447d56da0d72fef1f4328346fd92c6dffccf66ba37253ec5e62"
}
@@ -26,7 +36,7 @@
"changelog": "Bugfixes around UDP timeout and 'Logging In' screen navigation. Learn more here: https://github.com/jacktrip/jacktrip/releases/tag/v1.6.1",
"download": {
"date": "2022-06-21T00:00:00Z",
- "url": "https://github.com/jacktrip/jacktrip/releases/download/v1.6.1/JackTrip-v1.6.1-Windows-x64-installer.msi",
+ "url": "https://files.jacktrip.org/app-builds/JackTrip-v1.6.1-Windows-x64-installer.msi",
"downloadSize": 43368448,
"sha256": "8eac390617488d849c0356e3305c96a59bbe46a8174d02b0321bb1dc86774b87"
}
@@ -36,7 +46,7 @@
"changelog": "Full integration with JackTrip Virtual Studio. Learn more here: https://github.com/jacktrip/jacktrip/releases/tag/v1.6.0",
"download": {
"date": "2022-06-01T00:00:00Z",
- "url": "https://github.com/jacktrip/jacktrip/releases/download/v1.6.0/JackTrip-v1.6.0-Windows-x64-installer.msi",
+ "url": "https://files.jacktrip.org/app-builds/JackTrip-v1.6.0-Windows-x64-installer.msi",
"downloadSize": 43364352,
"sha256": "9562ab654202bfc432e05caa3bd2bf1d0b52c50581b0a567f0546983fe46c078"
}
diff --git a/rtaudio.pro b/rtaudio.pro
index 51586be..6934b19 100644
--- a/rtaudio.pro
+++ b/rtaudio.pro
@@ -15,7 +15,6 @@ linux-g++ | linux-g++-64 {
}
macx {
QMAKE_CXXFLAGS += -D__MACOSX_CORE__
- QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.9 # the same deployment target as in jacktrip.pro
}
win32 {
QMAKE_CXXFLAGS += -D__WINDOWS_ASIO__ -D__WINDOWS_WASAPI__
diff --git a/src/AudioInterface.cpp b/src/AudioInterface.cpp
index 1244aaa..8ee34b1 100644
--- a/src/AudioInterface.cpp
+++ b/src/AudioInterface.cpp
@@ -51,7 +51,8 @@ AudioInterface::AudioInterface(JackTrip* jacktrip, int NumInChans, int NumOutCha
#ifdef WAIR // wair
int NumNetRevChans,
#endif // endwhere
- audioBitResolutionT AudioBitResolution)
+ audioBitResolutionT AudioBitResolution,
+ bool processWithNetwork)
: mJackTrip(jacktrip)
, mNumInChans(NumInChans)
, mNumOutChans(NumOutChans)
@@ -67,6 +68,7 @@ AudioInterface::AudioInterface(JackTrip* jacktrip, int NumInChans, int NumOutCha
, mAudioInputPacket(NULL)
, mAudioOutputPacket(NULL)
, mLoopBack(false)
+ , mProcessWithNetwork(processWithNetwork)
, mProcessingAudio(false)
{
#ifndef WAIR
@@ -239,7 +241,9 @@ void AudioInterface::callback(QVarLengthArray<sample_t*>& in_buffer,
#endif // endwhere
// ==== RECEIVE AUDIO CHANNELS FROM NETWORK ====
- computeProcessFromNetwork(out_buffer, n_frames);
+ if (mProcessWithNetwork) {
+ computeProcessFromNetwork(out_buffer, n_frames);
+ }
// =============================================
// out_buffer is from the network and goes "out" to local audio
@@ -321,10 +325,14 @@ void AudioInterface::callback(QVarLengthArray<sample_t*>& in_buffer,
mInBufCopy,
n_frames); // writes last channel of mInBufCopy with test impulse
}
- computeProcessToNetwork(mInBufCopy, n_frames);
+ if (mProcessWithNetwork) {
+ computeProcessToNetwork(mInBufCopy, n_frames);
+ }
} else { // copy saved if no plugins and no audio testing in progress:
- computeProcessToNetwork(
- in_buffer, n_frames); // send processed input audio to network - OUTGOING
+ if (mProcessWithNetwork) {
+ computeProcessToNetwork(
+ in_buffer, n_frames); // send processed input audio to network - OUTGOING
+ }
}
#ifdef WAIR // WAIR
diff --git a/src/AudioInterface.h b/src/AudioInterface.h
index 293e84a..ba17539 100644
--- a/src/AudioInterface.h
+++ b/src/AudioInterface.h
@@ -87,7 +87,8 @@ class AudioInterface
#ifdef WAIR // wair
int NumNetRevChans,
#endif // endwhere
- AudioInterface::audioBitResolutionT AudioBitResolution = AudioInterface::BIT16);
+ AudioInterface::audioBitResolutionT AudioBitResolution = AudioInterface::BIT16,
+ bool processWithNetwork = true);
/// \brief The class destructor
virtual ~AudioInterface();
@@ -255,6 +256,7 @@ class AudioInterface
int8_t* mAudioOutputPacket; ///< Packet containing all the channels to send to the
///< RingBuffer
bool mLoopBack;
+ bool mProcessWithNetwork; ///< whether or not to send/receive data via the network
AudioTester* mAudioTesterP{nullptr};
protected:
diff --git a/src/Auth.cpp b/src/Auth.cpp
index 40eaeef..c23771c 100644
--- a/src/Auth.cpp
+++ b/src/Auth.cpp
@@ -245,7 +245,7 @@ QByteArray Auth::generateSha512Hash(const QString& passwordString,
for (n = passwd.length(); n > 64; n -= 64) {
a.addData(bResult);
}
- a.addData(bResult.constData(), n);
+ a.addData(bResult.left(n));
// Step 11
n = passwd.length();
diff --git a/src/JackAudioInterface.cpp b/src/JackAudioInterface.cpp
index 516e9b9..1df61d3 100644
--- a/src/JackAudioInterface.cpp
+++ b/src/JackAudioInterface.cpp
@@ -80,10 +80,40 @@ JackAudioInterface::JackAudioInterface(
, mClient(NULL)
, mClientName(ClientName)
, mBroadcast(false)
+ , mJackTrip(jacktrip)
{
}
//*******************************************************************************
+JackAudioInterface::JackAudioInterface(
+ int NumInChans, int NumOutChans,
+#ifdef WAIR // wair
+ int NumNetRevChans,
+#endif // endwhere
+ AudioInterface::audioBitResolutionT AudioBitResolution, const QString& ClientName)
+ : AudioInterface(nullptr, NumInChans, NumOutChans,
+#ifdef WAIR // wair
+ NumNetRevChans,
+#endif // endwhere
+ AudioBitResolution, false)
+ , mNumInChans(NumInChans)
+ , mNumOutChans(NumOutChans)
+#ifdef WAIR // WAIR
+ , mNumNetRevChans(NumNetRevChans)
+#endif // endwhere
+ , mClient(NULL)
+ , mClientName(ClientName)
+ , mBroadcast(false)
+ , mJackTrip(nullptr)
+{
+ JackAudioInterface(nullptr, NumInChans, NumOutChans,
+#ifdef WAIR // wair
+ NumNetRevChans,
+#endif // endwhere
+ AudioBitResolution, ClientName);
+}
+
+//*******************************************************************************
JackAudioInterface::~JackAudioInterface() {}
//*******************************************************************************
@@ -111,6 +141,9 @@ void JackAudioInterface::setupClient()
// was jack_options_t options = JackNoStartServer;
// and then jack_options_t options = JackLoadName;
jack_options_t options = JackNullOption; // from jackSimpleClient example
+ if (mJackTrip == nullptr) {
+ options = JackNoStartServer;
+ }
jack_status_t status;
// Try to connect to the server
@@ -267,7 +300,8 @@ int JackAudioInterface::stopProcess() const
}
//*******************************************************************************
-void JackAudioInterface::jackShutdown(jack_status_t code, const char* reason, void* arg)
+void JackAudioInterface::jackShutdown(jack_status_t /*code*/, const char* reason,
+ void* /*arg*/)
{
std::cout << reason << std::endl;
JackTrip::sJackStopped = true;
diff --git a/src/JackAudioInterface.h b/src/JackAudioInterface.h
index 81ee103..b85d4ec 100644
--- a/src/JackAudioInterface.h
+++ b/src/JackAudioInterface.h
@@ -80,6 +80,14 @@ class JackAudioInterface : public AudioInterface
#endif // endwhere
AudioInterface::audioBitResolutionT AudioBitResolution = AudioInterface::BIT16,
const QString& ClientName = QStringLiteral("JackTrip"));
+ /// \brief Overloaded class constructor with null JackTrip pointer
+ JackAudioInterface(
+ int NumInChans, int NumOutChans,
+#ifdef WAIR // wair
+ int NumNetRevChans,
+#endif // endwhere
+ AudioInterface::audioBitResolutionT AudioBitResolution = AudioInterface::BIT16,
+ const QString& ClientName = QStringLiteral("JackTrip"));
/// \brief The class destructor
virtual ~JackAudioInterface();
@@ -195,6 +203,7 @@ class JackAudioInterface : public AudioInterface
bool mBroadcast;
QVector<ProcessPlugin*> mProcessPlugins; ///< Vector of ProcesPlugin<EM>s</EM>
static QMutex sJackMutex; ///< Mutex to make thread safe jack functions that are not
+ JackTrip* mJackTrip; ///< JackTrip Mediator Class pointer
};
#endif
diff --git a/src/JackTripWorker.cpp b/src/JackTripWorker.cpp
index 7130a0f..2165490 100644
--- a/src/JackTripWorker.cpp
+++ b/src/JackTripWorker.cpp
@@ -58,12 +58,14 @@ using std::endl;
//*******************************************************************************
JackTripWorker::JackTripWorker(UdpHubListener* udphublistener, int BufferQueueLength,
JackTrip::underrunModeT UnderRunMode,
+ AudioInterface::audioBitResolutionT AudioBitResolution,
const QString& clientName)
: mAppendThreadID(false)
, mSleepTime(100)
, mUdpHubListener(udphublistener)
, mBufferQueueLength(BufferQueueLength)
, mUnderRunMode(UnderRunMode)
+ , mAudioBitResolution(AudioBitResolution)
, mClientName(clientName)
{
// mNetks = new NetKS;
@@ -167,8 +169,9 @@ void JackTripWorker::start()
mJackTrip->setConnectDefaultAudioPorts(m_connectDefaultAudioPorts);
- // Set our underrun mode
+ // Set our underrun mode and bit resolution
mJackTrip->setUnderRunMode(mUnderRunMode);
+ mJackTrip->setAudioBitResolution(mAudioBitResolution);
if (mIOStatTimeout > 0) {
mJackTrip->setIOStatTimeout(mIOStatTimeout);
mJackTrip->setIOStatStream(mIOStatStream);
diff --git a/src/JackTripWorker.h b/src/JackTripWorker.h
index 7ce1d9e..5effcc1 100644
--- a/src/JackTripWorker.h
+++ b/src/JackTripWorker.h
@@ -70,10 +70,11 @@ class JackTripWorker : public QObject
public:
/// \brief The class constructor
- JackTripWorker(UdpHubListener* udphublistener,
- int BufferQueueLength = gDefaultQueueLength,
- JackTrip::underrunModeT UnderRunMode = JackTrip::WAVETABLE,
- const QString& clientName = QLatin1String(""));
+ JackTripWorker(
+ UdpHubListener* udphublistener, int BufferQueueLength = gDefaultQueueLength,
+ JackTrip::underrunModeT UnderRunMode = JackTrip::WAVETABLE,
+ AudioInterface::audioBitResolutionT AudioBitResolution = AudioInterface::BIT16,
+ const QString& clientName = QLatin1String(""));
/// \brief The class destructor
~JackTripWorker() = default;
@@ -161,6 +162,7 @@ class JackTripWorker : public QObject
int mBufferQueueLength;
JackTrip::underrunModeT mUnderRunMode;
+ AudioInterface::audioBitResolutionT mAudioBitResolution;
QString mClientName;
QString mAssignedClientName;
diff --git a/src/Meter.cpp b/src/Meter.cpp
index a58f8b6..14b26ed 100644
--- a/src/Meter.cpp
+++ b/src/Meter.cpp
@@ -122,6 +122,11 @@ void Meter::compute(int nframes, float** inputs, float** /*_*/)
//*******************************************************************************
void Meter::updateNumChannels(int nChansIn, int nChansOut)
{
+ // this should only be called before init!
+ if (inited) {
+ return;
+ }
+
if (outgoingPluginToNetwork) {
mNumChannels = nChansIn;
} else {
@@ -140,7 +145,9 @@ void Meter::onTick()
{
if (hasProcessedAudio) {
/* Send the measurements to whatever other component requests it */
- emit onComputedVolumeMeasurements(mValues);
+ QVector<float> valuesCopy(mValues);
+ valuesCopy.detach();
+ emit onComputedVolumeMeasurements(valuesCopy);
/* Set meter values to the default floor */
QVector<float>::iterator it;
diff --git a/src/RtAudioInterface.cpp b/src/RtAudioInterface.cpp
index 3c8a62e..5f89eb5 100644
--- a/src/RtAudioInterface.cpp
+++ b/src/RtAudioInterface.cpp
@@ -54,6 +54,15 @@ RtAudioInterface::RtAudioInterface(JackTrip* jacktrip, int NumInChans, int NumOu
}
//*******************************************************************************
+RtAudioInterface::RtAudioInterface(int NumInChans, int NumOutChans,
+ audioBitResolutionT AudioBitResolution)
+ : AudioInterface(nullptr, NumInChans, NumOutChans, AudioBitResolution, false)
+ , mRtAudio(NULL)
+{
+ RtAudioInterface(nullptr, NumInChans, NumOutChans, AudioBitResolution);
+}
+
+//*******************************************************************************
RtAudioInterface::~RtAudioInterface()
{
delete mRtAudio;
diff --git a/src/RtAudioInterface.h b/src/RtAudioInterface.h
index 1397e68..afcfba0 100644
--- a/src/RtAudioInterface.h
+++ b/src/RtAudioInterface.h
@@ -57,6 +57,10 @@ class RtAudioInterface : public AudioInterface
RtAudioInterface(JackTrip* jacktrip, int NumInChans = gDefaultNumInChannels,
int NumOutChans = gDefaultNumOutChannels,
audioBitResolutionT AudioBitResolution = BIT16);
+ /// \brief Overloaded class constructor with null JackTrip pointer
+ RtAudioInterface(int NumInChans = gDefaultNumInChannels,
+ int NumOutChans = gDefaultNumOutChannels,
+ audioBitResolutionT AudioBitResolution = BIT16);
/// \brief The class destructor
virtual ~RtAudioInterface();
diff --git a/src/Settings.cpp b/src/Settings.cpp
index e964815..bd7fd59 100644
--- a/src/Settings.cpp
+++ b/src/Settings.cpp
@@ -915,6 +915,7 @@ UdpHubListener* Settings::getConfiguredHubServer()
cout << gPrintSeparator << std::endl;
udpHub->setUnderRunMode(mUnderrunMode);
}
+ udpHub->setAudioBitResolution(mAudioBitResolution);
udpHub->setBufferQueueLength(mBufferQueueLength);
udpHub->setBufferStrategy(mBufferStrategy);
diff --git a/src/Tone.cpp b/src/Tone.cpp
new file mode 100644
index 0000000..6b7e5a1
--- /dev/null
+++ b/src/Tone.cpp
@@ -0,0 +1,95 @@
+//*****************************************************************
+/*
+ JackTrip: A System for High-Quality Audio Network Performance
+ over the Internet
+
+ Copyright (c) 2020 Julius Smith, Juan-Pablo Caceres, Chris Chafe.
+ SoundWIRE group at CCRMA, Stanford University.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ OTHER DEALINGS IN THE SOFTWARE.
+*/
+//*****************************************************************
+
+/**
+ * \file Tone.cpp
+ * \author Nelson Wang
+ * \date October 2022
+ * \license MIT
+ */
+
+#include "Tone.h"
+
+#include "jacktrip_types.h"
+
+//*******************************************************************************
+void Tone::init(int samplingRate)
+{
+ ProcessPlugin::init(samplingRate);
+ if (samplingRate != fSamplingFreq) {
+ std::cerr << "Sampling rate not set by superclass!\n";
+ std::exit(1);
+ }
+ fs = float(fSamplingFreq);
+
+ for (int i = 0; i < mNumChannels; i++) {
+ toneP[i]->init(fs); // compression filter parameters depend on sampling rate
+ }
+ inited = true;
+}
+
+//*******************************************************************************
+void Tone::compute(int nframes, float** inputs, float** outputs)
+{
+ if (not inited) {
+ std::cerr << "*** Tone " << this << ": init never called! Doing it now.\n";
+ if (fSamplingFreq <= 0) {
+ fSamplingFreq = 48000;
+ std::cout << "Tone " << this
+ << ": *** HAD TO GUESS the sampling rate (chose 48000 Hz) ***\n";
+ }
+ init(fSamplingFreq);
+ }
+
+ for (int i = 0; i < mNumChannels; i++) {
+ /* Run the signal through Faust */
+ toneP[i]->compute(nframes, &inputs[i], &outputs[i]);
+ }
+}
+
+//*******************************************************************************
+void Tone::updateNumChannels(int nChansIn, int nChansOut)
+{
+ if (outgoingPluginToNetwork) {
+ mNumChannels = nChansIn;
+ } else {
+ mNumChannels = nChansOut;
+ }
+}
+
+void Tone::triggerPlayback()
+{
+ for (int i = 0; i < mNumChannels; i++) {
+ int ndx = toneUIP[i]->getParamIndex("gate");
+ int v = toneUIP[i]->getParamValue(ndx);
+ toneUIP[i]->setParamValue(ndx, v + 1);
+ }
+}
diff --git a/src/Tone.h b/src/Tone.h
new file mode 100644
index 0000000..36ce568
--- /dev/null
+++ b/src/Tone.h
@@ -0,0 +1,96 @@
+//*****************************************************************
+/*
+ JackTrip: A System for High-Quality Audio Network Performance
+ over the Internet
+
+ Copyright (c) 2020 Julius Smith, Juan-Pablo Caceres, Chris Chafe.
+ SoundWIRE group at CCRMA, Stanford University.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ OTHER DEALINGS IN THE SOFTWARE.
+*/
+//*****************************************************************
+
+/**
+ * \file Tone.h
+ * \author Nelson Wang
+ * \date October 2022
+ * \license MIT
+ */
+
+#ifndef __TONE_H__
+#define __TONE_H__
+
+#include <QObject>
+#include <iostream>
+#include <vector>
+
+#include "ProcessPlugin.h"
+#include "tonedsp.h"
+
+/** \brief The Tone plugin plays some arbitrary sample audio
+ */
+class Tone : public ProcessPlugin
+{
+ Q_OBJECT;
+
+ public:
+ /// \brief The class constructor sets the number of channels to measure
+ Tone(int numchans, bool verboseFlag = false) : mNumChannels(numchans)
+ {
+ setVerbose(verboseFlag);
+ for (int i = 0; i < mNumChannels; i++) {
+ toneP.push_back(new tonedsp);
+ toneUIP.push_back(new APIUI); // #included in tonedsp.h
+ toneP[i]->buildUserInterface(toneUIP[i]);
+ }
+ }
+
+ /// \brief The class destructor
+ virtual ~Tone()
+ {
+ for (int i = 0; i < mNumChannels; i++) {
+ delete toneP[i];
+ delete toneUIP[i];
+ }
+ toneP.clear();
+ toneUIP.clear();
+ }
+
+ void init(int samplingRate) override;
+ int getNumInputs() override { return (mNumChannels); }
+ int getNumOutputs() override { return (mNumChannels); }
+ void compute(int nframes, float** inputs, float** outputs) override;
+ const char* getName() const override { return "Tone"; };
+
+ void updateNumChannels(int nChansIn, int nChansOut) override;
+
+ public slots:
+ void triggerPlayback();
+
+ private:
+ std::vector<tonedsp*> toneP;
+ std::vector<APIUI*> toneUIP;
+ float fs;
+ int mNumChannels;
+};
+
+#endif \ No newline at end of file
diff --git a/src/UdpHubListener.cpp b/src/UdpHubListener.cpp
index 5ee1806..b9bd65b 100644
--- a/src/UdpHubListener.cpp
+++ b/src/UdpHubListener.cpp
@@ -522,8 +522,9 @@ int UdpHubListener::getJackTripWorker(const QString& address,
if (mAppendThreadID) {
clientName = clientName + QStringLiteral("_%1").arg(id + 1);
}
- mJTWorkers->replace(
- id, new JackTripWorker(this, mBufferQueueLength, mUnderRunMode, clientName));
+ mJTWorkers->replace(id,
+ new JackTripWorker(this, mBufferQueueLength, mUnderRunMode,
+ mAudioBitResolution, clientName));
mJTWorkers->at(id)->setJackTrip(
id, address, mBasePort + id,
0, // Set client port to 0 initially until we receive a UDP packet.
diff --git a/src/UdpHubListener.h b/src/UdpHubListener.h
index d0a078d..58f0737 100644
--- a/src/UdpHubListener.h
+++ b/src/UdpHubListener.h
@@ -178,6 +178,7 @@ class UdpHubListener : public QObject
int mTotalRunningThreads; ///< Number of Threads running in the pool
QMutex mMutex;
JackTrip::underrunModeT mUnderRunMode;
+ AudioInterface::audioBitResolutionT mAudioBitResolution;
int mBufferQueueLength;
QStringList mHubPatchDescriptions;
@@ -244,6 +245,10 @@ class UdpHubListener : public QObject
{
mUnderRunMode = UnderRunMode;
}
+ void setAudioBitResolution(AudioInterface::audioBitResolutionT AudioBitResolution)
+ {
+ mAudioBitResolution = AudioBitResolution;
+ }
void setBufferQueueLength(int BufferQueueLength)
{
mBufferQueueLength = BufferQueueLength;
diff --git a/src/Volume.cpp b/src/Volume.cpp
new file mode 100644
index 0000000..d290f3e
--- /dev/null
+++ b/src/Volume.cpp
@@ -0,0 +1,113 @@
+//*****************************************************************
+/*
+ JackTrip: A System for High-Quality Audio Network Performance
+ over the Internet
+
+ Copyright (c) 2020 Julius Smith, Juan-Pablo Caceres, Chris Chafe.
+ SoundWIRE group at CCRMA, Stanford University.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ OTHER DEALINGS IN THE SOFTWARE.
+*/
+//*****************************************************************
+
+/**
+ * \file Volume.cpp
+ * \author Matt Horton
+ * \date September 2022
+ * \license MIT
+ */
+
+#include "Volume.h"
+
+#include <QVector>
+
+#include "jacktrip_types.h"
+
+//*******************************************************************************
+void Volume::init(int samplingRate)
+{
+ ProcessPlugin::init(samplingRate);
+ if (samplingRate != fSamplingFreq) {
+ std::cerr << "Sampling rate not set by superclass!\n";
+ std::exit(1);
+ }
+ fs = float(fSamplingFreq);
+
+ for (int i = 0; i < mNumChannels; i++) {
+ volumeP[i]->init(fs); // compression filter parameters depend on sampling rate
+ int ndx = volumeUIP[i]->getParamIndex("Volume");
+ volumeUIP[i]->setParamValue(ndx, mVolMultiplier);
+ ndx = volumeUIP[i]->getParamIndex("Mute");
+ volumeUIP[i]->setParamValue(ndx, isMuted ? 1 : 0);
+ }
+ inited = true;
+}
+
+//*******************************************************************************
+void Volume::compute(int nframes, float** inputs, float** outputs)
+{
+ if (not inited) {
+ std::cerr << "*** Volume " << this << ": init never called! Doing it now.\n";
+ if (fSamplingFreq <= 0) {
+ fSamplingFreq = 48000;
+ std::cout << "Volume " << this
+ << ": *** HAD TO GUESS the sampling rate (chose 48000 Hz) ***\n";
+ }
+ init(fSamplingFreq);
+ }
+
+ for (int i = 0; i < mNumChannels; i++) {
+ /* Run the signal through Faust */
+ volumeP[i]->compute(nframes, &inputs[i], &outputs[i]);
+ }
+}
+
+//*******************************************************************************
+void Volume::updateNumChannels(int nChansIn, int nChansOut)
+{
+ if (outgoingPluginToNetwork) {
+ mNumChannels = nChansIn;
+ } else {
+ mNumChannels = nChansOut;
+ }
+}
+
+void Volume::volumeUpdated(float multiplier)
+{
+ // maps 0.0-1.0 to a -40 dB to 0 dB range
+ // update if volumedsp.dsp and/or volumedsp.h
+ // change their ranges
+ mVolMultiplier = 40.0 * multiplier - 40.0;
+ for (int i = 0; i < mNumChannels; i++) {
+ int ndx = volumeUIP[i]->getParamIndex("Volume");
+ volumeUIP[i]->setParamValue(ndx, mVolMultiplier);
+ }
+}
+
+void Volume::muteUpdated(bool muted)
+{
+ isMuted = muted;
+ for (int i = 0; i < mNumChannels; i++) {
+ int ndx = volumeUIP[i]->getParamIndex("Mute");
+ volumeUIP[i]->setParamValue(ndx, isMuted ? 1 : 0);
+ }
+} \ No newline at end of file
diff --git a/src/Volume.h b/src/Volume.h
new file mode 100644
index 0000000..59548bb
--- /dev/null
+++ b/src/Volume.h
@@ -0,0 +1,101 @@
+//*****************************************************************
+/*
+ JackTrip: A System for High-Quality Audio Network Performance
+ over the Internet
+
+ Copyright (c) 2020 Julius Smith, Juan-Pablo Caceres, Chris Chafe.
+ SoundWIRE group at CCRMA, Stanford University.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ OTHER DEALINGS IN THE SOFTWARE.
+*/
+//*****************************************************************
+
+/**
+ * \file Volume.h
+ * \author Matt Horton
+ * \date September 2022
+ * \license MIT
+ */
+
+#ifndef __VOLUME_H__
+#define __VOLUME_H__
+
+#include <QObject>
+#include <QTimer>
+#include <QVector>
+#include <iostream>
+#include <vector>
+
+#include "ProcessPlugin.h"
+#include "volumedsp.h"
+
+/** \brief The Volume plugin adjusts the level of the signal via multiplication
+ */
+class Volume : public ProcessPlugin
+{
+ Q_OBJECT;
+
+ public:
+ /// \brief The class constructor sets the number of channels to measure
+ Volume(int numchans, bool verboseFlag = false) : mNumChannels(numchans)
+ {
+ setVerbose(verboseFlag);
+ for (int i = 0; i < mNumChannels; i++) {
+ volumeP.push_back(new volumedsp);
+ volumeUIP.push_back(new APIUI); // #included in volumedsp.h
+ volumeP[i]->buildUserInterface(volumeUIP[i]);
+ }
+ }
+
+ /// \brief The class destructor
+ virtual ~Volume()
+ {
+ for (int i = 0; i < mNumChannels; i++) {
+ delete volumeP[i];
+ delete volumeUIP[i];
+ }
+ volumeP.clear();
+ volumeUIP.clear();
+ }
+
+ void init(int samplingRate) override;
+ int getNumInputs() override { return (mNumChannels); }
+ int getNumOutputs() override { return (mNumChannels); }
+ void compute(int nframes, float** inputs, float** outputs) override;
+ const char* getName() const override { return "Volume"; };
+
+ void updateNumChannels(int nChansIn, int nChansOut) override;
+
+ public slots:
+ void volumeUpdated(float multiplier);
+ void muteUpdated(bool muted);
+
+ private:
+ std::vector<volumedsp*> volumeP;
+ std::vector<APIUI*> volumeUIP;
+ float fs;
+ int mNumChannels;
+ float mVolMultiplier = 0.0;
+ bool isMuted = false;
+};
+
+#endif \ No newline at end of file
diff --git a/src/compressordsp.h b/src/compressordsp.h
index a9f03bd..2fcd14f 100644
--- a/src/compressordsp.h
+++ b/src/compressordsp.h
@@ -3,8 +3,9 @@ author: "Julius Smith"
license: "MIT Style STK-4.2"
name: "compressor"
version: "0.0"
-Code generated with Faust 2.28.6 (https://faust.grame.fr)
-Compilation options: -lang cpp -inpl -scal -ftz 0
+Code generated with Faust 2.41.1 (https://faust.grame.fr)
+Compilation options: -a faust2header.cpp -lang cpp -i -inpl -cn compressordsp -es 1 -mcd
+16 -single -ftz 0
------------------------------------------------------------ */
#ifndef __compressordsp_H__
@@ -17,23 +18,23 @@ Compilation options: -lang cpp -inpl -scal -ftz 0
// aimed at creating a simple C++ header file (.h) containing a Faust DSP.
// See the Makefile for how to use it.
-/************************** BEGIN dsp.h **************************/
-/************************************************************************
+/************************** BEGIN dsp.h ********************************
FAUST Architecture File
- Copyright (C) 2003-2017 GRAME, Centre National de Creation Musicale
+ Copyright (C) 2003-2022 GRAME, Centre National de Creation Musicale
---------------------------------------------------------------------
- This Architecture section is free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 3 of
- the License, or (at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; If not, see <http://www.gnu.org/licenses/>.
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
EXCEPTION : As a special exception, you may create a larger work
that contains this FAUST architecture section and distribute
@@ -47,29 +48,111 @@ Compilation options: -lang cpp -inpl -scal -ftz 0
#include <string>
#include <vector>
+/************************************************************************
+ ************************************************************************
+ FAUST compiler
+ Copyright (C) 2003-2018 GRAME, Centre National de Creation Musicale
+ ---------------------------------------------------------------------
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ ************************************************************************
+ ************************************************************************/
+
+#ifndef __export__
+#define __export__
+
+#define FAUSTVERSION "2.41.1"
+
+// Use FAUST_API for code that is part of the external API but is also compiled in faust
+// and libfaust Use LIBFAUST_API for code that is compiled in faust and libfaust
+
+#ifdef _WIN32
+#pragma warning(disable : 4251)
+#ifdef FAUST_EXE
+#define FAUST_API
+#define LIBFAUST_API
+#elif FAUST_LIB
+#define FAUST_API __declspec(dllexport)
+#define LIBFAUST_API __declspec(dllexport)
+#else
+#define FAUST_API
+#define LIBFAUST_API
+#endif
+#else
+#ifdef FAUST_EXE
+#define FAUST_API
+#define LIBFAUST_API
+#else
+#define FAUST_API __attribute__((visibility("default")))
+#define LIBFAUST_API __attribute__((visibility("default")))
+#endif
+#endif
+
+#endif
+
#ifndef FAUSTFLOAT
#define FAUSTFLOAT float
#endif
-struct UI;
-struct Meta;
+struct FAUST_API UI;
+struct FAUST_API Meta;
/**
* DSP memory manager.
*/
-struct dsp_memory_manager {
+struct FAUST_API dsp_memory_manager {
virtual ~dsp_memory_manager() {}
+ /**
+ * Inform the Memory Manager with the number of expected memory zones.
+ * @param count - the number of expected memory zones
+ */
+ virtual void begin(size_t /*count*/) {}
+
+ /**
+ * Give the Memory Manager information on a given memory zone.
+ * @param size - the size in bytes of the memory zone
+ * @param reads - the number of Read access to the zone used to compute one frame
+ * @param writes - the number of Write access to the zone used to compute one frame
+ */
+ virtual void info(size_t /*size*/, size_t /*reads*/, size_t /*writes*/) {}
+
+ /**
+ * Inform the Memory Manager that all memory zones have been described,
+ * to possibly start a 'compute the best allocation strategy' step.
+ */
+ virtual void end() {}
+
+ /**
+ * Allocate a memory zone.
+ * @param size - the memory zone size in bytes
+ */
virtual void* allocate(size_t size) = 0;
- virtual void destroy(void* ptr) = 0;
+
+ /**
+ * Destroy a memory zone.
+ * @param ptr - the memory zone pointer to be deallocated
+ */
+ virtual void destroy(void* ptr) = 0;
};
/**
* Signal processor definition.
*/
-class dsp
+class FAUST_API dsp
{
public:
dsp() {}
@@ -89,7 +172,7 @@ class dsp
*/
virtual void buildUserInterface(UI* ui_interface) = 0;
- /* Returns the sample rate currently used by the instance */
+ /* Return the sample rate currently used by the instance */
virtual int getSampleRate() = 0;
/**
@@ -97,28 +180,28 @@ class dsp
* - static class 'classInit': static tables initialization
* - 'instanceInit': constants and instance state initialization
*
- * @param sample_rate - the sampling rate in Hertz
+ * @param sample_rate - the sampling rate in Hz
*/
virtual void init(int sample_rate) = 0;
/**
* Init instance state
*
- * @param sample_rate - the sampling rate in Hertz
+ * @param sample_rate - the sampling rate in Hz
*/
virtual void instanceInit(int sample_rate) = 0;
/**
* Init instance constant state
*
- * @param sample_rate - the sampling rate in Hertz
+ * @param sample_rate - the sampling rate in Hz
*/
virtual void instanceConstants(int sample_rate) = 0;
/* Init default control parameters values */
virtual void instanceResetUserInterface() = 0;
- /* Init instance state (delay lines...) */
+ /* Init instance state (like delay lines...) but keep the control parameter values */
virtual void instanceClear() = 0;
/**
@@ -170,7 +253,7 @@ class dsp
* Generic DSP decorator.
*/
-class decorator_dsp : public dsp
+class FAUST_API decorator_dsp : public dsp
{
protected:
dsp* fDSP;
@@ -209,10 +292,11 @@ class decorator_dsp : public dsp
};
/**
- * DSP factory class.
+ * DSP factory class, used with LLVM and Interpreter backends
+ * to create DSP instances from a compiled DSP program.
*/
-class dsp_factory
+class FAUST_API dsp_factory
{
protected:
// So that to force sub-classes to use deleteDSPFactory(dsp_factory* factory);
@@ -232,75 +316,114 @@ class dsp_factory
virtual dsp_memory_manager* getMemoryManager() = 0;
};
-/**
- * On Intel set FZ (Flush to Zero) and DAZ (Denormals Are Zero)
- * flags to avoid costly denormals.
- */
+// Denormal handling
-#ifdef __SSE__
+#if defined(__SSE__)
#include <xmmintrin.h>
-#ifdef __SSE2__
-#define AVOIDDENORMALS _mm_setcsr(_mm_getcsr() | 0x8040)
+#endif
+
+class FAUST_API ScopedNoDenormals
+{
+ private:
+ intptr_t fpsr;
+
+ void setFpStatusRegister(intptr_t fpsr_aux) noexcept
+ {
+#if defined(__arm64__) || defined(__aarch64__)
+ asm volatile("msr fpcr, %0" : : "ri"(fpsr_aux));
+#elif defined(__SSE__)
+ _mm_setcsr(static_cast<uint32_t>(fpsr_aux));
+#endif
+ }
+
+ void getFpStatusRegister() noexcept
+ {
+#if defined(__arm64__) || defined(__aarch64__)
+ asm volatile("mrs %0, fpcr" : "=r"(fpsr));
+#elif defined(__SSE__)
+ fpsr = static_cast<intptr_t>(_mm_getcsr());
+#endif
+ }
+
+ public:
+ ScopedNoDenormals() noexcept
+ {
+#if defined(__arm64__) || defined(__aarch64__)
+ intptr_t mask = (1 << 24 /* FZ */);
#else
-#define AVOIDDENORMALS _mm_setcsr(_mm_getcsr() | 0x8000)
+#if defined(__SSE__)
+#if defined(__SSE2__)
+ intptr_t mask = 0x8040;
+#else
+ intptr_t mask = 0x8000;
#endif
#else
-#define AVOIDDENORMALS
+ intptr_t mask = 0x0000;
#endif
-
#endif
-/************************** END dsp.h **************************/
+ getFpStatusRegister();
+ setFpStatusRegister(fpsr | mask);
+ }
-/************************** BEGIN APIUI.h **************************/
-/************************************************************************
- FAUST Architecture File
- Copyright (C) 2003-2017 GRAME, Centre National de Creation Musicale
- ---------------------------------------------------------------------
- This Architecture section is free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 3 of
- the License, or (at your option) any later version.
+ ~ScopedNoDenormals() noexcept { setFpStatusRegister(fpsr); }
+};
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+#define AVOIDDENORMALS ScopedNoDenormals();
- You should have received a copy of the GNU General Public License
- along with this program; If not, see <http://www.gnu.org/licenses/>.
+#endif
- EXCEPTION : As a special exception, you may create a larger work
- that contains this FAUST architecture section and distribute
- that work under terms of your choice, so long as this FAUST
- architecture section is not modified.
- ************************************************************************/
+/************************** END dsp.h **************************/
+/************************** BEGIN APIUI.h *****************************
+FAUST Architecture File
+Copyright (C) 2003-2022 GRAME, Centre National de Creation Musicale
+---------------------------------------------------------------------
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+EXCEPTION : As a special exception, you may create a larger work
+that contains this FAUST architecture section and distribute
+that work under terms of your choice, so long as this FAUST
+architecture section is not modified.
+************************************************************************/
#ifndef API_UI_H
#define API_UI_H
-#include <iostream>
+#include <stdio.h>
+
#include <map>
#include <sstream>
#include <string>
#include <vector>
-/************************** BEGIN meta.h **************************/
-/************************************************************************
+/************************** BEGIN meta.h *******************************
FAUST Architecture File
- Copyright (C) 2003-2017 GRAME, Centre National de Creation Musicale
+ Copyright (C) 2003-2022 GRAME, Centre National de Creation Musicale
---------------------------------------------------------------------
- This Architecture section is free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 3 of
- the License, or (at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; If not, see <http://www.gnu.org/licenses/>.
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
EXCEPTION : As a special exception, you may create a larger work
that contains this FAUST architecture section and distribute
@@ -311,36 +434,40 @@ class dsp_factory
#ifndef __meta__
#define __meta__
-struct Meta {
- virtual ~Meta(){};
+/**
+ The base class of Meta handler to be used in dsp::metadata(Meta* m) method to retrieve
+ (key, value) metadata.
+ */
+struct FAUST_API Meta {
+ virtual ~Meta() {}
virtual void declare(const char* key, const char* value) = 0;
};
#endif
/************************** END meta.h **************************/
-/************************** BEGIN UI.h **************************/
-/************************************************************************
+/************************** BEGIN UI.h *****************************
FAUST Architecture File
- Copyright (C) 2003-2020 GRAME, Centre National de Creation Musicale
+ Copyright (C) 2003-2022 GRAME, Centre National de Creation Musicale
---------------------------------------------------------------------
- This Architecture section is free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 3 of
- the License, or (at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; If not, see <http://www.gnu.org/licenses/>.
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
EXCEPTION : As a special exception, you may create a larger work
that contains this FAUST architecture section and distribute
that work under terms of your choice, so long as this FAUST
architecture section is not modified.
- ************************************************************************/
+ ********************************************************************/
#ifndef __UI_H__
#define __UI_H__
@@ -359,7 +486,7 @@ struct Meta {
struct Soundfile;
template<typename REAL>
-struct UIReal {
+struct FAUST_API UIReal {
UIReal() {}
virtual ~UIReal() {}
@@ -390,38 +517,41 @@ struct UIReal {
// -- soundfiles
- virtual void addSoundfile(const char* label, const char* filename,
- Soundfile** sf_zone) = 0;
+ virtual void addSoundfile(const char* /*label*/, const char* /*filename*/,
+ Soundfile** /*sf_zone*/) = 0;
// -- metadata declarations
virtual void declare(REAL* /*zone*/, const char* /*key*/, const char* /*val*/) {}
+
+ // To be used by LLVM client
+ virtual int sizeOfFAUSTFLOAT() { return sizeof(FAUSTFLOAT); }
};
-struct UI : public UIReal<FAUSTFLOAT> {
+struct FAUST_API UI : public UIReal<FAUSTFLOAT> {
UI() {}
virtual ~UI() {}
};
#endif
/************************** END UI.h **************************/
-/************************** BEGIN PathBuilder.h **************************/
-/************************************************************************
+/************************** BEGIN PathBuilder.h **************************
FAUST Architecture File
- Copyright (C) 2003-2017 GRAME, Centre National de Creation Musicale
+ Copyright (C) 2003-2022 GRAME, Centre National de Creation Musicale
---------------------------------------------------------------------
- This Architecture section is free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 3 of
- the License, or (at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; If not, see <http://www.gnu.org/licenses/>.
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
EXCEPTION : As a special exception, you may create a larger work
that contains this FAUST architecture section and distribute
@@ -429,10 +559,13 @@ struct UI : public UIReal<FAUSTFLOAT> {
architecture section is not modified.
************************************************************************/
-#ifndef FAUST_PATHBUILDER_H
-#define FAUST_PATHBUILDER_H
+#ifndef __PathBuilder__
+#define __PathBuilder__
#include <algorithm>
+#include <map>
+#include <regex>
+#include <set>
#include <string>
#include <vector>
@@ -441,113 +574,266 @@ struct UI : public UIReal<FAUSTFLOAT> {
* Helper class to build complete hierarchical path for UI items.
******************************************************************************/
-class PathBuilder
+class FAUST_API PathBuilder
{
protected:
std::vector<std::string> fControlsLevel;
+ std::vector<std::string> fFullPaths;
+ std::map<std::string, std::string> fFull2Short; // filled by computeShortNames()
+
+ /**
+ * @brief check if a character is acceptable for an ID
+ *
+ * @param c
+ * @return true is the character is acceptable for an ID
+ */
+ bool isIDChar(char c) const
+ {
+ return ((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z'))
+ || ((c >= '0') && (c <= '9'));
+ }
+
+ /**
+ * @brief remove all "/0x00" parts
+ *
+ * @param src
+ * @return modified string
+ */
+ std::string remove0x00(const std::string& src) const
+ {
+ return std::regex_replace(src, std::regex("/0x00"), "");
+ }
+
+ /**
+ * @brief replace all non ID char with '_' (one '_' may replace several non ID char)
+ *
+ * @param src
+ * @return modified string
+ */
+ std::string str2ID(const std::string& src) const
+ {
+ std::string dst;
+ bool need_underscore = false;
+ for (char c : src) {
+ if (isIDChar(c) || (c == '/')) {
+ if (need_underscore) {
+ dst.push_back('_');
+ need_underscore = false;
+ }
+ dst.push_back(c);
+ } else {
+ need_underscore = true;
+ }
+ }
+ return dst;
+ }
+
+ /**
+ * @brief Keep only the last n slash-parts
+ *
+ * @param src
+ * @param n : 1 indicates the last slash-part
+ * @return modified string
+ */
+ std::string cut(const std::string& src, int n) const
+ {
+ std::string rdst;
+ for (int i = int(src.length()) - 1; i >= 0; i--) {
+ char c = src[i];
+ if (c != '/') {
+ rdst.push_back(c);
+ } else if (n == 1) {
+ std::string dst;
+ for (int j = int(rdst.length()) - 1; j >= 0; j--) {
+ dst.push_back(rdst[j]);
+ }
+ return dst;
+ } else {
+ n--;
+ rdst.push_back(c);
+ }
+ }
+ return src;
+ }
+
+ void addFullPath(const std::string& label) { fFullPaths.push_back(buildPath(label)); }
+
+ /**
+ * @brief Compute the mapping between full path and short names
+ */
+ void computeShortNames()
+ {
+ std::vector<std::string>
+ uniquePaths; // all full paths transformed but made unique with a prefix
+ std::map<std::string, std::string>
+ unique2full; // all full paths transformed but made unique with a prefix
+ char num_buffer[16];
+ int pnum = 0;
+
+ for (const auto& s : fFullPaths) {
+ sprintf(num_buffer, "%d", pnum++);
+ std::string u = "/P" + std::string(num_buffer) + str2ID(remove0x00(s));
+ uniquePaths.push_back(u);
+ unique2full[u] = s; // remember the full path associated to a unique path
+ }
+
+ std::map<std::string, int> uniquePath2level; // map path to level
+ for (const auto& s : uniquePaths)
+ uniquePath2level[s] = 1; // we init all levels to 1
+ bool have_collisions = true;
+
+ while (have_collisions) {
+ // compute collision list
+ std::set<std::string> collisionSet;
+ std::map<std::string, std::string> short2full;
+ have_collisions = false;
+ for (const auto& it : uniquePath2level) {
+ std::string u = it.first;
+ int n = it.second;
+ std::string shortName = cut(u, n);
+ auto p = short2full.find(shortName);
+ if (p == short2full.end()) {
+ // no collision
+ short2full[shortName] = u;
+ } else {
+ // we have a collision, add the two paths to the collision set
+ have_collisions = true;
+ collisionSet.insert(u);
+ collisionSet.insert(p->second);
+ }
+ }
+ for (const auto& s : collisionSet)
+ uniquePath2level[s]++; // increase level of colliding path
+ }
+
+ for (const auto& it : uniquePath2level) {
+ std::string u = it.first;
+ int n = it.second;
+ std::string shortName = replaceCharList(cut(u, n), {'/'}, '_');
+ fFull2Short[unique2full[u]] = shortName;
+ }
+ }
+
+ std::string replaceCharList(const std::string& str, const std::vector<char>& ch1,
+ char ch2)
+ {
+ auto beg = ch1.begin();
+ auto end = ch1.end();
+ std::string res = str;
+ for (size_t i = 0; i < str.length(); ++i) {
+ if (std::find(beg, end, str[i]) != end)
+ res[i] = ch2;
+ }
+ return res;
+ }
public:
PathBuilder() {}
virtual ~PathBuilder() {}
+ // Return true for the first level of groups
+ bool pushLabel(const std::string& label)
+ {
+ fControlsLevel.push_back(label);
+ return fControlsLevel.size() == 1;
+ }
+
+ // Return true for the last level of groups
+ bool popLabel()
+ {
+ fControlsLevel.pop_back();
+ return fControlsLevel.size() == 0;
+ }
+
std::string buildPath(const std::string& label)
{
std::string res = "/";
for (size_t i = 0; i < fControlsLevel.size(); i++) {
- res += fControlsLevel[i];
- res += "/";
+ res = res + fControlsLevel[i] + "/";
}
res += label;
- std::replace(res.begin(), res.end(), ' ', '_');
- return res;
- }
-
- std::string buildLabel(std::string label)
- {
- std::replace(label.begin(), label.end(), ' ', '_');
- return label;
+ return replaceCharList(
+ res, {' ', '#', '*', ',', '?', '[', ']', '{', '}', '(', ')'}, '_');
}
-
- void pushLabel(const std::string& label) { fControlsLevel.push_back(label); }
- void popLabel() { fControlsLevel.pop_back(); }
};
-#endif // FAUST_PATHBUILDER_H
+#endif // __PathBuilder__
/************************** END PathBuilder.h **************************/
-/************************** BEGIN ValueConverter.h **************************/
-/************************************************************************
+/************************** BEGIN ValueConverter.h ********************
FAUST Architecture File
- Copyright (C) 2003-2017 GRAME, Centre National de Creation Musicale
+ Copyright (C) 2003-2022 GRAME, Centre National de Creation Musicale
---------------------------------------------------------------------
- This Architecture section is free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 3 of
- the License, or (at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; If not, see <http://www.gnu.org/licenses/>.
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
EXCEPTION : As a special exception, you may create a larger work
that contains this FAUST architecture section and distribute
that work under terms of your choice, so long as this FAUST
architecture section is not modified.
- ************************************************************************/
+ ********************************************************************/
#ifndef __ValueConverter__
#define __ValueConverter__
/***************************************************************************************
- ValueConverter.h
- (GRAME, Copyright 2015-2019)
+ ValueConverter.h
+ (GRAME, Copyright 2015-2019)
-Set of conversion objects used to map user interface values (for example a gui slider
-delivering values between 0 and 1) to faust values (for example a vslider between
-20 and 20000) using a log scale.
+ Set of conversion objects used to map user interface values (for example a gui slider
+ delivering values between 0 and 1) to faust values (for example a vslider between
+ 20 and 20000) using a log scale.
--- Utilities
+ -- Utilities
-Range(lo,hi) : clip a value x between lo and hi
-Interpolator(lo,hi,v1,v2) : Maps a value x between lo and hi to a value y between v1 and
+ Range(lo,hi) : clip a value x between lo and hi
+ Interpolator(lo,hi,v1,v2) : Maps a value x between lo and hi to a value y between v1 and
v2 Interpolator3pt(lo,mi,hi,v1,vm,v2) : Map values between lo mid hi to values between v1
vm v2
--- Value Converters
+ -- Value Converters
-ValueConverter::ui2faust(x)
-ValueConverter::faust2ui(x)
+ ValueConverter::ui2faust(x)
+ ValueConverter::faust2ui(x)
--- ValueConverters used for sliders depending of the scale
+ -- ValueConverters used for sliders depending of the scale
-LinearValueConverter(umin, umax, fmin, fmax)
-LinearValueConverter2(lo, mi, hi, v1, vm, v2) using 2 segments
-LogValueConverter(umin, umax, fmin, fmax)
-ExpValueConverter(umin, umax, fmin, fmax)
+ LinearValueConverter(umin, umax, fmin, fmax)
+ LinearValueConverter2(lo, mi, hi, v1, vm, v2) using 2 segments
+ LogValueConverter(umin, umax, fmin, fmax)
+ ExpValueConverter(umin, umax, fmin, fmax)
--- ValueConverters used for accelerometers based on 3 points
+ -- ValueConverters used for accelerometers based on 3 points
-AccUpConverter(amin, amid, amax, fmin, fmid, fmax) -- curve 0
-AccDownConverter(amin, amid, amax, fmin, fmid, fmax) -- curve 1
-AccUpDownConverter(amin, amid, amax, fmin, fmid, fmax) -- curve 2
-AccDownUpConverter(amin, amid, amax, fmin, fmid, fmax) -- curve 3
+ AccUpConverter(amin, amid, amax, fmin, fmid, fmax) -- curve 0
+ AccDownConverter(amin, amid, amax, fmin, fmid, fmax) -- curve 1
+ AccUpDownConverter(amin, amid, amax, fmin, fmid, fmax) -- curve 2
+ AccDownUpConverter(amin, amid, amax, fmin, fmid, fmax) -- curve 3
--- lists of ZoneControl are used to implement accelerometers metadata for each axes
+ -- lists of ZoneControl are used to implement accelerometers metadata for each axes
-ZoneControl(zone, valueConverter) : a zone with an accelerometer data converter
+ ZoneControl(zone, valueConverter) : a zone with an accelerometer data converter
--- ZoneReader are used to implement screencolor metadata
+ -- ZoneReader are used to implement screencolor metadata
-ZoneReader(zone, valueConverter) : a zone with a data converter
+ ZoneReader(zone, valueConverter) : a zone with a data converter
****************************************************************************************/
+#include <assert.h>
+#include <float.h>
+
#include <algorithm> // std::max
-#include <cassert>
-#include <cfloat>
#include <cmath>
#include <vector>
@@ -555,12 +841,12 @@ ZoneReader(zone, valueConverter) : a zone with a data converter
// Interpolator(lo,hi,v1,v2)
// Maps a value x between lo and hi to a value y between v1 and v2
// y = v1 + (x-lo)/(hi-lo)*(v2-v1)
-// y = v1 + (x-lo) * coef with coef = (v2-v1)/(hi-lo)
+// y = v1 + (x-lo) * coef with coef = (v2-v1)/(hi-lo)
// y = v1 + x*coef - lo*coef
// y = v1 - lo*coef + x*coef
-// y = offset + x*coef with offset = v1 - lo*coef
+// y = offset + x*coef with offset = v1 - lo*coef
//--------------------------------------------------------------------------------------
-class Interpolator
+class FAUST_API Interpolator
{
private:
//--------------------------------------------------------------------------------------
@@ -611,7 +897,7 @@ class Interpolator
// Interpolator3pt(lo,mi,hi,v1,vm,v2)
// Map values between lo mid hi to values between v1 vm v2
//--------------------------------------------------------------------------------------
-class Interpolator3pt
+class FAUST_API Interpolator3pt
{
private:
Interpolator fSegment1;
@@ -635,19 +921,19 @@ class Interpolator3pt
//--------------------------------------------------------------------------------------
// Abstract ValueConverter class. Converts values between UI and Faust representations
//--------------------------------------------------------------------------------------
-class ValueConverter
+class FAUST_API ValueConverter
{
public:
virtual ~ValueConverter() {}
- virtual double ui2faust(double x) = 0;
- virtual double faust2ui(double x) = 0;
+ virtual double ui2faust(double x) { return x; };
+ virtual double faust2ui(double x) { return x; };
};
//--------------------------------------------------------------------------------------
// A converter than can be updated
//--------------------------------------------------------------------------------------
-class UpdatableValueConverter : public ValueConverter
+class FAUST_API UpdatableValueConverter : public ValueConverter
{
protected:
bool fActive;
@@ -667,7 +953,7 @@ class UpdatableValueConverter : public ValueConverter
//--------------------------------------------------------------------------------------
// Linear conversion between ui and Faust values
//--------------------------------------------------------------------------------------
-class LinearValueConverter : public ValueConverter
+class FAUST_API LinearValueConverter : public ValueConverter
{
private:
Interpolator fUI2F;
@@ -687,7 +973,7 @@ class LinearValueConverter : public ValueConverter
//--------------------------------------------------------------------------------------
// Two segments linear conversion between ui and Faust values
//--------------------------------------------------------------------------------------
-class LinearValueConverter2 : public UpdatableValueConverter
+class FAUST_API LinearValueConverter2 : public UpdatableValueConverter
{
private:
Interpolator3pt fUI2F;
@@ -723,7 +1009,7 @@ class LinearValueConverter2 : public UpdatableValueConverter
//--------------------------------------------------------------------------------------
// Logarithmic conversion between ui and Faust values
//--------------------------------------------------------------------------------------
-class LogValueConverter : public LinearValueConverter
+class FAUST_API LogValueConverter : public LinearValueConverter
{
public:
LogValueConverter(double umin, double umax, double fmin, double fmax)
@@ -745,7 +1031,7 @@ class LogValueConverter : public LinearValueConverter
//--------------------------------------------------------------------------------------
// Exponential conversion between ui and Faust values
//--------------------------------------------------------------------------------------
-class ExpValueConverter : public LinearValueConverter
+class FAUST_API ExpValueConverter : public LinearValueConverter
{
public:
ExpValueConverter(double umin, double umax, double fmin, double fmax)
@@ -768,7 +1054,7 @@ class ExpValueConverter : public LinearValueConverter
// Convert accelerometer or gyroscope values to Faust values
// Using an Up curve (curve 0)
//--------------------------------------------------------------------------------------
-class AccUpConverter : public UpdatableValueConverter
+class FAUST_API AccUpConverter : public UpdatableValueConverter
{
private:
Interpolator3pt fA2F;
@@ -804,7 +1090,7 @@ class AccUpConverter : public UpdatableValueConverter
// Convert accelerometer or gyroscope values to Faust values
// Using a Down curve (curve 1)
//--------------------------------------------------------------------------------------
-class AccDownConverter : public UpdatableValueConverter
+class FAUST_API AccDownConverter : public UpdatableValueConverter
{
private:
Interpolator3pt fA2F;
@@ -840,15 +1126,15 @@ class AccDownConverter : public UpdatableValueConverter
// Convert accelerometer or gyroscope values to Faust values
// Using an Up-Down curve (curve 2)
//--------------------------------------------------------------------------------------
-class AccUpDownConverter : public UpdatableValueConverter
+class FAUST_API AccUpDownConverter : public UpdatableValueConverter
{
private:
Interpolator3pt fA2F;
Interpolator fF2A;
public:
- AccUpDownConverter(double amin, double amid, double amax, double fmin,
- double /*fmid*/, double fmax)
+ AccUpDownConverter(double amin, double amid, double amax, double fmin, double /*fmid*/,
+ double fmax)
: fA2F(amin, amid, amax, fmin, fmax, fmin)
, fF2A(fmin, fmax, amin,
amax) // Special, pseudo inverse of a non monotonic function
@@ -877,15 +1163,15 @@ class AccUpDownConverter : public UpdatableValueConverter
// Convert accelerometer or gyroscope values to Faust values
// Using a Down-Up curve (curve 3)
//--------------------------------------------------------------------------------------
-class AccDownUpConverter : public UpdatableValueConverter
+class FAUST_API AccDownUpConverter : public UpdatableValueConverter
{
private:
Interpolator3pt fA2F;
Interpolator fF2A;
public:
- AccDownUpConverter(double amin, double amid, double amax, double fmin,
- double /*fmid*/, double fmax)
+ AccDownUpConverter(double amin, double amid, double amax, double fmin, double /*fmid*/,
+ double fmax)
: fA2F(amin, amid, amax, fmax, fmin, fmax)
, fF2A(fmin, fmax, amin,
amax) // Special, pseudo inverse of a non monotonic function
@@ -913,7 +1199,7 @@ class AccDownUpConverter : public UpdatableValueConverter
//--------------------------------------------------------------------------------------
// Base class for ZoneControl
//--------------------------------------------------------------------------------------
-class ZoneControl
+class FAUST_API ZoneControl
{
protected:
FAUSTFLOAT* fZone;
@@ -924,9 +1210,8 @@ class ZoneControl
virtual void update(double /*v*/) const {}
- virtual void setMappingValues(int /*curve*/, double /*amin*/, double /*amid*/,
- double /*amax*/, double /*min*/, double /*init*/,
- double /*max*/)
+ virtual void setMappingValues(int /*curve*/, double /*amin*/, double /*amid*/, double /*amax*/,
+ double /*min*/, double /*init*/, double /*max*/)
{
}
virtual void getMappingValues(double& /*amin*/, double& /*amid*/, double& /*amax*/) {}
@@ -942,7 +1227,7 @@ class ZoneControl
//--------------------------------------------------------------------------------------
// Useful to implement accelerometers metadata as a list of ZoneControl for each axes
//--------------------------------------------------------------------------------------
-class ConverterZoneControl : public ZoneControl
+class FAUST_API ConverterZoneControl : public ZoneControl
{
protected:
ValueConverter* fValueConverter;
@@ -957,7 +1242,10 @@ class ConverterZoneControl : public ZoneControl
delete fValueConverter;
} // Assuming fValueConverter is not kept elsewhere...
- virtual void update(double v) const { *fZone = fValueConverter->ui2faust(v); }
+ virtual void update(double v) const
+ {
+ *fZone = FAUSTFLOAT(fValueConverter->ui2faust(v));
+ }
ValueConverter* getConverter() { return fValueConverter; }
};
@@ -966,7 +1254,7 @@ class ConverterZoneControl : public ZoneControl
// Association of a zone and a four value converter, each one for each possible curve.
// Useful to implement accelerometers metadata as a list of ZoneControl for each axes
//--------------------------------------------------------------------------------------
-class CurveZoneControl : public ZoneControl
+class FAUST_API CurveZoneControl : public ZoneControl
{
private:
std::vector<UpdatableValueConverter*> fValueConverters;
@@ -989,15 +1277,14 @@ class CurveZoneControl : public ZoneControl
}
virtual ~CurveZoneControl()
{
- std::vector<UpdatableValueConverter*>::iterator it;
- for (it = fValueConverters.begin(); it != fValueConverters.end(); it++) {
- delete (*it);
+ for (const auto& it : fValueConverters) {
+ delete it;
}
}
void update(double v) const
{
if (fValueConverters[fCurve]->getActive())
- *fZone = fValueConverters[fCurve]->ui2faust(v);
+ *fZone = FAUSTFLOAT(fValueConverters[fCurve]->ui2faust(v));
}
void setMappingValues(int curve, double amin, double amid, double amax, double min,
@@ -1014,16 +1301,15 @@ class CurveZoneControl : public ZoneControl
void setActive(bool on_off)
{
- std::vector<UpdatableValueConverter*>::iterator it;
- for (it = fValueConverters.begin(); it != fValueConverters.end(); it++) {
- (*it)->setActive(on_off);
+ for (const auto& it : fValueConverters) {
+ it->setActive(on_off);
}
}
int getCurve() { return fCurve; }
};
-class ZoneReader
+class FAUST_API ZoneReader
{
private:
FAUSTFLOAT* fZone;
@@ -1043,6 +1329,8 @@ class ZoneReader
#endif
/************************** END ValueConverter.h **************************/
+typedef unsigned int uint;
+
class APIUI
: public PathBuilder
, public Meta
@@ -1058,22 +1346,42 @@ class APIUI
kHBargraph,
kVBargraph
};
+ enum Type { kAcc = 0, kGyr = 1, kNoType };
protected:
- enum { kLin = 0, kLog = 1, kExp = 2 };
-
- int fNumParameters;
- std::vector<std::string> fPaths;
- std::vector<std::string> fLabels;
- std::map<std::string, int> fPathMap;
- std::map<std::string, int> fLabelMap;
- std::vector<ValueConverter*> fConversion;
- std::vector<FAUSTFLOAT*> fZone;
- std::vector<FAUSTFLOAT> fInit;
- std::vector<FAUSTFLOAT> fMin;
- std::vector<FAUSTFLOAT> fMax;
- std::vector<FAUSTFLOAT> fStep;
- std::vector<ItemType> fItemType;
+ enum Mapping { kLin = 0, kLog = 1, kExp = 2 };
+
+ struct Item {
+ std::string fLabel;
+ std::string fShortname;
+ std::string fPath;
+ ValueConverter* fConversion;
+ FAUSTFLOAT* fZone;
+ FAUSTFLOAT fInit;
+ FAUSTFLOAT fMin;
+ FAUSTFLOAT fMax;
+ FAUSTFLOAT fStep;
+ ItemType fItemType;
+
+ Item(const std::string& label, const std::string& short_name,
+ const std::string& path, ValueConverter* conversion, FAUSTFLOAT* zone,
+ FAUSTFLOAT init, FAUSTFLOAT min, FAUSTFLOAT max, FAUSTFLOAT step,
+ ItemType item_type)
+ : fLabel(label)
+ , fShortname(short_name)
+ , fPath(path)
+ , fConversion(conversion)
+ , fZone(zone)
+ , fInit(init)
+ , fMin(min)
+ , fMax(max)
+ , fStep(step)
+ , fItemType(item_type)
+ {
+ }
+ };
+ std::vector<Item> fItems;
+
std::vector<std::map<std::string, std::string> > fMetaData;
std::vector<ZoneControl*> fAcc[3];
std::vector<ZoneControl*> fGyr[3];
@@ -1100,33 +1408,31 @@ class APIUI
ItemType type)
{
std::string path = buildPath(label);
- fPathMap[path] = fLabelMap[label] = fNumParameters++;
- fPaths.push_back(path);
- fLabels.push_back(label);
- fZone.push_back(zone);
- fInit.push_back(init);
- fMin.push_back(min);
- fMax.push_back(max);
- fStep.push_back(step);
- fItemType.push_back(type);
+ fFullPaths.push_back(path);
// handle scale metadata
+ ValueConverter* converter = nullptr;
switch (fCurrentScale) {
case kLin:
- fConversion.push_back(new LinearValueConverter(0, 1, min, max));
+ converter = new LinearValueConverter(0, 1, min, max);
break;
case kLog:
- fConversion.push_back(new LogValueConverter(0, 1, min, max));
+ converter = new LogValueConverter(0, 1, min, max);
break;
case kExp:
- fConversion.push_back(new ExpValueConverter(0, 1, min, max));
+ converter = new ExpValueConverter(0, 1, min, max);
break;
}
fCurrentScale = kLin;
+ fItems.push_back(
+ Item(label, "", path, converter, zone, init, min, max, step, type));
+
if (fCurrentAcc.size() > 0 && fCurrentGyr.size() > 0) {
- std::cerr << "warning : 'acc' and 'gyr' metadata used for the same " << label
- << " parameter !!\n";
+ fprintf(
+ stderr,
+ "warning : 'acc' and 'gyr' metadata used for the same %s parameter !!\n",
+ label);
}
// handle acc metadata "...[acc : <axe> <curve> <amin> <amid> <amax>]..."
@@ -1141,7 +1447,7 @@ class APIUI
fAcc[axe].push_back(
new CurveZoneControl(zone, curve, amin, amid, amax, min, init, max));
} else {
- std::cerr << "incorrect acc metadata : " << fCurrentAcc << std::endl;
+ fprintf(stderr, "incorrect acc metadata : %s \n", fCurrentAcc.c_str());
}
fCurrentAcc = "";
}
@@ -1158,31 +1464,31 @@ class APIUI
fGyr[axe].push_back(
new CurveZoneControl(zone, curve, amin, amid, amax, min, init, max));
} else {
- std::cerr << "incorrect gyr metadata : " << fCurrentGyr << std::endl;
+ fprintf(stderr, "incorrect gyr metadata : %s \n", fCurrentGyr.c_str());
}
fCurrentGyr = "";
}
// handle screencolor metadata "...[screencolor:red|green|blue|white]..."
if (fCurrentColor.size() > 0) {
- if ((fCurrentColor == "red") && (fRedReader == 0)) {
+ if ((fCurrentColor == "red") && (fRedReader == nullptr)) {
fRedReader = new ZoneReader(zone, min, max);
fHasScreenControl = true;
- } else if ((fCurrentColor == "green") && (fGreenReader == 0)) {
+ } else if ((fCurrentColor == "green") && (fGreenReader == nullptr)) {
fGreenReader = new ZoneReader(zone, min, max);
fHasScreenControl = true;
- } else if ((fCurrentColor == "blue") && (fBlueReader == 0)) {
+ } else if ((fCurrentColor == "blue") && (fBlueReader == nullptr)) {
fBlueReader = new ZoneReader(zone, min, max);
fHasScreenControl = true;
- } else if ((fCurrentColor == "white") && (fRedReader == 0)
- && (fGreenReader == 0) && (fBlueReader == 0)) {
+ } else if ((fCurrentColor == "white") && (fRedReader == nullptr)
+ && (fGreenReader == nullptr) && (fBlueReader == nullptr)) {
fRedReader = new ZoneReader(zone, min, max);
fGreenReader = new ZoneReader(zone, min, max);
fBlueReader = new ZoneReader(zone, min, max);
fHasScreenControl = true;
} else {
- std::cerr << "incorrect screencolor metadata : " << fCurrentColor
- << std::endl;
+ fprintf(stderr, "incorrect screencolor metadata : %s \n",
+ fCurrentColor.c_str());
}
}
fCurrentColor = "";
@@ -1193,7 +1499,7 @@ class APIUI
int getZoneIndex(std::vector<ZoneControl*>* table, int p, int val)
{
- FAUSTFLOAT* zone = fZone[p];
+ FAUSTFLOAT* zone = fItems[uint(p)].fZone;
for (size_t i = 0; i < table[val].size(); i++) {
if (zone == table[val][i]->getZone())
return int(i);
@@ -1210,11 +1516,11 @@ class APIUI
// Deactivates everywhere..
if (id1 != -1)
- table[0][id1]->setActive(false);
+ table[0][uint(id1)]->setActive(false);
if (id2 != -1)
- table[1][id2]->setActive(false);
+ table[1][uint(id2)]->setActive(false);
if (id3 != -1)
- table[2][id3]->setActive(false);
+ table[2][uint(id3)]->setActive(false);
if (val == -1) { // Means: no more mapping...
// So stay all deactivated...
@@ -1222,14 +1528,16 @@ class APIUI
int id4 = getZoneIndex(table, p, val);
if (id4 != -1) {
// Reactivate the one we edit...
- table[val][id4]->setMappingValues(curve, amin, amid, amax, fMin[p],
- fInit[p], fMax[p]);
- table[val][id4]->setActive(true);
+ table[val][uint(id4)]->setMappingValues(
+ curve, amin, amid, amax, fItems[uint(p)].fMin, fItems[uint(p)].fInit,
+ fItems[uint(p)].fMax);
+ table[val][uint(id4)]->setActive(true);
} else {
// Allocate a new CurveZoneControl which is 'active' by default
- FAUSTFLOAT* zone = fZone[p];
- table[val].push_back(new CurveZoneControl(zone, curve, amin, amid, amax,
- fMin[p], fInit[p], fMax[p]));
+ FAUSTFLOAT* zone = fItems[uint(p)].fZone;
+ table[val].push_back(new CurveZoneControl(
+ zone, curve, amin, amid, amax, fItems[uint(p)].fMin,
+ fItems[uint(p)].fInit, fItems[uint(p)].fMax));
}
}
}
@@ -1243,16 +1551,16 @@ class APIUI
if (id1 != -1) {
val = 0;
- curve = table[val][id1]->getCurve();
- table[val][id1]->getMappingValues(amin, amid, amax);
+ curve = table[val][uint(id1)]->getCurve();
+ table[val][uint(id1)]->getMappingValues(amin, amid, amax);
} else if (id2 != -1) {
val = 1;
- curve = table[val][id2]->getCurve();
- table[val][id2]->getMappingValues(amin, amid, amax);
+ curve = table[val][uint(id2)]->getCurve();
+ table[val][uint(id2)]->getMappingValues(amin, amid, amax);
} else if (id3 != -1) {
val = 2;
- curve = table[val][id3]->getCurve();
- table[val][id3]->getMappingValues(amin, amid, amax);
+ curve = table[val][uint(id3)]->getCurve();
+ table[val][uint(id3)]->getMappingValues(amin, amid, amax);
} else {
val = -1; // No mapping
curve = 0;
@@ -1263,26 +1571,23 @@ class APIUI
}
public:
- enum Type { kAcc = 0, kGyr = 1, kNoType };
-
APIUI()
- : fNumParameters(0)
- , fHasScreenControl(false)
- , fRedReader(0)
- , fGreenReader(0)
- , fBlueReader(0)
+ : fHasScreenControl(false)
+ , fRedReader(nullptr)
+ , fGreenReader(nullptr)
+ , fBlueReader(nullptr)
, fCurrentScale(kLin)
{
}
virtual ~APIUI()
{
- for (auto& it : fConversion)
- delete it;
+ for (const auto& it : fItems)
+ delete it.fConversion;
for (int i = 0; i < 3; i++) {
- for (auto& it : fAcc[i])
+ for (const auto& it : fAcc[i])
delete it;
- for (auto& it : fGyr[i])
+ for (const auto& it : fGyr[i])
delete it;
}
delete fRedReader;
@@ -1295,7 +1600,18 @@ class APIUI
virtual void openTabBox(const char* label) { pushLabel(label); }
virtual void openHorizontalBox(const char* label) { pushLabel(label); }
virtual void openVerticalBox(const char* label) { pushLabel(label); }
- virtual void closeBox() { popLabel(); }
+ virtual void closeBox()
+ {
+ if (popLabel()) {
+ // Shortnames can be computed when all fullnames are known
+ computeShortNames();
+ // Fill 'shortname' field for each item
+ for (const auto& it : fFull2Short) {
+ int index = getParamIndex(it.first.c_str());
+ fItems[index].fShortname = it.second;
+ }
+ }
+ }
// -- active widgets
@@ -1332,13 +1648,13 @@ class APIUI
virtual void addHorizontalBargraph(const char* label, FAUSTFLOAT* zone,
FAUSTFLOAT min, FAUSTFLOAT max)
{
- addParameter(label, zone, min, min, max, (max - min) / 1000.0, kHBargraph);
+ addParameter(label, zone, min, min, max, (max - min) / 1000.0f, kHBargraph);
}
virtual void addVerticalBargraph(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT min,
FAUSTFLOAT max)
{
- addParameter(label, zone, min, min, max, (max - min) / 1000.0, kVBargraph);
+ addParameter(label, zone, min, min, max, (max - min) / 1000.0f, kVBargraph);
}
// -- soundfiles
@@ -1381,23 +1697,25 @@ class APIUI
//-------------------------------------------------------------------------------
// Simple API part
//-------------------------------------------------------------------------------
- int getParamsCount() { return fNumParameters; }
- int getParamIndex(const char* path)
+ int getParamsCount() { return int(fItems.size()); }
+
+ int getParamIndex(const char* path_aux)
{
- if (fPathMap.find(path) != fPathMap.end()) {
- return fPathMap[path];
- } else if (fLabelMap.find(path) != fLabelMap.end()) {
- return fLabelMap[path];
- } else {
- return -1;
- }
+ std::string path = std::string(path_aux);
+ auto it = find_if(fItems.begin(), fItems.end(), [=](const Item& it) {
+ return (it.fLabel == path) || (it.fShortname == path) || (it.fPath == path);
+ });
+ return (it != fItems.end()) ? int(it - fItems.begin()) : -1;
}
- const char* getParamAddress(int p) { return fPaths[p].c_str(); }
- const char* getParamLabel(int p) { return fLabels[p].c_str(); }
+
+ const char* getParamLabel(int p) { return fItems[uint(p)].fLabel.c_str(); }
+ const char* getParamShortname(int p) { return fItems[uint(p)].fShortname.c_str(); }
+ const char* getParamAddress(int p) { return fItems[uint(p)].fPath.c_str(); }
+
std::map<const char*, const char*> getMetadata(int p)
{
std::map<const char*, const char*> res;
- std::map<std::string, std::string> metadata = fMetaData[p];
+ std::map<std::string, std::string> metadata = fMetaData[uint(p)];
for (const auto& it : metadata) {
res[it.first.c_str()] = it.second.c_str();
}
@@ -1406,26 +1724,62 @@ class APIUI
const char* getMetadata(int p, const char* key)
{
- return (fMetaData[p].find(key) != fMetaData[p].end()) ? fMetaData[p][key].c_str()
- : "";
+ return (fMetaData[uint(p)].find(key) != fMetaData[uint(p)].end())
+ ? fMetaData[uint(p)][key].c_str()
+ : "";
}
- FAUSTFLOAT getParamMin(int p) { return fMin[p]; }
- FAUSTFLOAT getParamMax(int p) { return fMax[p]; }
- FAUSTFLOAT getParamStep(int p) { return fStep[p]; }
- FAUSTFLOAT getParamInit(int p) { return fInit[p]; }
+ FAUSTFLOAT getParamMin(int p) { return fItems[uint(p)].fMin; }
+ FAUSTFLOAT getParamMax(int p) { return fItems[uint(p)].fMax; }
+ FAUSTFLOAT getParamStep(int p) { return fItems[uint(p)].fStep; }
+ FAUSTFLOAT getParamInit(int p) { return fItems[uint(p)].fInit; }
- FAUSTFLOAT* getParamZone(int p) { return fZone[p]; }
- FAUSTFLOAT getParamValue(int p) { return *fZone[p]; }
- void setParamValue(int p, FAUSTFLOAT v) { *fZone[p] = v; }
+ FAUSTFLOAT* getParamZone(int p) { return fItems[uint(p)].fZone; }
- double getParamRatio(int p) { return fConversion[p]->faust2ui(*fZone[p]); }
- void setParamRatio(int p, double r) { *fZone[p] = fConversion[p]->ui2faust(r); }
+ FAUSTFLOAT getParamValue(int p) { return *fItems[uint(p)].fZone; }
+ FAUSTFLOAT getParamValue(const char* path)
+ {
+ int index = getParamIndex(path);
+ if (index >= 0) {
+ return getParamValue(index);
+ } else {
+ fprintf(stderr, "getParamValue : '%s' not found\n",
+ (path == nullptr ? "NULL" : path));
+ return FAUSTFLOAT(0);
+ }
+ }
- double value2ratio(int p, double r) { return fConversion[p]->faust2ui(r); }
- double ratio2value(int p, double r) { return fConversion[p]->ui2faust(r); }
+ void setParamValue(int p, FAUSTFLOAT v) { *fItems[uint(p)].fZone = v; }
+ void setParamValue(const char* path, FAUSTFLOAT v)
+ {
+ int index = getParamIndex(path);
+ if (index >= 0) {
+ setParamValue(index, v);
+ } else {
+ fprintf(stderr, "setParamValue : '%s' not found\n",
+ (path == nullptr ? "NULL" : path));
+ }
+ }
+
+ double getParamRatio(int p)
+ {
+ return fItems[uint(p)].fConversion->faust2ui(*fItems[uint(p)].fZone);
+ }
+ void setParamRatio(int p, double r)
+ {
+ *fItems[uint(p)].fZone = FAUSTFLOAT(fItems[uint(p)].fConversion->ui2faust(r));
+ }
+
+ double value2ratio(int p, double r)
+ {
+ return fItems[uint(p)].fConversion->faust2ui(r);
+ }
+ double ratio2value(int p, double r)
+ {
+ return fItems[uint(p)].fConversion->ui2faust(r);
+ }
/**
- * Return the control type (kAcc, kGyr, or -1) for a given parameter
+ * Return the control type (kAcc, kGyr, or -1) for a given parameter.
*
* @param p - the UI parameter index
*
@@ -1447,13 +1801,13 @@ class APIUI
/**
* Return the Item type (kButton = 0, kCheckButton, kVSlider, kHSlider, kNumEntry,
- * kHBargraph, kVBargraph) for a given parameter
+ * kHBargraph, kVBargraph) for a given parameter.
*
* @param p - the UI parameter index
*
* @return the Item type
*/
- ItemType getParamItemType(int p) { return fItemType[p]; }
+ ItemType getParamItemType(int p) { return fItems[uint(p)].fItemType; }
/**
* Set a new value coming from an accelerometer, propagate it to all relevant
@@ -1493,7 +1847,7 @@ class APIUI
* given UI parameter.
*
* @param p - the UI parameter index
- * @param acc - 0 for X gyroscope, 1 for Y gyroscope, 2 for Z gyroscope (-1 means "no
+ * @param gyr - 0 for X gyroscope, 1 for Y gyroscope, 2 for Z gyroscope (-1 means "no
* mapping")
* @param curve - between 0 and 3
* @param amin - mapping 'min' point
@@ -1558,7 +1912,7 @@ class APIUI
}
/**
- * Get the number of FAUSTFLOAT* zones controlled with the accelerometer
+ * Get the number of FAUSTFLOAT* zones controlled with the accelerometer.
*
* @param acc - 0 for X accelerometer, 1 for Y accelerometer, 2 for Z accelerometer
* @return the number of zones
@@ -1567,7 +1921,7 @@ class APIUI
int getAccCount(int acc) { return (acc >= 0 && acc < 3) ? int(fAcc[acc].size()) : 0; }
/**
- * Get the number of FAUSTFLOAT* zones controlled with the gyroscope
+ * Get the number of FAUSTFLOAT* zones controlled with the gyroscope.
*
* @param gyr - 0 for X gyroscope, 1 for Y gyroscope, 2 for Z gyroscope
* @param the number of zones
@@ -1604,8 +1958,11 @@ class APIUI
#define FAUSTFLOAT float
#endif
+#include <math.h>
+
#include <algorithm>
#include <cmath>
+#include <cstdint>
#ifndef FAUSTCLASS
#define FAUSTCLASS compressordsp
@@ -1616,20 +1973,24 @@ class APIUI
#define exp10 __exp10
#endif
+#if defined(_WIN32)
+#define RESTRICT __restrict
+#else
+#define RESTRICT __restrict__
+#endif
+
class compressordsp : public dsp
{
private:
FAUSTFLOAT fCheckbox0;
FAUSTFLOAT fHslider0;
+ FAUSTFLOAT fHslider1;
int fSampleRate;
float fConst0;
- FAUSTFLOAT fHslider1;
FAUSTFLOAT fHslider2;
FAUSTFLOAT fHslider3;
- float fRec5[2];
- float fRec4[2];
- FAUSTFLOAT fHslider4;
float fRec3[2];
+ FAUSTFLOAT fHslider4;
float fRec2[2];
float fRec1[2];
float fRec0[2];
@@ -1638,11 +1999,17 @@ class compressordsp : public dsp
public:
void metadata(Meta* m)
{
+ m->declare("analyzers.lib/amp_follower_ar:author",
+ "Jonatan Liljedahl, revised by Romain Michon");
m->declare("analyzers.lib/name", "Faust Analyzer Library");
- m->declare("analyzers.lib/version", "0.1");
+ m->declare("analyzers.lib/version", "0.2");
m->declare("author", "Julius Smith");
+ m->declare("basics.lib/bypass1:author", "Julius Smith");
m->declare("basics.lib/name", "Faust Basic Element Library");
- m->declare("basics.lib/version", "0.1");
+ m->declare("basics.lib/version", "0.8");
+ m->declare("compile_options",
+ "-a faust2header.cpp -lang cpp -i -inpl -cn compressordsp -es 1 -mcd "
+ "16 -single -ftz 0");
m->declare("compressors.lib/compression_gain_mono:author", "Julius O. Smith III");
m->declare(
"compressors.lib/compression_gain_mono:copyright",
@@ -1662,7 +2029,7 @@ class compressordsp : public dsp
m->declare("compressors.lib/compressor_mono:license",
"MIT-style STK-4.3 license");
m->declare("compressors.lib/name", "Faust Compressor Effect Library");
- m->declare("compressors.lib/version", "0.0");
+ m->declare("compressors.lib/version", "0.2");
m->declare("description",
"Compressor demo application, adapted from the Faust Library's "
"dm.compressor_demo in demos.lib");
@@ -1674,47 +2041,20 @@ class compressordsp : public dsp
m->declare("maths.lib/copyright", "GRAME");
m->declare("maths.lib/license", "LGPL with exception");
m->declare("maths.lib/name", "Faust Math Library");
- m->declare("maths.lib/version", "2.3");
+ m->declare("maths.lib/version", "2.5");
m->declare("name", "compressor");
m->declare("platform.lib/name", "Generic Platform Library");
- m->declare("platform.lib/version", "0.1");
+ m->declare("platform.lib/version", "0.2");
m->declare("signals.lib/name", "Faust Signal Routing Library");
- m->declare("signals.lib/version", "0.0");
+ m->declare("signals.lib/onePoleSwitching:author",
+ "Jonatan Liljedahl, revised by Dario Sanfilippo");
+ m->declare("signals.lib/onePoleSwitching:licence", "STK-4.3");
+ m->declare("signals.lib/version", "0.3");
m->declare("version", "0.0");
}
virtual int getNumInputs() { return 1; }
virtual int getNumOutputs() { return 1; }
- virtual int getInputRate(int channel)
- {
- int rate;
- switch ((channel)) {
- case 0: {
- rate = 1;
- break;
- }
- default: {
- rate = -1;
- break;
- }
- }
- return rate;
- }
- virtual int getOutputRate(int channel)
- {
- int rate;
- switch ((channel)) {
- case 0: {
- rate = 1;
- break;
- }
- default: {
- rate = -1;
- break;
- }
- }
- return rate;
- }
static void classInit(int /*sample_rate*/) {}
@@ -1722,39 +2062,32 @@ class compressordsp : public dsp
{
fSampleRate = sample_rate;
fConst0 =
- (1.0f
- / std::min<float>(192000.0f, std::max<float>(1.0f, float(fSampleRate))));
+ 1.0f / std::min<float>(192000.0f, std::max<float>(1.0f, float(fSampleRate)));
}
virtual void instanceResetUserInterface()
{
fCheckbox0 = FAUSTFLOAT(0.0f);
fHslider0 = FAUSTFLOAT(2.0f);
- fHslider1 = FAUSTFLOAT(15.0f);
- fHslider2 = FAUSTFLOAT(2.0f);
- fHslider3 = FAUSTFLOAT(40.0f);
+ fHslider1 = FAUSTFLOAT(2.0f);
+ fHslider2 = FAUSTFLOAT(40.0f);
+ fHslider3 = FAUSTFLOAT(15.0f);
fHslider4 = FAUSTFLOAT(-24.0f);
}
virtual void instanceClear()
{
- for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) {
- fRec5[l0] = 0.0f;
- }
- for (int l1 = 0; (l1 < 2); l1 = (l1 + 1)) {
- fRec4[l1] = 0.0f;
- }
- for (int l2 = 0; (l2 < 2); l2 = (l2 + 1)) {
- fRec3[l2] = 0.0f;
+ for (int l0 = 0; l0 < 2; l0 = l0 + 1) {
+ fRec3[l0] = 0.0f;
}
- for (int l3 = 0; (l3 < 2); l3 = (l3 + 1)) {
- fRec2[l3] = 0.0f;
+ for (int l1 = 0; l1 < 2; l1 = l1 + 1) {
+ fRec2[l1] = 0.0f;
}
- for (int l4 = 0; (l4 < 2); l4 = (l4 + 1)) {
- fRec1[l4] = 0.0f;
+ for (int l2 = 0; l2 < 2; l2 = l2 + 1) {
+ fRec1[l2] = 0.0f;
}
- for (int l5 = 0; (l5 < 2); l5 = (l5 + 1)) {
- fRec0[l5] = 0.0f;
+ for (int l3 = 0; l3 < 2; l3 = l3 + 1) {
+ fRec0[l3] = 0.0f;
}
}
@@ -1792,54 +2125,58 @@ class compressordsp : public dsp
ui_interface->declare(&fHbargraph0, "1", "");
ui_interface->declare(&fHbargraph0, "tooltip", "Compressor gain in dB");
ui_interface->declare(&fHbargraph0, "unit", "dB");
- ui_interface->addHorizontalBargraph("Compressor Gain", &fHbargraph0, -50.0f,
- 10.0f);
+ ui_interface->addHorizontalBargraph("Compressor Gain", &fHbargraph0,
+ FAUSTFLOAT(-50.0f), FAUSTFLOAT(10.0f));
ui_interface->closeBox();
ui_interface->declare(0, "1", "");
ui_interface->openHorizontalBox("0x00");
ui_interface->declare(0, "3", "");
ui_interface->openHorizontalBox("Compression Control");
- ui_interface->declare(&fHslider2, "0", "");
- ui_interface->declare(&fHslider2, "style", "knob");
+ ui_interface->declare(&fHslider1, "0", "");
+ ui_interface->declare(&fHslider1, "style", "knob");
ui_interface->declare(
- &fHslider2, "tooltip",
+ &fHslider1, "tooltip",
"A compression Ratio of N means that for each N dB increase in input "
"signal level above Threshold, the output level goes up 1 dB");
- ui_interface->addHorizontalSlider("Ratio", &fHslider2, 2.0f, 1.0f, 20.0f,
- 0.100000001f);
+ ui_interface->addHorizontalSlider("Ratio", &fHslider1, FAUSTFLOAT(2.0f),
+ FAUSTFLOAT(1.0f), FAUSTFLOAT(20.0f),
+ FAUSTFLOAT(0.100000001f));
ui_interface->declare(&fHslider4, "1", "");
ui_interface->declare(&fHslider4, "style", "knob");
ui_interface->declare(&fHslider4, "tooltip",
"When the signal level exceeds the Threshold (in dB), its "
"level is compressed according to the Ratio");
ui_interface->declare(&fHslider4, "unit", "dB");
- ui_interface->addHorizontalSlider("Threshold", &fHslider4, -24.0f, -100.0f, 10.0f,
- 0.100000001f);
+ ui_interface->addHorizontalSlider("Threshold", &fHslider4, FAUSTFLOAT(-24.0f),
+ FAUSTFLOAT(-100.0f), FAUSTFLOAT(10.0f),
+ FAUSTFLOAT(0.100000001f));
ui_interface->closeBox();
ui_interface->declare(0, "4", "");
ui_interface->openHorizontalBox("Compression Response");
- ui_interface->declare(&fHslider1, "1", "");
- ui_interface->declare(&fHslider1, "scale", "log");
- ui_interface->declare(&fHslider1, "style", "knob");
+ ui_interface->declare(&fHslider3, "1", "");
+ ui_interface->declare(&fHslider3, "scale", "log");
+ ui_interface->declare(&fHslider3, "style", "knob");
ui_interface->declare(
- &fHslider1, "tooltip",
+ &fHslider3, "tooltip",
"Time constant in ms (1/e smoothing time) for the compression gain "
"to approach (exponentially) a new lower target level (the compression "
" `kicking in')");
- ui_interface->declare(&fHslider1, "unit", "ms");
- ui_interface->addHorizontalSlider("Attack", &fHslider1, 15.0f, 1.0f, 1000.0f,
- 0.100000001f);
- ui_interface->declare(&fHslider3, "2", "");
- ui_interface->declare(&fHslider3, "scale", "log");
- ui_interface->declare(&fHslider3, "style", "knob");
+ ui_interface->declare(&fHslider3, "unit", "ms");
+ ui_interface->addHorizontalSlider("Attack", &fHslider3, FAUSTFLOAT(15.0f),
+ FAUSTFLOAT(1.0f), FAUSTFLOAT(1000.0f),
+ FAUSTFLOAT(0.100000001f));
+ ui_interface->declare(&fHslider2, "2", "");
+ ui_interface->declare(&fHslider2, "scale", "log");
+ ui_interface->declare(&fHslider2, "style", "knob");
ui_interface->declare(
- &fHslider3, "tooltip",
+ &fHslider2, "tooltip",
"Time constant in ms (1/e smoothing time) for the compression gain "
"to approach (exponentially) a new higher target level (the compression "
" 'releasing')");
- ui_interface->declare(&fHslider3, "unit", "ms");
- ui_interface->addHorizontalSlider("Release", &fHslider3, 40.0f, 1.0f, 1000.0f,
- 0.100000001f);
+ ui_interface->declare(&fHslider2, "unit", "ms");
+ ui_interface->addHorizontalSlider("Release", &fHslider2, FAUSTFLOAT(40.0f),
+ FAUSTFLOAT(1.0f), FAUSTFLOAT(1000.0f),
+ FAUSTFLOAT(0.100000001f));
ui_interface->closeBox();
ui_interface->closeBox();
ui_interface->declare(&fHslider0, "5", "");
@@ -1848,8 +2185,9 @@ class compressordsp : public dsp
"The compressed-signal output level is increased by this amount (in "
"dB) to make up for the level lost due to compression");
ui_interface->declare(&fHslider0, "unit", "dB");
- ui_interface->addHorizontalSlider("MakeUpGain", &fHslider0, 2.0f, -96.0f, 96.0f,
- 0.100000001f);
+ ui_interface->addHorizontalSlider("MakeUpGain", &fHslider0, FAUSTFLOAT(2.0f),
+ FAUSTFLOAT(-96.0f), FAUSTFLOAT(96.0f),
+ FAUSTFLOAT(0.100000001f));
ui_interface->closeBox();
}
@@ -1858,54 +2196,58 @@ class compressordsp : public dsp
FAUSTFLOAT* input0 = inputs[0];
FAUSTFLOAT* output0 = outputs[0];
int iSlow0 = int(float(fCheckbox0));
- float fSlow1 = std::pow(10.0f, (0.0500000007f * float(fHslider0)));
- float fSlow2 = std::max<float>(fConst0, (0.00100000005f * float(fHslider1)));
- float fSlow3 = (0.5f * fSlow2);
- int iSlow4 = (std::fabs(fSlow3) < 1.1920929e-07f);
- float fSlow5 =
- (iSlow4 ? 0.0f : std::exp((0.0f - (fConst0 / (iSlow4 ? 1.0f : fSlow3)))));
- float fSlow6 =
- ((1.0f / std::max<float>(1.00000001e-07f, float(fHslider2))) + -1.0f);
- int iSlow7 = (std::fabs(fSlow2) < 1.1920929e-07f);
- float fSlow8 =
- (iSlow7 ? 0.0f : std::exp((0.0f - (fConst0 / (iSlow7 ? 1.0f : fSlow2)))));
- float fSlow9 = std::max<float>(fConst0, (0.00100000005f * float(fHslider3)));
- int iSlow10 = (std::fabs(fSlow9) < 1.1920929e-07f);
- float fSlow11 =
- (iSlow10 ? 0.0f : std::exp((0.0f - (fConst0 / (iSlow10 ? 1.0f : fSlow9)))));
- float fSlow12 = float(fHslider4);
- float fSlow13 = (1.0f - fSlow5);
- for (int i = 0; (i < count); i = (i + 1)) {
- float fTemp0 = float(input0[i]);
- float fTemp1 = (iSlow0 ? 0.0f : fTemp0);
+ float fSlow1 = std::pow(10.0f, 0.0500000007f * float(fHslider0));
+ float fSlow2 = 1.0f / std::max<float>(1.1920929e-07f, float(fHslider1)) + -1.0f;
+ float fSlow3 = std::max<float>(fConst0, 0.00100000005f * float(fHslider2));
+ int iSlow4 = std::fabs(fSlow3) < 1.1920929e-07f;
+ float fThen2 = std::exp(0.0f - fConst0 / ((iSlow4) ? 1.0f : fSlow3));
+ float fSlow5 = ((iSlow4) ? 0.0f : fThen2);
+ float fSlow6 = std::max<float>(fConst0, 0.00100000005f * float(fHslider3));
+ int iSlow7 = std::fabs(fSlow6) < 1.1920929e-07f;
+ float fThen4 = std::exp(0.0f - fConst0 / ((iSlow7) ? 1.0f : fSlow6));
+ float fSlow8 = ((iSlow7) ? 0.0f : fThen4);
+ float fSlow9 = float(fHslider4);
+ float fSlow10 = 0.5f * fSlow6;
+ int iSlow11 = std::fabs(fSlow10) < 1.1920929e-07f;
+ float fThen7 = std::exp(0.0f - fConst0 / ((iSlow11) ? 1.0f : fSlow10));
+ float fSlow12 = ((iSlow11) ? 0.0f : fThen7);
+ float fSlow13 = 1.0f - fSlow12;
+ for (int i0 = 0; i0 < count; i0 = i0 + 1) {
+ float fTemp0 = float(input0[i0]);
+ float fTemp1 = ((iSlow0) ? 0.0f : fTemp0);
float fTemp2 = std::fabs(fTemp1);
- float fTemp3 = ((fRec4[1] > fTemp2) ? fSlow11 : fSlow8);
- fRec5[0] = ((fRec5[1] * fTemp3) + (fTemp2 * (1.0f - fTemp3)));
- fRec4[0] = fRec5[0];
- fRec3[0] =
- ((fRec3[1] * fSlow5)
- + (fSlow6
- * (std::max<float>(((20.0f * std::log10(fRec4[0])) - fSlow12), 0.0f)
- * fSlow13)));
- float fTemp4 = (fTemp1 * std::pow(10.0f, (0.0500000007f * fRec3[0])));
- float fTemp5 = std::fabs(fTemp4);
- float fTemp6 = ((fRec1[1] > fTemp5) ? fSlow11 : fSlow8);
- fRec2[0] = ((fRec2[1] * fTemp6) + (fTemp5 * (1.0f - fTemp6)));
- fRec1[0] = fRec2[0];
+ float fTemp3 = ((fTemp2 > fRec3[1]) ? fSlow8 : fSlow5);
+ fRec3[0] = fTemp2 * (1.0f - fTemp3) + fRec3[1] * fTemp3;
+ fRec2[0] =
+ fSlow2
+ * std::max<float>(
+ 20.0f * std::log10(std::max<float>(1.17549435e-38f, fRec3[0]))
+ - fSlow9,
+ 0.0f)
+ * fSlow13
+ + fSlow12 * fRec2[1];
+ float fTemp4 = fTemp1 * std::pow(10.0f, 0.0500000007f * fRec2[0]);
+ float fTemp5 = std::fabs(std::fabs(fTemp4));
+ float fTemp6 = ((fTemp5 > fRec1[1]) ? fSlow8 : fSlow5);
+ fRec1[0] = fTemp5 * (1.0f - fTemp6) + fRec1[1] * fTemp6;
fRec0[0] =
- ((fSlow5 * fRec0[1])
- + (fSlow6
- * (std::max<float>(((20.0f * std::log10(fRec1[0])) - fSlow12), 0.0f)
- * fSlow13)));
+ fSlow2
+ * std::max<float>(
+ 20.0f * std::log10(std::max<float>(1.17549435e-38f, fRec1[0]))
+ - fSlow9,
+ 0.0f)
+ * fSlow13
+ + fSlow12 * fRec0[1];
fHbargraph0 = FAUSTFLOAT(
- (20.0f * std::log10(std::pow(10.0f, (0.0500000007f * fRec0[0])))));
- output0[i] = FAUSTFLOAT((iSlow0 ? fTemp0 : (fSlow1 * fTemp4)));
- fRec5[1] = fRec5[0];
- fRec4[1] = fRec4[0];
- fRec3[1] = fRec3[0];
- fRec2[1] = fRec2[0];
- fRec1[1] = fRec1[0];
- fRec0[1] = fRec0[0];
+ 20.0f
+ * std::log10(std::max<float>(1.17549435e-38f,
+ std::pow(10.0f, 0.0500000007f * fRec0[0]))));
+ float fThen9 = fSlow1 * fTemp4;
+ output0[i0] = FAUSTFLOAT(((iSlow0) ? fTemp0 : fThen9));
+ fRec3[1] = fRec3[0];
+ fRec2[1] = fRec2[0];
+ fRec1[1] = fRec1[0];
+ fRec0[1] = fRec0[0];
}
}
};
diff --git a/src/dblsqd/feed.cpp b/src/dblsqd/feed.cpp
index a24215e..6a71fc2 100644
--- a/src/dblsqd/feed.cpp
+++ b/src/dblsqd/feed.cpp
@@ -277,14 +277,15 @@ void Feed::handleDownloadReadyRead()
QString host = url.host();
if (host.contains("github", Qt::CaseInsensitive) && url.hasQuery()) {
QString query = url.query();
- QRegExp rx("filename%3D(.*)(&|$)");
- rx.setMinimal(true);
- if (rx.indexIn(query) > -1) {
- fileName = rx.cap(1);
+ QRegularExpression rx("filename%3D(.*?)(&|$)");
+ QRegularExpressionMatch match = rx.match(query);
+ if (match.hasMatch()) {
+ fileName = match.captured(1);
}
}
// End workaround
- int extensionPos = fileName.indexOf(QRegExp("(?:\\.tar)?\\.[a-zA-Z0-9]+$"));
+ int extensionPos =
+ fileName.indexOf(QRegularExpression("(?:\\.tar)?\\.[a-zA-Z0-9]+$"));
if (extensionPos > -1) {
fileName.insert(extensionPos, "-XXXXXX");
}
diff --git a/src/dblsqd/semver.cpp b/src/dblsqd/semver.cpp
index 0aa77d0..a15e2f5 100644
--- a/src/dblsqd/semver.cpp
+++ b/src/dblsqd/semver.cpp
@@ -14,13 +14,14 @@ namespace dblsqd
*/
SemVer::SemVer(QString version) : original(version), valid(false)
{
- QRegExp rx(getRegExp());
- if (rx.indexIn(version) > -1) {
- this->major = rx.cap(1).toInt();
- this->minor = rx.cap(2).toInt();
- this->patch = rx.cap(3).toInt();
- this->prerelease = rx.cap(4);
- this->build = rx.cap(5);
+ QRegularExpression rx(getRegExp());
+ QRegularExpressionMatch match = rx.match(version);
+ if (match.hasMatch()) {
+ this->major = match.captured(1).toInt();
+ this->minor = match.captured(2).toInt();
+ this->patch = match.captured(3).toInt();
+ this->prerelease = match.captured(4);
+ this->build = match.captured(5);
this->valid = true;
} else {
this->major = 0;
diff --git a/src/dblsqd/semver.h b/src/dblsqd/semver.h
index 18ebcda..eb60a4e 100644
--- a/src/dblsqd/semver.h
+++ b/src/dblsqd/semver.h
@@ -2,7 +2,7 @@
#define DBLSQD_SEMVER_H
#include <QObject>
-#include <QRegExp>
+#include <QRegularExpression>
namespace dblsqd
{
diff --git a/src/freeverbdsp.h b/src/freeverbdsp.h
index 23dabfa..f22c8f0 100644
--- a/src/freeverbdsp.h
+++ b/src/freeverbdsp.h
@@ -3,8 +3,9 @@ author: "Romain Michon"
license: "LGPL"
name: "freeverb"
version: "0.0"
-Code generated with Faust 2.28.6 (https://faust.grame.fr)
-Compilation options: -lang cpp -inpl -scal -ftz 0
+Code generated with Faust 2.41.1 (https://faust.grame.fr)
+Compilation options: -a faust2header.cpp -lang cpp -i -inpl -cn freeverbdsp -es 1 -mcd 16
+-single -ftz 0
------------------------------------------------------------ */
#ifndef __freeverbdsp_H__
@@ -17,23 +18,23 @@ Compilation options: -lang cpp -inpl -scal -ftz 0
// aimed at creating a simple C++ header file (.h) containing a Faust DSP.
// See the Makefile for how to use it.
-/************************** BEGIN dsp.h **************************/
-/************************************************************************
+/************************** BEGIN dsp.h ********************************
FAUST Architecture File
- Copyright (C) 2003-2017 GRAME, Centre National de Creation Musicale
+ Copyright (C) 2003-2022 GRAME, Centre National de Creation Musicale
---------------------------------------------------------------------
- This Architecture section is free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 3 of
- the License, or (at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; If not, see <http://www.gnu.org/licenses/>.
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
EXCEPTION : As a special exception, you may create a larger work
that contains this FAUST architecture section and distribute
@@ -47,29 +48,111 @@ Compilation options: -lang cpp -inpl -scal -ftz 0
#include <string>
#include <vector>
+/************************************************************************
+ ************************************************************************
+ FAUST compiler
+ Copyright (C) 2003-2018 GRAME, Centre National de Creation Musicale
+ ---------------------------------------------------------------------
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ ************************************************************************
+ ************************************************************************/
+
+#ifndef __export__
+#define __export__
+
+#define FAUSTVERSION "2.41.1"
+
+// Use FAUST_API for code that is part of the external API but is also compiled in faust
+// and libfaust Use LIBFAUST_API for code that is compiled in faust and libfaust
+
+#ifdef _WIN32
+#pragma warning(disable : 4251)
+#ifdef FAUST_EXE
+#define FAUST_API
+#define LIBFAUST_API
+#elif FAUST_LIB
+#define FAUST_API __declspec(dllexport)
+#define LIBFAUST_API __declspec(dllexport)
+#else
+#define FAUST_API
+#define LIBFAUST_API
+#endif
+#else
+#ifdef FAUST_EXE
+#define FAUST_API
+#define LIBFAUST_API
+#else
+#define FAUST_API __attribute__((visibility("default")))
+#define LIBFAUST_API __attribute__((visibility("default")))
+#endif
+#endif
+
+#endif
+
#ifndef FAUSTFLOAT
#define FAUSTFLOAT float
#endif
-struct UI;
-struct Meta;
+struct FAUST_API UI;
+struct FAUST_API Meta;
/**
* DSP memory manager.
*/
-struct dsp_memory_manager {
+struct FAUST_API dsp_memory_manager {
virtual ~dsp_memory_manager() {}
+ /**
+ * Inform the Memory Manager with the number of expected memory zones.
+ * @param count - the number of expected memory zones
+ */
+ virtual void begin(size_t /*count*/) {}
+
+ /**
+ * Give the Memory Manager information on a given memory zone.
+ * @param size - the size in bytes of the memory zone
+ * @param reads - the number of Read access to the zone used to compute one frame
+ * @param writes - the number of Write access to the zone used to compute one frame
+ */
+ virtual void info(size_t /*size*/, size_t /*reads*/, size_t /*writes*/) {}
+
+ /**
+ * Inform the Memory Manager that all memory zones have been described,
+ * to possibly start a 'compute the best allocation strategy' step.
+ */
+ virtual void end() {}
+
+ /**
+ * Allocate a memory zone.
+ * @param size - the memory zone size in bytes
+ */
virtual void* allocate(size_t size) = 0;
- virtual void destroy(void* ptr) = 0;
+
+ /**
+ * Destroy a memory zone.
+ * @param ptr - the memory zone pointer to be deallocated
+ */
+ virtual void destroy(void* ptr) = 0;
};
/**
* Signal processor definition.
*/
-class dsp
+class FAUST_API dsp
{
public:
dsp() {}
@@ -89,7 +172,7 @@ class dsp
*/
virtual void buildUserInterface(UI* ui_interface) = 0;
- /* Returns the sample rate currently used by the instance */
+ /* Return the sample rate currently used by the instance */
virtual int getSampleRate() = 0;
/**
@@ -97,28 +180,28 @@ class dsp
* - static class 'classInit': static tables initialization
* - 'instanceInit': constants and instance state initialization
*
- * @param sample_rate - the sampling rate in Hertz
+ * @param sample_rate - the sampling rate in Hz
*/
virtual void init(int sample_rate) = 0;
/**
* Init instance state
*
- * @param sample_rate - the sampling rate in Hertz
+ * @param sample_rate - the sampling rate in Hz
*/
virtual void instanceInit(int sample_rate) = 0;
/**
* Init instance constant state
*
- * @param sample_rate - the sampling rate in Hertz
+ * @param sample_rate - the sampling rate in Hz
*/
virtual void instanceConstants(int sample_rate) = 0;
/* Init default control parameters values */
virtual void instanceResetUserInterface() = 0;
- /* Init instance state (delay lines...) */
+ /* Init instance state (like delay lines...) but keep the control parameter values */
virtual void instanceClear() = 0;
/**
@@ -170,7 +253,7 @@ class dsp
* Generic DSP decorator.
*/
-class decorator_dsp : public dsp
+class FAUST_API decorator_dsp : public dsp
{
protected:
dsp* fDSP;
@@ -209,10 +292,11 @@ class decorator_dsp : public dsp
};
/**
- * DSP factory class.
+ * DSP factory class, used with LLVM and Interpreter backends
+ * to create DSP instances from a compiled DSP program.
*/
-class dsp_factory
+class FAUST_API dsp_factory
{
protected:
// So that to force sub-classes to use deleteDSPFactory(dsp_factory* factory);
@@ -232,75 +316,114 @@ class dsp_factory
virtual dsp_memory_manager* getMemoryManager() = 0;
};
-/**
- * On Intel set FZ (Flush to Zero) and DAZ (Denormals Are Zero)
- * flags to avoid costly denormals.
- */
+// Denormal handling
-#ifdef __SSE__
+#if defined(__SSE__)
#include <xmmintrin.h>
-#ifdef __SSE2__
-#define AVOIDDENORMALS _mm_setcsr(_mm_getcsr() | 0x8040)
+#endif
+
+class FAUST_API ScopedNoDenormals
+{
+ private:
+ intptr_t fpsr;
+
+ void setFpStatusRegister(intptr_t fpsr_aux) noexcept
+ {
+#if defined(__arm64__) || defined(__aarch64__)
+ asm volatile("msr fpcr, %0" : : "ri"(fpsr_aux));
+#elif defined(__SSE__)
+ _mm_setcsr(static_cast<uint32_t>(fpsr_aux));
+#endif
+ }
+
+ void getFpStatusRegister() noexcept
+ {
+#if defined(__arm64__) || defined(__aarch64__)
+ asm volatile("mrs %0, fpcr" : "=r"(fpsr));
+#elif defined(__SSE__)
+ fpsr = static_cast<intptr_t>(_mm_getcsr());
+#endif
+ }
+
+ public:
+ ScopedNoDenormals() noexcept
+ {
+#if defined(__arm64__) || defined(__aarch64__)
+ intptr_t mask = (1 << 24 /* FZ */);
+#else
+#if defined(__SSE__)
+#if defined(__SSE2__)
+ intptr_t mask = 0x8040;
#else
-#define AVOIDDENORMALS _mm_setcsr(_mm_getcsr() | 0x8000)
+ intptr_t mask = 0x8000;
#endif
#else
-#define AVOIDDENORMALS
+ intptr_t mask = 0x0000;
#endif
-
#endif
-/************************** END dsp.h **************************/
+ getFpStatusRegister();
+ setFpStatusRegister(fpsr | mask);
+ }
-/************************** BEGIN APIUI.h **************************/
-/************************************************************************
- FAUST Architecture File
- Copyright (C) 2003-2017 GRAME, Centre National de Creation Musicale
- ---------------------------------------------------------------------
- This Architecture section is free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 3 of
- the License, or (at your option) any later version.
+ ~ScopedNoDenormals() noexcept { setFpStatusRegister(fpsr); }
+};
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+#define AVOIDDENORMALS ScopedNoDenormals();
- You should have received a copy of the GNU General Public License
- along with this program; If not, see <http://www.gnu.org/licenses/>.
+#endif
- EXCEPTION : As a special exception, you may create a larger work
- that contains this FAUST architecture section and distribute
- that work under terms of your choice, so long as this FAUST
- architecture section is not modified.
- ************************************************************************/
+/************************** END dsp.h **************************/
+/************************** BEGIN APIUI.h *****************************
+FAUST Architecture File
+Copyright (C) 2003-2022 GRAME, Centre National de Creation Musicale
+---------------------------------------------------------------------
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+EXCEPTION : As a special exception, you may create a larger work
+that contains this FAUST architecture section and distribute
+that work under terms of your choice, so long as this FAUST
+architecture section is not modified.
+************************************************************************/
#ifndef API_UI_H
#define API_UI_H
-#include <iostream>
+#include <stdio.h>
+
#include <map>
#include <sstream>
#include <string>
#include <vector>
-/************************** BEGIN meta.h **************************/
-/************************************************************************
+/************************** BEGIN meta.h *******************************
FAUST Architecture File
- Copyright (C) 2003-2017 GRAME, Centre National de Creation Musicale
+ Copyright (C) 2003-2022 GRAME, Centre National de Creation Musicale
---------------------------------------------------------------------
- This Architecture section is free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 3 of
- the License, or (at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; If not, see <http://www.gnu.org/licenses/>.
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
EXCEPTION : As a special exception, you may create a larger work
that contains this FAUST architecture section and distribute
@@ -311,36 +434,40 @@ class dsp_factory
#ifndef __meta__
#define __meta__
-struct Meta {
- virtual ~Meta(){};
+/**
+ The base class of Meta handler to be used in dsp::metadata(Meta* m) method to retrieve
+ (key, value) metadata.
+ */
+struct FAUST_API Meta {
+ virtual ~Meta() {}
virtual void declare(const char* key, const char* value) = 0;
};
#endif
/************************** END meta.h **************************/
-/************************** BEGIN UI.h **************************/
-/************************************************************************
+/************************** BEGIN UI.h *****************************
FAUST Architecture File
- Copyright (C) 2003-2020 GRAME, Centre National de Creation Musicale
+ Copyright (C) 2003-2022 GRAME, Centre National de Creation Musicale
---------------------------------------------------------------------
- This Architecture section is free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 3 of
- the License, or (at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; If not, see <http://www.gnu.org/licenses/>.
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
EXCEPTION : As a special exception, you may create a larger work
that contains this FAUST architecture section and distribute
that work under terms of your choice, so long as this FAUST
architecture section is not modified.
- ************************************************************************/
+ ********************************************************************/
#ifndef __UI_H__
#define __UI_H__
@@ -359,7 +486,7 @@ struct Meta {
struct Soundfile;
template<typename REAL>
-struct UIReal {
+struct FAUST_API UIReal {
UIReal() {}
virtual ~UIReal() {}
@@ -390,38 +517,41 @@ struct UIReal {
// -- soundfiles
- virtual void addSoundfile(const char* label, const char* filename,
- Soundfile** sf_zone) = 0;
+ virtual void addSoundfile(const char* /*label*/, const char* /*filename*/,
+ Soundfile** /*sf_zone*/) = 0;
// -- metadata declarations
virtual void declare(REAL* /*zone*/, const char* /*key*/, const char* /*val*/) {}
+
+ // To be used by LLVM client
+ virtual int sizeOfFAUSTFLOAT() { return sizeof(FAUSTFLOAT); }
};
-struct UI : public UIReal<FAUSTFLOAT> {
+struct FAUST_API UI : public UIReal<FAUSTFLOAT> {
UI() {}
virtual ~UI() {}
};
#endif
/************************** END UI.h **************************/
-/************************** BEGIN PathBuilder.h **************************/
-/************************************************************************
+/************************** BEGIN PathBuilder.h **************************
FAUST Architecture File
- Copyright (C) 2003-2017 GRAME, Centre National de Creation Musicale
+ Copyright (C) 2003-2022 GRAME, Centre National de Creation Musicale
---------------------------------------------------------------------
- This Architecture section is free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 3 of
- the License, or (at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; If not, see <http://www.gnu.org/licenses/>.
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
EXCEPTION : As a special exception, you may create a larger work
that contains this FAUST architecture section and distribute
@@ -429,10 +559,13 @@ struct UI : public UIReal<FAUSTFLOAT> {
architecture section is not modified.
************************************************************************/
-#ifndef FAUST_PATHBUILDER_H
-#define FAUST_PATHBUILDER_H
+#ifndef __PathBuilder__
+#define __PathBuilder__
#include <algorithm>
+#include <map>
+#include <regex>
+#include <set>
#include <string>
#include <vector>
@@ -441,113 +574,266 @@ struct UI : public UIReal<FAUSTFLOAT> {
* Helper class to build complete hierarchical path for UI items.
******************************************************************************/
-class PathBuilder
+class FAUST_API PathBuilder
{
protected:
std::vector<std::string> fControlsLevel;
+ std::vector<std::string> fFullPaths;
+ std::map<std::string, std::string> fFull2Short; // filled by computeShortNames()
+
+ /**
+ * @brief check if a character is acceptable for an ID
+ *
+ * @param c
+ * @return true is the character is acceptable for an ID
+ */
+ bool isIDChar(char c) const
+ {
+ return ((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z'))
+ || ((c >= '0') && (c <= '9'));
+ }
+
+ /**
+ * @brief remove all "/0x00" parts
+ *
+ * @param src
+ * @return modified string
+ */
+ std::string remove0x00(const std::string& src) const
+ {
+ return std::regex_replace(src, std::regex("/0x00"), "");
+ }
+
+ /**
+ * @brief replace all non ID char with '_' (one '_' may replace several non ID char)
+ *
+ * @param src
+ * @return modified string
+ */
+ std::string str2ID(const std::string& src) const
+ {
+ std::string dst;
+ bool need_underscore = false;
+ for (char c : src) {
+ if (isIDChar(c) || (c == '/')) {
+ if (need_underscore) {
+ dst.push_back('_');
+ need_underscore = false;
+ }
+ dst.push_back(c);
+ } else {
+ need_underscore = true;
+ }
+ }
+ return dst;
+ }
+
+ /**
+ * @brief Keep only the last n slash-parts
+ *
+ * @param src
+ * @param n : 1 indicates the last slash-part
+ * @return modified string
+ */
+ std::string cut(const std::string& src, int n) const
+ {
+ std::string rdst;
+ for (int i = int(src.length()) - 1; i >= 0; i--) {
+ char c = src[i];
+ if (c != '/') {
+ rdst.push_back(c);
+ } else if (n == 1) {
+ std::string dst;
+ for (int j = int(rdst.length()) - 1; j >= 0; j--) {
+ dst.push_back(rdst[j]);
+ }
+ return dst;
+ } else {
+ n--;
+ rdst.push_back(c);
+ }
+ }
+ return src;
+ }
+
+ void addFullPath(const std::string& label) { fFullPaths.push_back(buildPath(label)); }
+
+ /**
+ * @brief Compute the mapping between full path and short names
+ */
+ void computeShortNames()
+ {
+ std::vector<std::string>
+ uniquePaths; // all full paths transformed but made unique with a prefix
+ std::map<std::string, std::string>
+ unique2full; // all full paths transformed but made unique with a prefix
+ char num_buffer[16];
+ int pnum = 0;
+
+ for (const auto& s : fFullPaths) {
+ sprintf(num_buffer, "%d", pnum++);
+ std::string u = "/P" + std::string(num_buffer) + str2ID(remove0x00(s));
+ uniquePaths.push_back(u);
+ unique2full[u] = s; // remember the full path associated to a unique path
+ }
+
+ std::map<std::string, int> uniquePath2level; // map path to level
+ for (const auto& s : uniquePaths)
+ uniquePath2level[s] = 1; // we init all levels to 1
+ bool have_collisions = true;
+
+ while (have_collisions) {
+ // compute collision list
+ std::set<std::string> collisionSet;
+ std::map<std::string, std::string> short2full;
+ have_collisions = false;
+ for (const auto& it : uniquePath2level) {
+ std::string u = it.first;
+ int n = it.second;
+ std::string shortName = cut(u, n);
+ auto p = short2full.find(shortName);
+ if (p == short2full.end()) {
+ // no collision
+ short2full[shortName] = u;
+ } else {
+ // we have a collision, add the two paths to the collision set
+ have_collisions = true;
+ collisionSet.insert(u);
+ collisionSet.insert(p->second);
+ }
+ }
+ for (const auto& s : collisionSet)
+ uniquePath2level[s]++; // increase level of colliding path
+ }
+
+ for (const auto& it : uniquePath2level) {
+ std::string u = it.first;
+ int n = it.second;
+ std::string shortName = replaceCharList(cut(u, n), {'/'}, '_');
+ fFull2Short[unique2full[u]] = shortName;
+ }
+ }
+
+ std::string replaceCharList(const std::string& str, const std::vector<char>& ch1,
+ char ch2)
+ {
+ auto beg = ch1.begin();
+ auto end = ch1.end();
+ std::string res = str;
+ for (size_t i = 0; i < str.length(); ++i) {
+ if (std::find(beg, end, str[i]) != end)
+ res[i] = ch2;
+ }
+ return res;
+ }
public:
PathBuilder() {}
virtual ~PathBuilder() {}
+ // Return true for the first level of groups
+ bool pushLabel(const std::string& label)
+ {
+ fControlsLevel.push_back(label);
+ return fControlsLevel.size() == 1;
+ }
+
+ // Return true for the last level of groups
+ bool popLabel()
+ {
+ fControlsLevel.pop_back();
+ return fControlsLevel.size() == 0;
+ }
+
std::string buildPath(const std::string& label)
{
std::string res = "/";
for (size_t i = 0; i < fControlsLevel.size(); i++) {
- res += fControlsLevel[i];
- res += "/";
+ res = res + fControlsLevel[i] + "/";
}
res += label;
- std::replace(res.begin(), res.end(), ' ', '_');
- return res;
- }
-
- std::string buildLabel(std::string label)
- {
- std::replace(label.begin(), label.end(), ' ', '_');
- return label;
+ return replaceCharList(
+ res, {' ', '#', '*', ',', '?', '[', ']', '{', '}', '(', ')'}, '_');
}
-
- void pushLabel(const std::string& label) { fControlsLevel.push_back(label); }
- void popLabel() { fControlsLevel.pop_back(); }
};
-#endif // FAUST_PATHBUILDER_H
+#endif // __PathBuilder__
/************************** END PathBuilder.h **************************/
-/************************** BEGIN ValueConverter.h **************************/
-/************************************************************************
+/************************** BEGIN ValueConverter.h ********************
FAUST Architecture File
- Copyright (C) 2003-2017 GRAME, Centre National de Creation Musicale
+ Copyright (C) 2003-2022 GRAME, Centre National de Creation Musicale
---------------------------------------------------------------------
- This Architecture section is free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 3 of
- the License, or (at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; If not, see <http://www.gnu.org/licenses/>.
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
EXCEPTION : As a special exception, you may create a larger work
that contains this FAUST architecture section and distribute
that work under terms of your choice, so long as this FAUST
architecture section is not modified.
- ************************************************************************/
+ ********************************************************************/
#ifndef __ValueConverter__
#define __ValueConverter__
/***************************************************************************************
- ValueConverter.h
- (GRAME, Copyright 2015-2019)
+ ValueConverter.h
+ (GRAME, Copyright 2015-2019)
-Set of conversion objects used to map user interface values (for example a gui slider
-delivering values between 0 and 1) to faust values (for example a vslider between
-20 and 20000) using a log scale.
+ Set of conversion objects used to map user interface values (for example a gui slider
+ delivering values between 0 and 1) to faust values (for example a vslider between
+ 20 and 20000) using a log scale.
--- Utilities
+ -- Utilities
-Range(lo,hi) : clip a value x between lo and hi
-Interpolator(lo,hi,v1,v2) : Maps a value x between lo and hi to a value y between v1 and
+ Range(lo,hi) : clip a value x between lo and hi
+ Interpolator(lo,hi,v1,v2) : Maps a value x between lo and hi to a value y between v1 and
v2 Interpolator3pt(lo,mi,hi,v1,vm,v2) : Map values between lo mid hi to values between v1
vm v2
--- Value Converters
+ -- Value Converters
-ValueConverter::ui2faust(x)
-ValueConverter::faust2ui(x)
+ ValueConverter::ui2faust(x)
+ ValueConverter::faust2ui(x)
--- ValueConverters used for sliders depending of the scale
+ -- ValueConverters used for sliders depending of the scale
-LinearValueConverter(umin, umax, fmin, fmax)
-LinearValueConverter2(lo, mi, hi, v1, vm, v2) using 2 segments
-LogValueConverter(umin, umax, fmin, fmax)
-ExpValueConverter(umin, umax, fmin, fmax)
+ LinearValueConverter(umin, umax, fmin, fmax)
+ LinearValueConverter2(lo, mi, hi, v1, vm, v2) using 2 segments
+ LogValueConverter(umin, umax, fmin, fmax)
+ ExpValueConverter(umin, umax, fmin, fmax)
--- ValueConverters used for accelerometers based on 3 points
+ -- ValueConverters used for accelerometers based on 3 points
-AccUpConverter(amin, amid, amax, fmin, fmid, fmax) -- curve 0
-AccDownConverter(amin, amid, amax, fmin, fmid, fmax) -- curve 1
-AccUpDownConverter(amin, amid, amax, fmin, fmid, fmax) -- curve 2
-AccDownUpConverter(amin, amid, amax, fmin, fmid, fmax) -- curve 3
+ AccUpConverter(amin, amid, amax, fmin, fmid, fmax) -- curve 0
+ AccDownConverter(amin, amid, amax, fmin, fmid, fmax) -- curve 1
+ AccUpDownConverter(amin, amid, amax, fmin, fmid, fmax) -- curve 2
+ AccDownUpConverter(amin, amid, amax, fmin, fmid, fmax) -- curve 3
--- lists of ZoneControl are used to implement accelerometers metadata for each axes
+ -- lists of ZoneControl are used to implement accelerometers metadata for each axes
-ZoneControl(zone, valueConverter) : a zone with an accelerometer data converter
+ ZoneControl(zone, valueConverter) : a zone with an accelerometer data converter
--- ZoneReader are used to implement screencolor metadata
+ -- ZoneReader are used to implement screencolor metadata
-ZoneReader(zone, valueConverter) : a zone with a data converter
+ ZoneReader(zone, valueConverter) : a zone with a data converter
****************************************************************************************/
+#include <assert.h>
+#include <float.h>
+
#include <algorithm> // std::max
-#include <cassert>
-#include <cfloat>
#include <cmath>
#include <vector>
@@ -555,12 +841,12 @@ ZoneReader(zone, valueConverter) : a zone with a data converter
// Interpolator(lo,hi,v1,v2)
// Maps a value x between lo and hi to a value y between v1 and v2
// y = v1 + (x-lo)/(hi-lo)*(v2-v1)
-// y = v1 + (x-lo) * coef with coef = (v2-v1)/(hi-lo)
+// y = v1 + (x-lo) * coef with coef = (v2-v1)/(hi-lo)
// y = v1 + x*coef - lo*coef
// y = v1 - lo*coef + x*coef
-// y = offset + x*coef with offset = v1 - lo*coef
+// y = offset + x*coef with offset = v1 - lo*coef
//--------------------------------------------------------------------------------------
-class Interpolator
+class FAUST_API Interpolator
{
private:
//--------------------------------------------------------------------------------------
@@ -611,7 +897,7 @@ class Interpolator
// Interpolator3pt(lo,mi,hi,v1,vm,v2)
// Map values between lo mid hi to values between v1 vm v2
//--------------------------------------------------------------------------------------
-class Interpolator3pt
+class FAUST_API Interpolator3pt
{
private:
Interpolator fSegment1;
@@ -635,19 +921,19 @@ class Interpolator3pt
//--------------------------------------------------------------------------------------
// Abstract ValueConverter class. Converts values between UI and Faust representations
//--------------------------------------------------------------------------------------
-class ValueConverter
+class FAUST_API ValueConverter
{
public:
virtual ~ValueConverter() {}
- virtual double ui2faust(double x) = 0;
- virtual double faust2ui(double x) = 0;
+ virtual double ui2faust(double x) { return x; };
+ virtual double faust2ui(double x) { return x; };
};
//--------------------------------------------------------------------------------------
// A converter than can be updated
//--------------------------------------------------------------------------------------
-class UpdatableValueConverter : public ValueConverter
+class FAUST_API UpdatableValueConverter : public ValueConverter
{
protected:
bool fActive;
@@ -667,7 +953,7 @@ class UpdatableValueConverter : public ValueConverter
//--------------------------------------------------------------------------------------
// Linear conversion between ui and Faust values
//--------------------------------------------------------------------------------------
-class LinearValueConverter : public ValueConverter
+class FAUST_API LinearValueConverter : public ValueConverter
{
private:
Interpolator fUI2F;
@@ -687,7 +973,7 @@ class LinearValueConverter : public ValueConverter
//--------------------------------------------------------------------------------------
// Two segments linear conversion between ui and Faust values
//--------------------------------------------------------------------------------------
-class LinearValueConverter2 : public UpdatableValueConverter
+class FAUST_API LinearValueConverter2 : public UpdatableValueConverter
{
private:
Interpolator3pt fUI2F;
@@ -723,7 +1009,7 @@ class LinearValueConverter2 : public UpdatableValueConverter
//--------------------------------------------------------------------------------------
// Logarithmic conversion between ui and Faust values
//--------------------------------------------------------------------------------------
-class LogValueConverter : public LinearValueConverter
+class FAUST_API LogValueConverter : public LinearValueConverter
{
public:
LogValueConverter(double umin, double umax, double fmin, double fmax)
@@ -745,7 +1031,7 @@ class LogValueConverter : public LinearValueConverter
//--------------------------------------------------------------------------------------
// Exponential conversion between ui and Faust values
//--------------------------------------------------------------------------------------
-class ExpValueConverter : public LinearValueConverter
+class FAUST_API ExpValueConverter : public LinearValueConverter
{
public:
ExpValueConverter(double umin, double umax, double fmin, double fmax)
@@ -768,7 +1054,7 @@ class ExpValueConverter : public LinearValueConverter
// Convert accelerometer or gyroscope values to Faust values
// Using an Up curve (curve 0)
//--------------------------------------------------------------------------------------
-class AccUpConverter : public UpdatableValueConverter
+class FAUST_API AccUpConverter : public UpdatableValueConverter
{
private:
Interpolator3pt fA2F;
@@ -804,7 +1090,7 @@ class AccUpConverter : public UpdatableValueConverter
// Convert accelerometer or gyroscope values to Faust values
// Using a Down curve (curve 1)
//--------------------------------------------------------------------------------------
-class AccDownConverter : public UpdatableValueConverter
+class FAUST_API AccDownConverter : public UpdatableValueConverter
{
private:
Interpolator3pt fA2F;
@@ -840,15 +1126,15 @@ class AccDownConverter : public UpdatableValueConverter
// Convert accelerometer or gyroscope values to Faust values
// Using an Up-Down curve (curve 2)
//--------------------------------------------------------------------------------------
-class AccUpDownConverter : public UpdatableValueConverter
+class FAUST_API AccUpDownConverter : public UpdatableValueConverter
{
private:
Interpolator3pt fA2F;
Interpolator fF2A;
public:
- AccUpDownConverter(double amin, double amid, double amax, double fmin,
- double /*fmid*/, double fmax)
+ AccUpDownConverter(double amin, double amid, double amax, double fmin, double /*fmid*/,
+ double fmax)
: fA2F(amin, amid, amax, fmin, fmax, fmin)
, fF2A(fmin, fmax, amin,
amax) // Special, pseudo inverse of a non monotonic function
@@ -877,15 +1163,15 @@ class AccUpDownConverter : public UpdatableValueConverter
// Convert accelerometer or gyroscope values to Faust values
// Using a Down-Up curve (curve 3)
//--------------------------------------------------------------------------------------
-class AccDownUpConverter : public UpdatableValueConverter
+class FAUST_API AccDownUpConverter : public UpdatableValueConverter
{
private:
Interpolator3pt fA2F;
Interpolator fF2A;
public:
- AccDownUpConverter(double amin, double amid, double amax, double fmin,
- double /*fmid*/, double fmax)
+ AccDownUpConverter(double amin, double amid, double amax, double fmin, double /*fmid*/,
+ double fmax)
: fA2F(amin, amid, amax, fmax, fmin, fmax)
, fF2A(fmin, fmax, amin,
amax) // Special, pseudo inverse of a non monotonic function
@@ -913,7 +1199,7 @@ class AccDownUpConverter : public UpdatableValueConverter
//--------------------------------------------------------------------------------------
// Base class for ZoneControl
//--------------------------------------------------------------------------------------
-class ZoneControl
+class FAUST_API ZoneControl
{
protected:
FAUSTFLOAT* fZone;
@@ -924,9 +1210,8 @@ class ZoneControl
virtual void update(double /*v*/) const {}
- virtual void setMappingValues(int /*curve*/, double /*amin*/, double /*amid*/,
- double /*amax*/, double /*min*/, double /*init*/,
- double /*max*/)
+ virtual void setMappingValues(int /*curve*/, double /*amin*/, double /*amid*/, double /*amax*/,
+ double /*min*/, double /*init*/, double /*max*/)
{
}
virtual void getMappingValues(double& /*amin*/, double& /*amid*/, double& /*amax*/) {}
@@ -942,7 +1227,7 @@ class ZoneControl
//--------------------------------------------------------------------------------------
// Useful to implement accelerometers metadata as a list of ZoneControl for each axes
//--------------------------------------------------------------------------------------
-class ConverterZoneControl : public ZoneControl
+class FAUST_API ConverterZoneControl : public ZoneControl
{
protected:
ValueConverter* fValueConverter;
@@ -957,7 +1242,10 @@ class ConverterZoneControl : public ZoneControl
delete fValueConverter;
} // Assuming fValueConverter is not kept elsewhere...
- virtual void update(double v) const { *fZone = fValueConverter->ui2faust(v); }
+ virtual void update(double v) const
+ {
+ *fZone = FAUSTFLOAT(fValueConverter->ui2faust(v));
+ }
ValueConverter* getConverter() { return fValueConverter; }
};
@@ -966,7 +1254,7 @@ class ConverterZoneControl : public ZoneControl
// Association of a zone and a four value converter, each one for each possible curve.
// Useful to implement accelerometers metadata as a list of ZoneControl for each axes
//--------------------------------------------------------------------------------------
-class CurveZoneControl : public ZoneControl
+class FAUST_API CurveZoneControl : public ZoneControl
{
private:
std::vector<UpdatableValueConverter*> fValueConverters;
@@ -989,15 +1277,14 @@ class CurveZoneControl : public ZoneControl
}
virtual ~CurveZoneControl()
{
- std::vector<UpdatableValueConverter*>::iterator it;
- for (it = fValueConverters.begin(); it != fValueConverters.end(); it++) {
- delete (*it);
+ for (const auto& it : fValueConverters) {
+ delete it;
}
}
void update(double v) const
{
if (fValueConverters[fCurve]->getActive())
- *fZone = fValueConverters[fCurve]->ui2faust(v);
+ *fZone = FAUSTFLOAT(fValueConverters[fCurve]->ui2faust(v));
}
void setMappingValues(int curve, double amin, double amid, double amax, double min,
@@ -1014,16 +1301,15 @@ class CurveZoneControl : public ZoneControl
void setActive(bool on_off)
{
- std::vector<UpdatableValueConverter*>::iterator it;
- for (it = fValueConverters.begin(); it != fValueConverters.end(); it++) {
- (*it)->setActive(on_off);
+ for (const auto& it : fValueConverters) {
+ it->setActive(on_off);
}
}
int getCurve() { return fCurve; }
};
-class ZoneReader
+class FAUST_API ZoneReader
{
private:
FAUSTFLOAT* fZone;
@@ -1043,6 +1329,8 @@ class ZoneReader
#endif
/************************** END ValueConverter.h **************************/
+typedef unsigned int uint;
+
class APIUI
: public PathBuilder
, public Meta
@@ -1058,22 +1346,42 @@ class APIUI
kHBargraph,
kVBargraph
};
+ enum Type { kAcc = 0, kGyr = 1, kNoType };
protected:
- enum { kLin = 0, kLog = 1, kExp = 2 };
-
- int fNumParameters;
- std::vector<std::string> fPaths;
- std::vector<std::string> fLabels;
- std::map<std::string, int> fPathMap;
- std::map<std::string, int> fLabelMap;
- std::vector<ValueConverter*> fConversion;
- std::vector<FAUSTFLOAT*> fZone;
- std::vector<FAUSTFLOAT> fInit;
- std::vector<FAUSTFLOAT> fMin;
- std::vector<FAUSTFLOAT> fMax;
- std::vector<FAUSTFLOAT> fStep;
- std::vector<ItemType> fItemType;
+ enum Mapping { kLin = 0, kLog = 1, kExp = 2 };
+
+ struct Item {
+ std::string fLabel;
+ std::string fShortname;
+ std::string fPath;
+ ValueConverter* fConversion;
+ FAUSTFLOAT* fZone;
+ FAUSTFLOAT fInit;
+ FAUSTFLOAT fMin;
+ FAUSTFLOAT fMax;
+ FAUSTFLOAT fStep;
+ ItemType fItemType;
+
+ Item(const std::string& label, const std::string& short_name,
+ const std::string& path, ValueConverter* conversion, FAUSTFLOAT* zone,
+ FAUSTFLOAT init, FAUSTFLOAT min, FAUSTFLOAT max, FAUSTFLOAT step,
+ ItemType item_type)
+ : fLabel(label)
+ , fShortname(short_name)
+ , fPath(path)
+ , fConversion(conversion)
+ , fZone(zone)
+ , fInit(init)
+ , fMin(min)
+ , fMax(max)
+ , fStep(step)
+ , fItemType(item_type)
+ {
+ }
+ };
+ std::vector<Item> fItems;
+
std::vector<std::map<std::string, std::string> > fMetaData;
std::vector<ZoneControl*> fAcc[3];
std::vector<ZoneControl*> fGyr[3];
@@ -1100,33 +1408,31 @@ class APIUI
ItemType type)
{
std::string path = buildPath(label);
- fPathMap[path] = fLabelMap[label] = fNumParameters++;
- fPaths.push_back(path);
- fLabels.push_back(label);
- fZone.push_back(zone);
- fInit.push_back(init);
- fMin.push_back(min);
- fMax.push_back(max);
- fStep.push_back(step);
- fItemType.push_back(type);
+ fFullPaths.push_back(path);
// handle scale metadata
+ ValueConverter* converter = nullptr;
switch (fCurrentScale) {
case kLin:
- fConversion.push_back(new LinearValueConverter(0, 1, min, max));
+ converter = new LinearValueConverter(0, 1, min, max);
break;
case kLog:
- fConversion.push_back(new LogValueConverter(0, 1, min, max));
+ converter = new LogValueConverter(0, 1, min, max);
break;
case kExp:
- fConversion.push_back(new ExpValueConverter(0, 1, min, max));
+ converter = new ExpValueConverter(0, 1, min, max);
break;
}
fCurrentScale = kLin;
+ fItems.push_back(
+ Item(label, "", path, converter, zone, init, min, max, step, type));
+
if (fCurrentAcc.size() > 0 && fCurrentGyr.size() > 0) {
- std::cerr << "warning : 'acc' and 'gyr' metadata used for the same " << label
- << " parameter !!\n";
+ fprintf(
+ stderr,
+ "warning : 'acc' and 'gyr' metadata used for the same %s parameter !!\n",
+ label);
}
// handle acc metadata "...[acc : <axe> <curve> <amin> <amid> <amax>]..."
@@ -1141,7 +1447,7 @@ class APIUI
fAcc[axe].push_back(
new CurveZoneControl(zone, curve, amin, amid, amax, min, init, max));
} else {
- std::cerr << "incorrect acc metadata : " << fCurrentAcc << std::endl;
+ fprintf(stderr, "incorrect acc metadata : %s \n", fCurrentAcc.c_str());
}
fCurrentAcc = "";
}
@@ -1158,31 +1464,31 @@ class APIUI
fGyr[axe].push_back(
new CurveZoneControl(zone, curve, amin, amid, amax, min, init, max));
} else {
- std::cerr << "incorrect gyr metadata : " << fCurrentGyr << std::endl;
+ fprintf(stderr, "incorrect gyr metadata : %s \n", fCurrentGyr.c_str());
}
fCurrentGyr = "";
}
// handle screencolor metadata "...[screencolor:red|green|blue|white]..."
if (fCurrentColor.size() > 0) {
- if ((fCurrentColor == "red") && (fRedReader == 0)) {
+ if ((fCurrentColor == "red") && (fRedReader == nullptr)) {
fRedReader = new ZoneReader(zone, min, max);
fHasScreenControl = true;
- } else if ((fCurrentColor == "green") && (fGreenReader == 0)) {
+ } else if ((fCurrentColor == "green") && (fGreenReader == nullptr)) {
fGreenReader = new ZoneReader(zone, min, max);
fHasScreenControl = true;
- } else if ((fCurrentColor == "blue") && (fBlueReader == 0)) {
+ } else if ((fCurrentColor == "blue") && (fBlueReader == nullptr)) {
fBlueReader = new ZoneReader(zone, min, max);
fHasScreenControl = true;
- } else if ((fCurrentColor == "white") && (fRedReader == 0)
- && (fGreenReader == 0) && (fBlueReader == 0)) {
+ } else if ((fCurrentColor == "white") && (fRedReader == nullptr)
+ && (fGreenReader == nullptr) && (fBlueReader == nullptr)) {
fRedReader = new ZoneReader(zone, min, max);
fGreenReader = new ZoneReader(zone, min, max);
fBlueReader = new ZoneReader(zone, min, max);
fHasScreenControl = true;
} else {
- std::cerr << "incorrect screencolor metadata : " << fCurrentColor
- << std::endl;
+ fprintf(stderr, "incorrect screencolor metadata : %s \n",
+ fCurrentColor.c_str());
}
}
fCurrentColor = "";
@@ -1193,7 +1499,7 @@ class APIUI
int getZoneIndex(std::vector<ZoneControl*>* table, int p, int val)
{
- FAUSTFLOAT* zone = fZone[p];
+ FAUSTFLOAT* zone = fItems[uint(p)].fZone;
for (size_t i = 0; i < table[val].size(); i++) {
if (zone == table[val][i]->getZone())
return int(i);
@@ -1210,11 +1516,11 @@ class APIUI
// Deactivates everywhere..
if (id1 != -1)
- table[0][id1]->setActive(false);
+ table[0][uint(id1)]->setActive(false);
if (id2 != -1)
- table[1][id2]->setActive(false);
+ table[1][uint(id2)]->setActive(false);
if (id3 != -1)
- table[2][id3]->setActive(false);
+ table[2][uint(id3)]->setActive(false);
if (val == -1) { // Means: no more mapping...
// So stay all deactivated...
@@ -1222,14 +1528,16 @@ class APIUI
int id4 = getZoneIndex(table, p, val);
if (id4 != -1) {
// Reactivate the one we edit...
- table[val][id4]->setMappingValues(curve, amin, amid, amax, fMin[p],
- fInit[p], fMax[p]);
- table[val][id4]->setActive(true);
+ table[val][uint(id4)]->setMappingValues(
+ curve, amin, amid, amax, fItems[uint(p)].fMin, fItems[uint(p)].fInit,
+ fItems[uint(p)].fMax);
+ table[val][uint(id4)]->setActive(true);
} else {
// Allocate a new CurveZoneControl which is 'active' by default
- FAUSTFLOAT* zone = fZone[p];
- table[val].push_back(new CurveZoneControl(zone, curve, amin, amid, amax,
- fMin[p], fInit[p], fMax[p]));
+ FAUSTFLOAT* zone = fItems[uint(p)].fZone;
+ table[val].push_back(new CurveZoneControl(
+ zone, curve, amin, amid, amax, fItems[uint(p)].fMin,
+ fItems[uint(p)].fInit, fItems[uint(p)].fMax));
}
}
}
@@ -1243,16 +1551,16 @@ class APIUI
if (id1 != -1) {
val = 0;
- curve = table[val][id1]->getCurve();
- table[val][id1]->getMappingValues(amin, amid, amax);
+ curve = table[val][uint(id1)]->getCurve();
+ table[val][uint(id1)]->getMappingValues(amin, amid, amax);
} else if (id2 != -1) {
val = 1;
- curve = table[val][id2]->getCurve();
- table[val][id2]->getMappingValues(amin, amid, amax);
+ curve = table[val][uint(id2)]->getCurve();
+ table[val][uint(id2)]->getMappingValues(amin, amid, amax);
} else if (id3 != -1) {
val = 2;
- curve = table[val][id3]->getCurve();
- table[val][id3]->getMappingValues(amin, amid, amax);
+ curve = table[val][uint(id3)]->getCurve();
+ table[val][uint(id3)]->getMappingValues(amin, amid, amax);
} else {
val = -1; // No mapping
curve = 0;
@@ -1263,26 +1571,23 @@ class APIUI
}
public:
- enum Type { kAcc = 0, kGyr = 1, kNoType };
-
APIUI()
- : fNumParameters(0)
- , fHasScreenControl(false)
- , fRedReader(0)
- , fGreenReader(0)
- , fBlueReader(0)
+ : fHasScreenControl(false)
+ , fRedReader(nullptr)
+ , fGreenReader(nullptr)
+ , fBlueReader(nullptr)
, fCurrentScale(kLin)
{
}
virtual ~APIUI()
{
- for (auto& it : fConversion)
- delete it;
+ for (const auto& it : fItems)
+ delete it.fConversion;
for (int i = 0; i < 3; i++) {
- for (auto& it : fAcc[i])
+ for (const auto& it : fAcc[i])
delete it;
- for (auto& it : fGyr[i])
+ for (const auto& it : fGyr[i])
delete it;
}
delete fRedReader;
@@ -1295,7 +1600,18 @@ class APIUI
virtual void openTabBox(const char* label) { pushLabel(label); }
virtual void openHorizontalBox(const char* label) { pushLabel(label); }
virtual void openVerticalBox(const char* label) { pushLabel(label); }
- virtual void closeBox() { popLabel(); }
+ virtual void closeBox()
+ {
+ if (popLabel()) {
+ // Shortnames can be computed when all fullnames are known
+ computeShortNames();
+ // Fill 'shortname' field for each item
+ for (const auto& it : fFull2Short) {
+ int index = getParamIndex(it.first.c_str());
+ fItems[index].fShortname = it.second;
+ }
+ }
+ }
// -- active widgets
@@ -1332,13 +1648,13 @@ class APIUI
virtual void addHorizontalBargraph(const char* label, FAUSTFLOAT* zone,
FAUSTFLOAT min, FAUSTFLOAT max)
{
- addParameter(label, zone, min, min, max, (max - min) / 1000.0, kHBargraph);
+ addParameter(label, zone, min, min, max, (max - min) / 1000.0f, kHBargraph);
}
virtual void addVerticalBargraph(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT min,
FAUSTFLOAT max)
{
- addParameter(label, zone, min, min, max, (max - min) / 1000.0, kVBargraph);
+ addParameter(label, zone, min, min, max, (max - min) / 1000.0f, kVBargraph);
}
// -- soundfiles
@@ -1381,23 +1697,25 @@ class APIUI
//-------------------------------------------------------------------------------
// Simple API part
//-------------------------------------------------------------------------------
- int getParamsCount() { return fNumParameters; }
- int getParamIndex(const char* path)
+ int getParamsCount() { return int(fItems.size()); }
+
+ int getParamIndex(const char* path_aux)
{
- if (fPathMap.find(path) != fPathMap.end()) {
- return fPathMap[path];
- } else if (fLabelMap.find(path) != fLabelMap.end()) {
- return fLabelMap[path];
- } else {
- return -1;
- }
+ std::string path = std::string(path_aux);
+ auto it = find_if(fItems.begin(), fItems.end(), [=](const Item& it) {
+ return (it.fLabel == path) || (it.fShortname == path) || (it.fPath == path);
+ });
+ return (it != fItems.end()) ? int(it - fItems.begin()) : -1;
}
- const char* getParamAddress(int p) { return fPaths[p].c_str(); }
- const char* getParamLabel(int p) { return fLabels[p].c_str(); }
+
+ const char* getParamLabel(int p) { return fItems[uint(p)].fLabel.c_str(); }
+ const char* getParamShortname(int p) { return fItems[uint(p)].fShortname.c_str(); }
+ const char* getParamAddress(int p) { return fItems[uint(p)].fPath.c_str(); }
+
std::map<const char*, const char*> getMetadata(int p)
{
std::map<const char*, const char*> res;
- std::map<std::string, std::string> metadata = fMetaData[p];
+ std::map<std::string, std::string> metadata = fMetaData[uint(p)];
for (const auto& it : metadata) {
res[it.first.c_str()] = it.second.c_str();
}
@@ -1406,26 +1724,62 @@ class APIUI
const char* getMetadata(int p, const char* key)
{
- return (fMetaData[p].find(key) != fMetaData[p].end()) ? fMetaData[p][key].c_str()
- : "";
+ return (fMetaData[uint(p)].find(key) != fMetaData[uint(p)].end())
+ ? fMetaData[uint(p)][key].c_str()
+ : "";
}
- FAUSTFLOAT getParamMin(int p) { return fMin[p]; }
- FAUSTFLOAT getParamMax(int p) { return fMax[p]; }
- FAUSTFLOAT getParamStep(int p) { return fStep[p]; }
- FAUSTFLOAT getParamInit(int p) { return fInit[p]; }
+ FAUSTFLOAT getParamMin(int p) { return fItems[uint(p)].fMin; }
+ FAUSTFLOAT getParamMax(int p) { return fItems[uint(p)].fMax; }
+ FAUSTFLOAT getParamStep(int p) { return fItems[uint(p)].fStep; }
+ FAUSTFLOAT getParamInit(int p) { return fItems[uint(p)].fInit; }
+
+ FAUSTFLOAT* getParamZone(int p) { return fItems[uint(p)].fZone; }
- FAUSTFLOAT* getParamZone(int p) { return fZone[p]; }
- FAUSTFLOAT getParamValue(int p) { return *fZone[p]; }
- void setParamValue(int p, FAUSTFLOAT v) { *fZone[p] = v; }
+ FAUSTFLOAT getParamValue(int p) { return *fItems[uint(p)].fZone; }
+ FAUSTFLOAT getParamValue(const char* path)
+ {
+ int index = getParamIndex(path);
+ if (index >= 0) {
+ return getParamValue(index);
+ } else {
+ fprintf(stderr, "getParamValue : '%s' not found\n",
+ (path == nullptr ? "NULL" : path));
+ return FAUSTFLOAT(0);
+ }
+ }
- double getParamRatio(int p) { return fConversion[p]->faust2ui(*fZone[p]); }
- void setParamRatio(int p, double r) { *fZone[p] = fConversion[p]->ui2faust(r); }
+ void setParamValue(int p, FAUSTFLOAT v) { *fItems[uint(p)].fZone = v; }
+ void setParamValue(const char* path, FAUSTFLOAT v)
+ {
+ int index = getParamIndex(path);
+ if (index >= 0) {
+ setParamValue(index, v);
+ } else {
+ fprintf(stderr, "setParamValue : '%s' not found\n",
+ (path == nullptr ? "NULL" : path));
+ }
+ }
- double value2ratio(int p, double r) { return fConversion[p]->faust2ui(r); }
- double ratio2value(int p, double r) { return fConversion[p]->ui2faust(r); }
+ double getParamRatio(int p)
+ {
+ return fItems[uint(p)].fConversion->faust2ui(*fItems[uint(p)].fZone);
+ }
+ void setParamRatio(int p, double r)
+ {
+ *fItems[uint(p)].fZone = FAUSTFLOAT(fItems[uint(p)].fConversion->ui2faust(r));
+ }
+
+ double value2ratio(int p, double r)
+ {
+ return fItems[uint(p)].fConversion->faust2ui(r);
+ }
+ double ratio2value(int p, double r)
+ {
+ return fItems[uint(p)].fConversion->ui2faust(r);
+ }
/**
- * Return the control type (kAcc, kGyr, or -1) for a given parameter
+ * Return the control type (kAcc, kGyr, or -1) for a given parameter.
*
* @param p - the UI parameter index
*
@@ -1447,13 +1801,13 @@ class APIUI
/**
* Return the Item type (kButton = 0, kCheckButton, kVSlider, kHSlider, kNumEntry,
- * kHBargraph, kVBargraph) for a given parameter
+ * kHBargraph, kVBargraph) for a given parameter.
*
* @param p - the UI parameter index
*
* @return the Item type
*/
- ItemType getParamItemType(int p) { return fItemType[p]; }
+ ItemType getParamItemType(int p) { return fItems[uint(p)].fItemType; }
/**
* Set a new value coming from an accelerometer, propagate it to all relevant
@@ -1493,7 +1847,7 @@ class APIUI
* given UI parameter.
*
* @param p - the UI parameter index
- * @param acc - 0 for X gyroscope, 1 for Y gyroscope, 2 for Z gyroscope (-1 means "no
+ * @param gyr - 0 for X gyroscope, 1 for Y gyroscope, 2 for Z gyroscope (-1 means "no
* mapping")
* @param curve - between 0 and 3
* @param amin - mapping 'min' point
@@ -1558,7 +1912,7 @@ class APIUI
}
/**
- * Get the number of FAUSTFLOAT* zones controlled with the accelerometer
+ * Get the number of FAUSTFLOAT* zones controlled with the accelerometer.
*
* @param acc - 0 for X accelerometer, 1 for Y accelerometer, 2 for Z accelerometer
* @return the number of zones
@@ -1567,7 +1921,7 @@ class APIUI
int getAccCount(int acc) { return (acc >= 0 && acc < 3) ? int(fAcc[acc].size()) : 0; }
/**
- * Get the number of FAUSTFLOAT* zones controlled with the gyroscope
+ * Get the number of FAUSTFLOAT* zones controlled with the gyroscope.
*
* @param gyr - 0 for X gyroscope, 1 for Y gyroscope, 2 for Z gyroscope
* @param the number of zones
@@ -1604,8 +1958,11 @@ class APIUI
#define FAUSTFLOAT float
#endif
+#include <math.h>
+
#include <algorithm>
#include <cmath>
+#include <cstdint>
#ifndef FAUSTCLASS
#define FAUSTCLASS freeverbdsp
@@ -1616,18 +1973,23 @@ class APIUI
#define exp10 __exp10
#endif
+#if defined(_WIN32)
+#define RESTRICT __restrict
+#else
+#define RESTRICT __restrict__
+#endif
+
class freeverbdsp : public dsp
{
private:
int fSampleRate;
- float fConst0;
float fConst1;
FAUSTFLOAT fVslider0;
float fConst2;
FAUSTFLOAT fVslider1;
float fRec9[2];
FAUSTFLOAT fVslider2;
- int IOTA;
+ int IOTA0;
float fVec0[8192];
int iConst3;
float fRec8[2];
@@ -1714,6 +2076,9 @@ class freeverbdsp : public dsp
void metadata(Meta* m)
{
m->declare("author", "Romain Michon");
+ m->declare("compile_options",
+ "-a faust2header.cpp -lang cpp -i -inpl -cn freeverbdsp -es 1 -mcd 16 "
+ "-single -ftz 0");
m->declare("delays.lib/name", "Faust Delay Library");
m->declare("delays.lib/version", "0.1");
m->declare("description",
@@ -1727,86 +2092,52 @@ class freeverbdsp : public dsp
m->declare("filters.lib/allpass_comb:license", "MIT-style STK-4.3 license");
m->declare("filters.lib/lowpass0_highpass1", "MIT-style STK-4.3 license");
m->declare("filters.lib/name", "Faust Filters Library");
+ m->declare("filters.lib/version", "0.3");
m->declare("license", "LGPL");
m->declare("maths.lib/author", "GRAME");
m->declare("maths.lib/copyright", "GRAME");
m->declare("maths.lib/license", "LGPL with exception");
m->declare("maths.lib/name", "Faust Math Library");
- m->declare("maths.lib/version", "2.3");
+ m->declare("maths.lib/version", "2.5");
m->declare("name", "freeverb");
m->declare("platform.lib/name", "Generic Platform Library");
- m->declare("platform.lib/version", "0.1");
+ m->declare("platform.lib/version", "0.2");
+ m->declare("reverbs.lib/mono_freeverb:author", "Romain Michon");
m->declare("reverbs.lib/name", "Faust Reverb Library");
- m->declare("reverbs.lib/version", "0.0");
+ m->declare("reverbs.lib/stereo_freeverb:author", "Romain Michon");
+ m->declare("reverbs.lib/version", "0.2");
m->declare("version", "0.0");
}
virtual int getNumInputs() { return 2; }
virtual int getNumOutputs() { return 2; }
- virtual int getInputRate(int channel)
- {
- int rate;
- switch ((channel)) {
- case 0: {
- rate = 1;
- break;
- }
- case 1: {
- rate = 1;
- break;
- }
- default: {
- rate = -1;
- break;
- }
- }
- return rate;
- }
- virtual int getOutputRate(int channel)
- {
- int rate;
- switch ((channel)) {
- case 0: {
- rate = 1;
- break;
- }
- case 1: {
- rate = 1;
- break;
- }
- default: {
- rate = -1;
- break;
- }
- }
- return rate;
- }
static void classInit(int /*sample_rate*/) {}
virtual void instanceConstants(int sample_rate)
{
fSampleRate = sample_rate;
- fConst0 = std::min<float>(192000.0f, std::max<float>(1.0f, float(fSampleRate)));
- fConst1 = (12348.0f / fConst0);
- fConst2 = (17640.0f / fConst0);
- iConst3 = int((0.0253061224f * fConst0));
- iConst4 = int((0.0269387756f * fConst0));
- iConst5 = int((0.0289569162f * fConst0));
- iConst6 = int((0.0307482984f * fConst0));
- iConst7 = int((0.0322448984f * fConst0));
- iConst8 = int((0.033809524f * fConst0));
- iConst9 = int((0.0353061222f * fConst0));
- iConst10 = int((0.0366666652f * fConst0));
- iConst11 = int((0.0126077095f * fConst0));
- iConst12 = std::min<int>(1024, std::max<int>(0, (iConst11 + -1)));
- iConst13 = int((0.00999999978f * fConst0));
- iConst14 = std::min<int>(1024, std::max<int>(0, (iConst13 + -1)));
- iConst15 = int((0.00773242628f * fConst0));
- iConst16 = std::min<int>(1024, std::max<int>(0, (iConst15 + -1)));
- iConst17 = int((0.00510204071f * fConst0));
- iConst18 = std::min<int>(1024, std::max<int>(0, (iConst17 + -1)));
- fConst19 = (0.00104308384f * fConst0);
+ float fConst0 =
+ std::min<float>(192000.0f, std::max<float>(1.0f, float(fSampleRate)));
+ fConst1 = 12348.0f / fConst0;
+ fConst2 = 17640.0f / fConst0;
+ iConst3 = int(0.0253061224f * fConst0);
+ iConst4 = int(0.0269387756f * fConst0);
+ iConst5 = int(0.0289569162f * fConst0);
+ iConst6 = int(0.0307482984f * fConst0);
+ iConst7 = int(0.0322448984f * fConst0);
+ iConst8 = int(0.033809524f * fConst0);
+ iConst9 = int(0.0353061222f * fConst0);
+ iConst10 = int(0.0366666652f * fConst0);
+ iConst11 = int(0.0126077095f * fConst0);
+ iConst12 = std::min<int>(1024, std::max<int>(0, iConst11 + -1));
+ iConst13 = int(0.00999999978f * fConst0);
+ iConst14 = std::min<int>(1024, std::max<int>(0, iConst13 + -1));
+ iConst15 = int(0.00773242628f * fConst0);
+ iConst16 = std::min<int>(1024, std::max<int>(0, iConst15 + -1));
+ iConst17 = int(0.00510204071f * fConst0);
+ iConst18 = std::min<int>(1024, std::max<int>(0, iConst17 + -1));
+ fConst19 = 0.00104308384f * fConst0;
}
virtual void instanceResetUserInterface()
@@ -1819,197 +2150,197 @@ class freeverbdsp : public dsp
virtual void instanceClear()
{
- for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) {
+ for (int l0 = 0; l0 < 2; l0 = l0 + 1) {
fRec9[l0] = 0.0f;
}
- IOTA = 0;
- for (int l1 = 0; (l1 < 8192); l1 = (l1 + 1)) {
+ IOTA0 = 0;
+ for (int l1 = 0; l1 < 8192; l1 = l1 + 1) {
fVec0[l1] = 0.0f;
}
- for (int l2 = 0; (l2 < 2); l2 = (l2 + 1)) {
+ for (int l2 = 0; l2 < 2; l2 = l2 + 1) {
fRec8[l2] = 0.0f;
}
- for (int l3 = 0; (l3 < 2); l3 = (l3 + 1)) {
+ for (int l3 = 0; l3 < 2; l3 = l3 + 1) {
fRec11[l3] = 0.0f;
}
- for (int l4 = 0; (l4 < 8192); l4 = (l4 + 1)) {
+ for (int l4 = 0; l4 < 8192; l4 = l4 + 1) {
fVec1[l4] = 0.0f;
}
- for (int l5 = 0; (l5 < 2); l5 = (l5 + 1)) {
+ for (int l5 = 0; l5 < 2; l5 = l5 + 1) {
fRec10[l5] = 0.0f;
}
- for (int l6 = 0; (l6 < 2); l6 = (l6 + 1)) {
+ for (int l6 = 0; l6 < 2; l6 = l6 + 1) {
fRec13[l6] = 0.0f;
}
- for (int l7 = 0; (l7 < 8192); l7 = (l7 + 1)) {
+ for (int l7 = 0; l7 < 8192; l7 = l7 + 1) {
fVec2[l7] = 0.0f;
}
- for (int l8 = 0; (l8 < 2); l8 = (l8 + 1)) {
+ for (int l8 = 0; l8 < 2; l8 = l8 + 1) {
fRec12[l8] = 0.0f;
}
- for (int l9 = 0; (l9 < 2); l9 = (l9 + 1)) {
+ for (int l9 = 0; l9 < 2; l9 = l9 + 1) {
fRec15[l9] = 0.0f;
}
- for (int l10 = 0; (l10 < 8192); l10 = (l10 + 1)) {
+ for (int l10 = 0; l10 < 8192; l10 = l10 + 1) {
fVec3[l10] = 0.0f;
}
- for (int l11 = 0; (l11 < 2); l11 = (l11 + 1)) {
+ for (int l11 = 0; l11 < 2; l11 = l11 + 1) {
fRec14[l11] = 0.0f;
}
- for (int l12 = 0; (l12 < 2); l12 = (l12 + 1)) {
+ for (int l12 = 0; l12 < 2; l12 = l12 + 1) {
fRec17[l12] = 0.0f;
}
- for (int l13 = 0; (l13 < 8192); l13 = (l13 + 1)) {
+ for (int l13 = 0; l13 < 8192; l13 = l13 + 1) {
fVec4[l13] = 0.0f;
}
- for (int l14 = 0; (l14 < 2); l14 = (l14 + 1)) {
+ for (int l14 = 0; l14 < 2; l14 = l14 + 1) {
fRec16[l14] = 0.0f;
}
- for (int l15 = 0; (l15 < 2); l15 = (l15 + 1)) {
+ for (int l15 = 0; l15 < 2; l15 = l15 + 1) {
fRec19[l15] = 0.0f;
}
- for (int l16 = 0; (l16 < 8192); l16 = (l16 + 1)) {
+ for (int l16 = 0; l16 < 8192; l16 = l16 + 1) {
fVec5[l16] = 0.0f;
}
- for (int l17 = 0; (l17 < 2); l17 = (l17 + 1)) {
+ for (int l17 = 0; l17 < 2; l17 = l17 + 1) {
fRec18[l17] = 0.0f;
}
- for (int l18 = 0; (l18 < 2); l18 = (l18 + 1)) {
+ for (int l18 = 0; l18 < 2; l18 = l18 + 1) {
fRec21[l18] = 0.0f;
}
- for (int l19 = 0; (l19 < 8192); l19 = (l19 + 1)) {
+ for (int l19 = 0; l19 < 8192; l19 = l19 + 1) {
fVec6[l19] = 0.0f;
}
- for (int l20 = 0; (l20 < 2); l20 = (l20 + 1)) {
+ for (int l20 = 0; l20 < 2; l20 = l20 + 1) {
fRec20[l20] = 0.0f;
}
- for (int l21 = 0; (l21 < 2); l21 = (l21 + 1)) {
+ for (int l21 = 0; l21 < 2; l21 = l21 + 1) {
fRec23[l21] = 0.0f;
}
- for (int l22 = 0; (l22 < 8192); l22 = (l22 + 1)) {
+ for (int l22 = 0; l22 < 8192; l22 = l22 + 1) {
fVec7[l22] = 0.0f;
}
- for (int l23 = 0; (l23 < 2); l23 = (l23 + 1)) {
+ for (int l23 = 0; l23 < 2; l23 = l23 + 1) {
fRec22[l23] = 0.0f;
}
- for (int l24 = 0; (l24 < 2048); l24 = (l24 + 1)) {
+ for (int l24 = 0; l24 < 2048; l24 = l24 + 1) {
fVec8[l24] = 0.0f;
}
- for (int l25 = 0; (l25 < 2); l25 = (l25 + 1)) {
+ for (int l25 = 0; l25 < 2; l25 = l25 + 1) {
fRec6[l25] = 0.0f;
}
- for (int l26 = 0; (l26 < 2048); l26 = (l26 + 1)) {
+ for (int l26 = 0; l26 < 2048; l26 = l26 + 1) {
fVec9[l26] = 0.0f;
}
- for (int l27 = 0; (l27 < 2); l27 = (l27 + 1)) {
+ for (int l27 = 0; l27 < 2; l27 = l27 + 1) {
fRec4[l27] = 0.0f;
}
- for (int l28 = 0; (l28 < 2048); l28 = (l28 + 1)) {
+ for (int l28 = 0; l28 < 2048; l28 = l28 + 1) {
fVec10[l28] = 0.0f;
}
- for (int l29 = 0; (l29 < 2); l29 = (l29 + 1)) {
+ for (int l29 = 0; l29 < 2; l29 = l29 + 1) {
fRec2[l29] = 0.0f;
}
- for (int l30 = 0; (l30 < 1024); l30 = (l30 + 1)) {
+ for (int l30 = 0; l30 < 1024; l30 = l30 + 1) {
fVec11[l30] = 0.0f;
}
- for (int l31 = 0; (l31 < 2); l31 = (l31 + 1)) {
+ for (int l31 = 0; l31 < 2; l31 = l31 + 1) {
fRec0[l31] = 0.0f;
}
- for (int l32 = 0; (l32 < 2); l32 = (l32 + 1)) {
+ for (int l32 = 0; l32 < 2; l32 = l32 + 1) {
fRec33[l32] = 0.0f;
}
- for (int l33 = 0; (l33 < 8192); l33 = (l33 + 1)) {
+ for (int l33 = 0; l33 < 8192; l33 = l33 + 1) {
fVec12[l33] = 0.0f;
}
- for (int l34 = 0; (l34 < 2); l34 = (l34 + 1)) {
+ for (int l34 = 0; l34 < 2; l34 = l34 + 1) {
fRec32[l34] = 0.0f;
}
- for (int l35 = 0; (l35 < 2); l35 = (l35 + 1)) {
+ for (int l35 = 0; l35 < 2; l35 = l35 + 1) {
fRec35[l35] = 0.0f;
}
- for (int l36 = 0; (l36 < 8192); l36 = (l36 + 1)) {
+ for (int l36 = 0; l36 < 8192; l36 = l36 + 1) {
fVec13[l36] = 0.0f;
}
- for (int l37 = 0; (l37 < 2); l37 = (l37 + 1)) {
+ for (int l37 = 0; l37 < 2; l37 = l37 + 1) {
fRec34[l37] = 0.0f;
}
- for (int l38 = 0; (l38 < 2); l38 = (l38 + 1)) {
+ for (int l38 = 0; l38 < 2; l38 = l38 + 1) {
fRec37[l38] = 0.0f;
}
- for (int l39 = 0; (l39 < 8192); l39 = (l39 + 1)) {
+ for (int l39 = 0; l39 < 8192; l39 = l39 + 1) {
fVec14[l39] = 0.0f;
}
- for (int l40 = 0; (l40 < 2); l40 = (l40 + 1)) {
+ for (int l40 = 0; l40 < 2; l40 = l40 + 1) {
fRec36[l40] = 0.0f;
}
- for (int l41 = 0; (l41 < 2); l41 = (l41 + 1)) {
+ for (int l41 = 0; l41 < 2; l41 = l41 + 1) {
fRec39[l41] = 0.0f;
}
- for (int l42 = 0; (l42 < 8192); l42 = (l42 + 1)) {
+ for (int l42 = 0; l42 < 8192; l42 = l42 + 1) {
fVec15[l42] = 0.0f;
}
- for (int l43 = 0; (l43 < 2); l43 = (l43 + 1)) {
+ for (int l43 = 0; l43 < 2; l43 = l43 + 1) {
fRec38[l43] = 0.0f;
}
- for (int l44 = 0; (l44 < 2); l44 = (l44 + 1)) {
+ for (int l44 = 0; l44 < 2; l44 = l44 + 1) {
fRec41[l44] = 0.0f;
}
- for (int l45 = 0; (l45 < 8192); l45 = (l45 + 1)) {
+ for (int l45 = 0; l45 < 8192; l45 = l45 + 1) {
fVec16[l45] = 0.0f;
}
- for (int l46 = 0; (l46 < 2); l46 = (l46 + 1)) {
+ for (int l46 = 0; l46 < 2; l46 = l46 + 1) {
fRec40[l46] = 0.0f;
}
- for (int l47 = 0; (l47 < 2); l47 = (l47 + 1)) {
+ for (int l47 = 0; l47 < 2; l47 = l47 + 1) {
fRec43[l47] = 0.0f;
}
- for (int l48 = 0; (l48 < 8192); l48 = (l48 + 1)) {
+ for (int l48 = 0; l48 < 8192; l48 = l48 + 1) {
fVec17[l48] = 0.0f;
}
- for (int l49 = 0; (l49 < 2); l49 = (l49 + 1)) {
+ for (int l49 = 0; l49 < 2; l49 = l49 + 1) {
fRec42[l49] = 0.0f;
}
- for (int l50 = 0; (l50 < 2); l50 = (l50 + 1)) {
+ for (int l50 = 0; l50 < 2; l50 = l50 + 1) {
fRec45[l50] = 0.0f;
}
- for (int l51 = 0; (l51 < 8192); l51 = (l51 + 1)) {
+ for (int l51 = 0; l51 < 8192; l51 = l51 + 1) {
fVec18[l51] = 0.0f;
}
- for (int l52 = 0; (l52 < 2); l52 = (l52 + 1)) {
+ for (int l52 = 0; l52 < 2; l52 = l52 + 1) {
fRec44[l52] = 0.0f;
}
- for (int l53 = 0; (l53 < 2); l53 = (l53 + 1)) {
+ for (int l53 = 0; l53 < 2; l53 = l53 + 1) {
fRec47[l53] = 0.0f;
}
- for (int l54 = 0; (l54 < 8192); l54 = (l54 + 1)) {
+ for (int l54 = 0; l54 < 8192; l54 = l54 + 1) {
fVec19[l54] = 0.0f;
}
- for (int l55 = 0; (l55 < 2); l55 = (l55 + 1)) {
+ for (int l55 = 0; l55 < 2; l55 = l55 + 1) {
fRec46[l55] = 0.0f;
}
- for (int l56 = 0; (l56 < 2048); l56 = (l56 + 1)) {
+ for (int l56 = 0; l56 < 2048; l56 = l56 + 1) {
fVec20[l56] = 0.0f;
}
- for (int l57 = 0; (l57 < 2); l57 = (l57 + 1)) {
+ for (int l57 = 0; l57 < 2; l57 = l57 + 1) {
fRec30[l57] = 0.0f;
}
- for (int l58 = 0; (l58 < 2048); l58 = (l58 + 1)) {
+ for (int l58 = 0; l58 < 2048; l58 = l58 + 1) {
fVec21[l58] = 0.0f;
}
- for (int l59 = 0; (l59 < 2); l59 = (l59 + 1)) {
+ for (int l59 = 0; l59 < 2; l59 = l59 + 1) {
fRec28[l59] = 0.0f;
}
- for (int l60 = 0; (l60 < 2048); l60 = (l60 + 1)) {
+ for (int l60 = 0; l60 < 2048; l60 = l60 + 1) {
fVec22[l60] = 0.0f;
}
- for (int l61 = 0; (l61 < 2); l61 = (l61 + 1)) {
+ for (int l61 = 0; l61 < 2; l61 = l61 + 1) {
fRec26[l61] = 0.0f;
}
- for (int l62 = 0; (l62 < 2048); l62 = (l62 + 1)) {
+ for (int l62 = 0; l62 < 2048; l62 = l62 + 1) {
fVec23[l62] = 0.0f;
}
- for (int l63 = 0; (l63 < 2); l63 = (l63 + 1)) {
+ for (int l63 = 0; l63 < 2; l63 = l63 + 1) {
fRec24[l63] = 0.0f;
}
}
@@ -2039,29 +2370,33 @@ class freeverbdsp : public dsp
ui_interface->declare(&fVslider1, "style", "knob");
ui_interface->declare(&fVslider1, "tooltip",
"Somehow control the density of the reverb.");
- ui_interface->addVerticalSlider("Damp", &fVslider1, 0.5f, 0.0f, 1.0f,
- 0.0250000004f);
+ ui_interface->addVerticalSlider("Damp", &fVslider1, FAUSTFLOAT(0.5f),
+ FAUSTFLOAT(0.0f), FAUSTFLOAT(1.0f),
+ FAUSTFLOAT(0.0250000004f));
ui_interface->declare(&fVslider0, "1", "");
ui_interface->declare(&fVslider0, "style", "knob");
ui_interface->declare(
&fVslider0, "tooltip",
"The room size between 0 and 1 with 1 for the largest room.");
- ui_interface->addVerticalSlider("RoomSize", &fVslider0, 0.100000001f, 0.0f, 1.0f,
- 0.0250000004f);
+ ui_interface->addVerticalSlider("RoomSize", &fVslider0, FAUSTFLOAT(0.100000001f),
+ FAUSTFLOAT(0.0f), FAUSTFLOAT(1.0f),
+ FAUSTFLOAT(0.0250000004f));
ui_interface->declare(&fVslider3, "2", "");
ui_interface->declare(&fVslider3, "style", "knob");
ui_interface->declare(
&fVslider3, "tooltip",
"Spatial spread between 0 and 1 with 1 for maximum spread.");
- ui_interface->addVerticalSlider("Stereo Spread", &fVslider3, 0.5f, 0.0f, 1.0f,
- 0.00999999978f);
+ ui_interface->addVerticalSlider("Stereo Spread", &fVslider3, FAUSTFLOAT(0.5f),
+ FAUSTFLOAT(0.0f), FAUSTFLOAT(1.0f),
+ FAUSTFLOAT(0.00999999978f));
ui_interface->closeBox();
ui_interface->declare(&fVslider2, "1", "");
ui_interface->declare(&fVslider2, "tooltip",
"The amount of reverb applied to the signal between 0 "
"and 1 with 1 for the maximum amount of reverb.");
- ui_interface->addVerticalSlider("Wet", &fVslider2, 0.100000001f, 0.0f, 1.0f,
- 0.0250000004f);
+ ui_interface->addVerticalSlider("Wet", &fVslider2, FAUSTFLOAT(0.100000001f),
+ FAUSTFLOAT(0.0f), FAUSTFLOAT(1.0f),
+ FAUSTFLOAT(0.0250000004f));
ui_interface->closeBox();
}
@@ -2071,163 +2406,155 @@ class freeverbdsp : public dsp
FAUSTFLOAT* input1 = inputs[1];
FAUSTFLOAT* output0 = outputs[0];
FAUSTFLOAT* output1 = outputs[1];
- float fSlow0 = ((fConst1 * float(fVslider0)) + 0.699999988f);
- float fSlow1 = (fConst2 * float(fVslider1));
- float fSlow2 = (1.0f - fSlow1);
+ float fSlow0 = fConst1 * float(fVslider0) + 0.699999988f;
+ float fSlow1 = fConst2 * float(fVslider1);
+ float fSlow2 = 1.0f - fSlow1;
float fSlow3 = float(fVslider2);
- float fSlow4 = (0.100000001f * fSlow3);
- float fSlow5 = (1.0f - fSlow3);
- int iSlow6 = int((fConst19 * float(fVslider3)));
- int iSlow7 = (iConst3 + iSlow6);
- int iSlow8 = (iConst4 + iSlow6);
- int iSlow9 = (iConst5 + iSlow6);
- int iSlow10 = (iConst6 + iSlow6);
- int iSlow11 = (iConst7 + iSlow6);
- int iSlow12 = (iConst8 + iSlow6);
- int iSlow13 = (iConst9 + iSlow6);
- int iSlow14 = (iConst10 + iSlow6);
- int iSlow15 = (iSlow6 + -1);
- int iSlow16 = std::min<int>(1024, std::max<int>(0, (iConst11 + iSlow15)));
- int iSlow17 = std::min<int>(1024, std::max<int>(0, (iConst13 + iSlow15)));
- int iSlow18 = std::min<int>(1024, std::max<int>(0, (iConst15 + iSlow15)));
- int iSlow19 = std::min<int>(1024, std::max<int>(0, (iConst17 + iSlow15)));
- for (int i = 0; (i < count); i = (i + 1)) {
- float fTemp0 = float(input0[i]);
- float fTemp1 = float(input1[i]);
- fRec9[0] = ((fSlow1 * fRec9[1]) + (fSlow2 * fRec8[1]));
- float fTemp2 = (fSlow4 * (fTemp0 + fTemp1));
- fVec0[(IOTA & 8191)] = ((fSlow0 * fRec9[0]) + fTemp2);
- fRec8[0] = fVec0[((IOTA - iConst3) & 8191)];
- fRec11[0] = ((fSlow1 * fRec11[1]) + (fSlow2 * fRec10[1]));
- fVec1[(IOTA & 8191)] = (fTemp2 + (fSlow0 * fRec11[0]));
- fRec10[0] = fVec1[((IOTA - iConst4) & 8191)];
- fRec13[0] = ((fSlow1 * fRec13[1]) + (fSlow2 * fRec12[1]));
- fVec2[(IOTA & 8191)] = (fTemp2 + (fSlow0 * fRec13[0]));
- fRec12[0] = fVec2[((IOTA - iConst5) & 8191)];
- fRec15[0] = ((fSlow1 * fRec15[1]) + (fSlow2 * fRec14[1]));
- fVec3[(IOTA & 8191)] = (fTemp2 + (fSlow0 * fRec15[0]));
- fRec14[0] = fVec3[((IOTA - iConst6) & 8191)];
- fRec17[0] = ((fSlow1 * fRec17[1]) + (fSlow2 * fRec16[1]));
- fVec4[(IOTA & 8191)] = (fTemp2 + (fSlow0 * fRec17[0]));
- fRec16[0] = fVec4[((IOTA - iConst7) & 8191)];
- fRec19[0] = ((fSlow1 * fRec19[1]) + (fSlow2 * fRec18[1]));
- fVec5[(IOTA & 8191)] = (fTemp2 + (fSlow0 * fRec19[0]));
- fRec18[0] = fVec5[((IOTA - iConst8) & 8191)];
- fRec21[0] = ((fSlow1 * fRec21[1]) + (fSlow2 * fRec20[1]));
- fVec6[(IOTA & 8191)] = (fTemp2 + (fSlow0 * fRec21[0]));
- fRec20[0] = fVec6[((IOTA - iConst9) & 8191)];
- fRec23[0] = ((fSlow1 * fRec23[1]) + (fSlow2 * fRec22[1]));
- fVec7[(IOTA & 8191)] = (fTemp2 + (fSlow0 * fRec23[0]));
- fRec22[0] = fVec7[((IOTA - iConst10) & 8191)];
- float fTemp3 =
- ((((((((fRec8[0] + fRec10[0]) + fRec12[0]) + fRec14[0]) + fRec16[0])
- + fRec18[0])
- + fRec20[0])
- + fRec22[0])
- + (0.5f * fRec6[1]));
- fVec8[(IOTA & 2047)] = fTemp3;
- fRec6[0] = fVec8[((IOTA - iConst12) & 2047)];
- float fRec7 = (0.0f - (0.5f * fTemp3));
- float fTemp4 = (fRec6[1] + (fRec7 + (0.5f * fRec4[1])));
- fVec9[(IOTA & 2047)] = fTemp4;
- fRec4[0] = fVec9[((IOTA - iConst14) & 2047)];
- float fRec5 = (0.0f - (0.5f * fTemp4));
- float fTemp5 = (fRec4[1] + (fRec5 + (0.5f * fRec2[1])));
- fVec10[(IOTA & 2047)] = fTemp5;
- fRec2[0] = fVec10[((IOTA - iConst16) & 2047)];
- float fRec3 = (0.0f - (0.5f * fTemp5));
- float fTemp6 = (fRec2[1] + (fRec3 + (0.5f * fRec0[1])));
- fVec11[(IOTA & 1023)] = fTemp6;
- fRec0[0] = fVec11[((IOTA - iConst18) & 1023)];
- float fRec1 = (0.0f - (0.5f * fTemp6));
- output0[i] = FAUSTFLOAT(((fRec1 + fRec0[1]) + (fSlow5 * fTemp0)));
- fRec33[0] = ((fSlow1 * fRec33[1]) + (fSlow2 * fRec32[1]));
- fVec12[(IOTA & 8191)] = (fTemp2 + (fSlow0 * fRec33[0]));
- fRec32[0] = fVec12[((IOTA - iSlow7) & 8191)];
- fRec35[0] = ((fSlow1 * fRec35[1]) + (fSlow2 * fRec34[1]));
- fVec13[(IOTA & 8191)] = (fTemp2 + (fSlow0 * fRec35[0]));
- fRec34[0] = fVec13[((IOTA - iSlow8) & 8191)];
- fRec37[0] = ((fSlow1 * fRec37[1]) + (fSlow2 * fRec36[1]));
- fVec14[(IOTA & 8191)] = (fTemp2 + (fSlow0 * fRec37[0]));
- fRec36[0] = fVec14[((IOTA - iSlow9) & 8191)];
- fRec39[0] = ((fSlow1 * fRec39[1]) + (fSlow2 * fRec38[1]));
- fVec15[(IOTA & 8191)] = (fTemp2 + (fSlow0 * fRec39[0]));
- fRec38[0] = fVec15[((IOTA - iSlow10) & 8191)];
- fRec41[0] = ((fSlow1 * fRec41[1]) + (fSlow2 * fRec40[1]));
- fVec16[(IOTA & 8191)] = (fTemp2 + (fSlow0 * fRec41[0]));
- fRec40[0] = fVec16[((IOTA - iSlow11) & 8191)];
- fRec43[0] = ((fSlow1 * fRec43[1]) + (fSlow2 * fRec42[1]));
- fVec17[(IOTA & 8191)] = (fTemp2 + (fSlow0 * fRec43[0]));
- fRec42[0] = fVec17[((IOTA - iSlow12) & 8191)];
- fRec45[0] = ((fSlow1 * fRec45[1]) + (fSlow2 * fRec44[1]));
- fVec18[(IOTA & 8191)] = (fTemp2 + (fSlow0 * fRec45[0]));
- fRec44[0] = fVec18[((IOTA - iSlow13) & 8191)];
- fRec47[0] = ((fSlow1 * fRec47[1]) + (fSlow2 * fRec46[1]));
- fVec19[(IOTA & 8191)] = (fTemp2 + (fSlow0 * fRec47[0]));
- fRec46[0] = fVec19[((IOTA - iSlow14) & 8191)];
- float fTemp7 =
- ((((((((fRec32[0] + fRec34[0]) + fRec36[0]) + fRec38[0]) + fRec40[0])
- + fRec42[0])
- + fRec44[0])
- + fRec46[0])
- + (0.5f * fRec30[1]));
- fVec20[(IOTA & 2047)] = fTemp7;
- fRec30[0] = fVec20[((IOTA - iSlow16) & 2047)];
- float fRec31 = (0.0f - (0.5f * fTemp7));
- float fTemp8 = (fRec30[1] + (fRec31 + (0.5f * fRec28[1])));
- fVec21[(IOTA & 2047)] = fTemp8;
- fRec28[0] = fVec21[((IOTA - iSlow17) & 2047)];
- float fRec29 = (0.0f - (0.5f * fTemp8));
- float fTemp9 = (fRec28[1] + (fRec29 + (0.5f * fRec26[1])));
- fVec22[(IOTA & 2047)] = fTemp9;
- fRec26[0] = fVec22[((IOTA - iSlow18) & 2047)];
- float fRec27 = (0.0f - (0.5f * fTemp9));
- float fTemp10 = (fRec26[1] + (fRec27 + (0.5f * fRec24[1])));
- fVec23[(IOTA & 2047)] = fTemp10;
- fRec24[0] = fVec23[((IOTA - iSlow19) & 2047)];
- float fRec25 = (0.0f - (0.5f * fTemp10));
- output1[i] = FAUSTFLOAT(((fRec25 + fRec24[1]) + (fSlow5 * fTemp1)));
- fRec9[1] = fRec9[0];
- IOTA = (IOTA + 1);
- fRec8[1] = fRec8[0];
- fRec11[1] = fRec11[0];
- fRec10[1] = fRec10[0];
- fRec13[1] = fRec13[0];
- fRec12[1] = fRec12[0];
- fRec15[1] = fRec15[0];
- fRec14[1] = fRec14[0];
- fRec17[1] = fRec17[0];
- fRec16[1] = fRec16[0];
- fRec19[1] = fRec19[0];
- fRec18[1] = fRec18[0];
- fRec21[1] = fRec21[0];
- fRec20[1] = fRec20[0];
- fRec23[1] = fRec23[0];
- fRec22[1] = fRec22[0];
- fRec6[1] = fRec6[0];
- fRec4[1] = fRec4[0];
- fRec2[1] = fRec2[0];
- fRec0[1] = fRec0[0];
- fRec33[1] = fRec33[0];
- fRec32[1] = fRec32[0];
- fRec35[1] = fRec35[0];
- fRec34[1] = fRec34[0];
- fRec37[1] = fRec37[0];
- fRec36[1] = fRec36[0];
- fRec39[1] = fRec39[0];
- fRec38[1] = fRec38[0];
- fRec41[1] = fRec41[0];
- fRec40[1] = fRec40[0];
- fRec43[1] = fRec43[0];
- fRec42[1] = fRec42[0];
- fRec45[1] = fRec45[0];
- fRec44[1] = fRec44[0];
- fRec47[1] = fRec47[0];
- fRec46[1] = fRec46[0];
- fRec30[1] = fRec30[0];
- fRec28[1] = fRec28[0];
- fRec26[1] = fRec26[0];
- fRec24[1] = fRec24[0];
+ float fSlow4 = 0.100000001f * fSlow3;
+ float fSlow5 = 1.0f - fSlow3;
+ int iSlow6 = int(fConst19 * float(fVslider3));
+ int iSlow7 = iConst3 + iSlow6;
+ int iSlow8 = iConst4 + iSlow6;
+ int iSlow9 = iConst5 + iSlow6;
+ int iSlow10 = iConst6 + iSlow6;
+ int iSlow11 = iConst7 + iSlow6;
+ int iSlow12 = iConst8 + iSlow6;
+ int iSlow13 = iConst9 + iSlow6;
+ int iSlow14 = iConst10 + iSlow6;
+ int iSlow15 = iSlow6 + -1;
+ int iSlow16 = std::min<int>(1024, std::max<int>(0, iConst11 + iSlow15));
+ int iSlow17 = std::min<int>(1024, std::max<int>(0, iConst13 + iSlow15));
+ int iSlow18 = std::min<int>(1024, std::max<int>(0, iConst15 + iSlow15));
+ int iSlow19 = std::min<int>(1024, std::max<int>(0, iConst17 + iSlow15));
+ for (int i0 = 0; i0 < count; i0 = i0 + 1) {
+ float fTemp0 = float(input0[i0]);
+ float fTemp1 = float(input1[i0]);
+ fRec9[0] = fSlow1 * fRec9[1] + fSlow2 * fRec8[1];
+ float fTemp2 = fSlow4 * (fTemp0 + fTemp1);
+ fVec0[IOTA0 & 8191] = fSlow0 * fRec9[0] + fTemp2;
+ fRec8[0] = fVec0[(IOTA0 - iConst3) & 8191];
+ fRec11[0] = fSlow1 * fRec11[1] + fSlow2 * fRec10[1];
+ fVec1[IOTA0 & 8191] = fTemp2 + fSlow0 * fRec11[0];
+ fRec10[0] = fVec1[(IOTA0 - iConst4) & 8191];
+ fRec13[0] = fSlow1 * fRec13[1] + fSlow2 * fRec12[1];
+ fVec2[IOTA0 & 8191] = fTemp2 + fSlow0 * fRec13[0];
+ fRec12[0] = fVec2[(IOTA0 - iConst5) & 8191];
+ fRec15[0] = fSlow1 * fRec15[1] + fSlow2 * fRec14[1];
+ fVec3[IOTA0 & 8191] = fTemp2 + fSlow0 * fRec15[0];
+ fRec14[0] = fVec3[(IOTA0 - iConst6) & 8191];
+ fRec17[0] = fSlow1 * fRec17[1] + fSlow2 * fRec16[1];
+ fVec4[IOTA0 & 8191] = fTemp2 + fSlow0 * fRec17[0];
+ fRec16[0] = fVec4[(IOTA0 - iConst7) & 8191];
+ fRec19[0] = fSlow1 * fRec19[1] + fSlow2 * fRec18[1];
+ fVec5[IOTA0 & 8191] = fTemp2 + fSlow0 * fRec19[0];
+ fRec18[0] = fVec5[(IOTA0 - iConst8) & 8191];
+ fRec21[0] = fSlow1 * fRec21[1] + fSlow2 * fRec20[1];
+ fVec6[IOTA0 & 8191] = fTemp2 + fSlow0 * fRec21[0];
+ fRec20[0] = fVec6[(IOTA0 - iConst9) & 8191];
+ fRec23[0] = fSlow1 * fRec23[1] + fSlow2 * fRec22[1];
+ fVec7[IOTA0 & 8191] = fTemp2 + fSlow0 * fRec23[0];
+ fRec22[0] = fVec7[(IOTA0 - iConst10) & 8191];
+ float fTemp3 = fRec8[0] + fRec10[0] + fRec12[0] + fRec14[0] + fRec16[0]
+ + fRec18[0] + fRec20[0] + fRec22[0] + 0.5f * fRec6[1];
+ fVec8[IOTA0 & 2047] = fTemp3;
+ fRec6[0] = fVec8[(IOTA0 - iConst12) & 2047];
+ float fRec7 = 0.0f - 0.5f * fTemp3;
+ float fTemp4 = fRec6[1] + fRec7 + 0.5f * fRec4[1];
+ fVec9[IOTA0 & 2047] = fTemp4;
+ fRec4[0] = fVec9[(IOTA0 - iConst14) & 2047];
+ float fRec5 = 0.0f - 0.5f * fTemp4;
+ float fTemp5 = fRec4[1] + fRec5 + 0.5f * fRec2[1];
+ fVec10[IOTA0 & 2047] = fTemp5;
+ fRec2[0] = fVec10[(IOTA0 - iConst16) & 2047];
+ float fRec3 = 0.0f - 0.5f * fTemp5;
+ float fTemp6 = fRec2[1] + fRec3 + 0.5f * fRec0[1];
+ fVec11[IOTA0 & 1023] = fTemp6;
+ fRec0[0] = fVec11[(IOTA0 - iConst18) & 1023];
+ float fRec1 = 0.0f - 0.5f * fTemp6;
+ output0[i0] = FAUSTFLOAT(fRec1 + fRec0[1] + fSlow5 * fTemp0);
+ fRec33[0] = fSlow1 * fRec33[1] + fSlow2 * fRec32[1];
+ fVec12[IOTA0 & 8191] = fTemp2 + fSlow0 * fRec33[0];
+ fRec32[0] = fVec12[(IOTA0 - iSlow7) & 8191];
+ fRec35[0] = fSlow1 * fRec35[1] + fSlow2 * fRec34[1];
+ fVec13[IOTA0 & 8191] = fTemp2 + fSlow0 * fRec35[0];
+ fRec34[0] = fVec13[(IOTA0 - iSlow8) & 8191];
+ fRec37[0] = fSlow1 * fRec37[1] + fSlow2 * fRec36[1];
+ fVec14[IOTA0 & 8191] = fTemp2 + fSlow0 * fRec37[0];
+ fRec36[0] = fVec14[(IOTA0 - iSlow9) & 8191];
+ fRec39[0] = fSlow1 * fRec39[1] + fSlow2 * fRec38[1];
+ fVec15[IOTA0 & 8191] = fTemp2 + fSlow0 * fRec39[0];
+ fRec38[0] = fVec15[(IOTA0 - iSlow10) & 8191];
+ fRec41[0] = fSlow1 * fRec41[1] + fSlow2 * fRec40[1];
+ fVec16[IOTA0 & 8191] = fTemp2 + fSlow0 * fRec41[0];
+ fRec40[0] = fVec16[(IOTA0 - iSlow11) & 8191];
+ fRec43[0] = fSlow1 * fRec43[1] + fSlow2 * fRec42[1];
+ fVec17[IOTA0 & 8191] = fTemp2 + fSlow0 * fRec43[0];
+ fRec42[0] = fVec17[(IOTA0 - iSlow12) & 8191];
+ fRec45[0] = fSlow1 * fRec45[1] + fSlow2 * fRec44[1];
+ fVec18[IOTA0 & 8191] = fTemp2 + fSlow0 * fRec45[0];
+ fRec44[0] = fVec18[(IOTA0 - iSlow13) & 8191];
+ fRec47[0] = fSlow1 * fRec47[1] + fSlow2 * fRec46[1];
+ fVec19[IOTA0 & 8191] = fTemp2 + fSlow0 * fRec47[0];
+ fRec46[0] = fVec19[(IOTA0 - iSlow14) & 8191];
+ float fTemp7 = fRec32[0] + fRec34[0] + fRec36[0] + fRec38[0] + fRec40[0]
+ + fRec42[0] + fRec44[0] + fRec46[0] + 0.5f * fRec30[1];
+ fVec20[IOTA0 & 2047] = fTemp7;
+ fRec30[0] = fVec20[(IOTA0 - iSlow16) & 2047];
+ float fRec31 = 0.0f - 0.5f * fTemp7;
+ float fTemp8 = fRec30[1] + fRec31 + 0.5f * fRec28[1];
+ fVec21[IOTA0 & 2047] = fTemp8;
+ fRec28[0] = fVec21[(IOTA0 - iSlow17) & 2047];
+ float fRec29 = 0.0f - 0.5f * fTemp8;
+ float fTemp9 = fRec28[1] + fRec29 + 0.5f * fRec26[1];
+ fVec22[IOTA0 & 2047] = fTemp9;
+ fRec26[0] = fVec22[(IOTA0 - iSlow18) & 2047];
+ float fRec27 = 0.0f - 0.5f * fTemp9;
+ float fTemp10 = fRec26[1] + fRec27 + 0.5f * fRec24[1];
+ fVec23[IOTA0 & 2047] = fTemp10;
+ fRec24[0] = fVec23[(IOTA0 - iSlow19) & 2047];
+ float fRec25 = 0.0f - 0.5f * fTemp10;
+ output1[i0] = FAUSTFLOAT(fRec25 + fRec24[1] + fSlow5 * fTemp1);
+ fRec9[1] = fRec9[0];
+ IOTA0 = IOTA0 + 1;
+ fRec8[1] = fRec8[0];
+ fRec11[1] = fRec11[0];
+ fRec10[1] = fRec10[0];
+ fRec13[1] = fRec13[0];
+ fRec12[1] = fRec12[0];
+ fRec15[1] = fRec15[0];
+ fRec14[1] = fRec14[0];
+ fRec17[1] = fRec17[0];
+ fRec16[1] = fRec16[0];
+ fRec19[1] = fRec19[0];
+ fRec18[1] = fRec18[0];
+ fRec21[1] = fRec21[0];
+ fRec20[1] = fRec20[0];
+ fRec23[1] = fRec23[0];
+ fRec22[1] = fRec22[0];
+ fRec6[1] = fRec6[0];
+ fRec4[1] = fRec4[0];
+ fRec2[1] = fRec2[0];
+ fRec0[1] = fRec0[0];
+ fRec33[1] = fRec33[0];
+ fRec32[1] = fRec32[0];
+ fRec35[1] = fRec35[0];
+ fRec34[1] = fRec34[0];
+ fRec37[1] = fRec37[0];
+ fRec36[1] = fRec36[0];
+ fRec39[1] = fRec39[0];
+ fRec38[1] = fRec38[0];
+ fRec41[1] = fRec41[0];
+ fRec40[1] = fRec40[0];
+ fRec43[1] = fRec43[0];
+ fRec42[1] = fRec42[0];
+ fRec45[1] = fRec45[0];
+ fRec44[1] = fRec44[0];
+ fRec47[1] = fRec47[0];
+ fRec46[1] = fRec46[0];
+ fRec30[1] = fRec30[0];
+ fRec28[1] = fRec28[0];
+ fRec26[1] = fRec26[0];
+ fRec24[1] = fRec24[0];
}
}
};
diff --git a/src/freeverbmonodsp.h b/src/freeverbmonodsp.h
index c7ac161..3318784 100644
--- a/src/freeverbmonodsp.h
+++ b/src/freeverbmonodsp.h
@@ -1,7 +1,8 @@
/* ------------------------------------------------------------
name: "freeverbmonodsp"
-Code generated with Faust 2.28.6 (https://faust.grame.fr)
-Compilation options: -lang cpp -inpl -scal -ftz 0
+Code generated with Faust 2.41.1 (https://faust.grame.fr)
+Compilation options: -a faust2header.cpp -lang cpp -i -inpl -cn freeverbmonodsp -es 1 -mcd
+16 -single -ftz 0
------------------------------------------------------------ */
#ifndef __freeverbmonodsp_H__
@@ -14,23 +15,23 @@ Compilation options: -lang cpp -inpl -scal -ftz 0
// aimed at creating a simple C++ header file (.h) containing a Faust DSP.
// See the Makefile for how to use it.
-/************************** BEGIN dsp.h **************************/
-/************************************************************************
+/************************** BEGIN dsp.h ********************************
FAUST Architecture File
- Copyright (C) 2003-2017 GRAME, Centre National de Creation Musicale
+ Copyright (C) 2003-2022 GRAME, Centre National de Creation Musicale
---------------------------------------------------------------------
- This Architecture section is free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 3 of
- the License, or (at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; If not, see <http://www.gnu.org/licenses/>.
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
EXCEPTION : As a special exception, you may create a larger work
that contains this FAUST architecture section and distribute
@@ -44,29 +45,111 @@ Compilation options: -lang cpp -inpl -scal -ftz 0
#include <string>
#include <vector>
+/************************************************************************
+ ************************************************************************
+ FAUST compiler
+ Copyright (C) 2003-2018 GRAME, Centre National de Creation Musicale
+ ---------------------------------------------------------------------
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ ************************************************************************
+ ************************************************************************/
+
+#ifndef __export__
+#define __export__
+
+#define FAUSTVERSION "2.41.1"
+
+// Use FAUST_API for code that is part of the external API but is also compiled in faust
+// and libfaust Use LIBFAUST_API for code that is compiled in faust and libfaust
+
+#ifdef _WIN32
+#pragma warning(disable : 4251)
+#ifdef FAUST_EXE
+#define FAUST_API
+#define LIBFAUST_API
+#elif FAUST_LIB
+#define FAUST_API __declspec(dllexport)
+#define LIBFAUST_API __declspec(dllexport)
+#else
+#define FAUST_API
+#define LIBFAUST_API
+#endif
+#else
+#ifdef FAUST_EXE
+#define FAUST_API
+#define LIBFAUST_API
+#else
+#define FAUST_API __attribute__((visibility("default")))
+#define LIBFAUST_API __attribute__((visibility("default")))
+#endif
+#endif
+
+#endif
+
#ifndef FAUSTFLOAT
#define FAUSTFLOAT float
#endif
-struct UI;
-struct Meta;
+struct FAUST_API UI;
+struct FAUST_API Meta;
/**
* DSP memory manager.
*/
-struct dsp_memory_manager {
+struct FAUST_API dsp_memory_manager {
virtual ~dsp_memory_manager() {}
+ /**
+ * Inform the Memory Manager with the number of expected memory zones.
+ * @param count - the number of expected memory zones
+ */
+ virtual void begin(size_t /*count*?) {}
+
+ /**
+ * Give the Memory Manager information on a given memory zone.
+ * @param size - the size in bytes of the memory zone
+ * @param reads - the number of Read access to the zone used to compute one frame
+ * @param writes - the number of Write access to the zone used to compute one frame
+ */
+ virtual void info(size_t /*size*/, size_t /*reads*/, size_t /*writes*/) {}
+
+ /**
+ * Inform the Memory Manager that all memory zones have been described,
+ * to possibly start a 'compute the best allocation strategy' step.
+ */
+ virtual void end() {}
+
+ /**
+ * Allocate a memory zone.
+ * @param size - the memory zone size in bytes
+ */
virtual void* allocate(size_t size) = 0;
- virtual void destroy(void* ptr) = 0;
+
+ /**
+ * Destroy a memory zone.
+ * @param ptr - the memory zone pointer to be deallocated
+ */
+ virtual void destroy(void* ptr) = 0;
};
/**
* Signal processor definition.
*/
-class dsp
+class FAUST_API dsp
{
public:
dsp() {}
@@ -86,7 +169,7 @@ class dsp
*/
virtual void buildUserInterface(UI* ui_interface) = 0;
- /* Returns the sample rate currently used by the instance */
+ /* Return the sample rate currently used by the instance */
virtual int getSampleRate() = 0;
/**
@@ -94,28 +177,28 @@ class dsp
* - static class 'classInit': static tables initialization
* - 'instanceInit': constants and instance state initialization
*
- * @param sample_rate - the sampling rate in Hertz
+ * @param sample_rate - the sampling rate in Hz
*/
virtual void init(int sample_rate) = 0;
/**
* Init instance state
*
- * @param sample_rate - the sampling rate in Hertz
+ * @param sample_rate - the sampling rate in Hz
*/
virtual void instanceInit(int sample_rate) = 0;
/**
* Init instance constant state
*
- * @param sample_rate - the sampling rate in Hertz
+ * @param sample_rate - the sampling rate in Hz
*/
virtual void instanceConstants(int sample_rate) = 0;
/* Init default control parameters values */
virtual void instanceResetUserInterface() = 0;
- /* Init instance state (delay lines...) */
+ /* Init instance state (like delay lines...) but keep the control parameter values */
virtual void instanceClear() = 0;
/**
@@ -167,7 +250,7 @@ class dsp
* Generic DSP decorator.
*/
-class decorator_dsp : public dsp
+class FAUST_API decorator_dsp : public dsp
{
protected:
dsp* fDSP;
@@ -206,10 +289,11 @@ class decorator_dsp : public dsp
};
/**
- * DSP factory class.
+ * DSP factory class, used with LLVM and Interpreter backends
+ * to create DSP instances from a compiled DSP program.
*/
-class dsp_factory
+class FAUST_API dsp_factory
{
protected:
// So that to force sub-classes to use deleteDSPFactory(dsp_factory* factory);
@@ -229,75 +313,114 @@ class dsp_factory
virtual dsp_memory_manager* getMemoryManager() = 0;
};
-/**
- * On Intel set FZ (Flush to Zero) and DAZ (Denormals Are Zero)
- * flags to avoid costly denormals.
- */
+// Denormal handling
-#ifdef __SSE__
+#if defined(__SSE__)
#include <xmmintrin.h>
-#ifdef __SSE2__
-#define AVOIDDENORMALS _mm_setcsr(_mm_getcsr() | 0x8040)
+#endif
+
+class FAUST_API ScopedNoDenormals
+{
+ private:
+ intptr_t fpsr;
+
+ void setFpStatusRegister(intptr_t fpsr_aux) noexcept
+ {
+#if defined(__arm64__) || defined(__aarch64__)
+ asm volatile("msr fpcr, %0" : : "ri"(fpsr_aux));
+#elif defined(__SSE__)
+ _mm_setcsr(static_cast<uint32_t>(fpsr_aux));
+#endif
+ }
+
+ void getFpStatusRegister() noexcept
+ {
+#if defined(__arm64__) || defined(__aarch64__)
+ asm volatile("mrs %0, fpcr" : "=r"(fpsr));
+#elif defined(__SSE__)
+ fpsr = static_cast<intptr_t>(_mm_getcsr());
+#endif
+ }
+
+ public:
+ ScopedNoDenormals() noexcept
+ {
+#if defined(__arm64__) || defined(__aarch64__)
+ intptr_t mask = (1 << 24 /* FZ */);
#else
-#define AVOIDDENORMALS _mm_setcsr(_mm_getcsr() | 0x8000)
+#if defined(__SSE__)
+#if defined(__SSE2__)
+ intptr_t mask = 0x8040;
+#else
+ intptr_t mask = 0x8000;
#endif
#else
-#define AVOIDDENORMALS
+ intptr_t mask = 0x0000;
#endif
-
#endif
-/************************** END dsp.h **************************/
+ getFpStatusRegister();
+ setFpStatusRegister(fpsr | mask);
+ }
-/************************** BEGIN APIUI.h **************************/
-/************************************************************************
- FAUST Architecture File
- Copyright (C) 2003-2017 GRAME, Centre National de Creation Musicale
- ---------------------------------------------------------------------
- This Architecture section is free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 3 of
- the License, or (at your option) any later version.
+ ~ScopedNoDenormals() noexcept { setFpStatusRegister(fpsr); }
+};
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+#define AVOIDDENORMALS ScopedNoDenormals();
- You should have received a copy of the GNU General Public License
- along with this program; If not, see <http://www.gnu.org/licenses/>.
+#endif
- EXCEPTION : As a special exception, you may create a larger work
- that contains this FAUST architecture section and distribute
- that work under terms of your choice, so long as this FAUST
- architecture section is not modified.
- ************************************************************************/
+/************************** END dsp.h **************************/
+/************************** BEGIN APIUI.h *****************************
+FAUST Architecture File
+Copyright (C) 2003-2022 GRAME, Centre National de Creation Musicale
+---------------------------------------------------------------------
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+EXCEPTION : As a special exception, you may create a larger work
+that contains this FAUST architecture section and distribute
+that work under terms of your choice, so long as this FAUST
+architecture section is not modified.
+************************************************************************/
#ifndef API_UI_H
#define API_UI_H
-#include <iostream>
+#include <stdio.h>
+
#include <map>
#include <sstream>
#include <string>
#include <vector>
-/************************** BEGIN meta.h **************************/
-/************************************************************************
+/************************** BEGIN meta.h *******************************
FAUST Architecture File
- Copyright (C) 2003-2017 GRAME, Centre National de Creation Musicale
+ Copyright (C) 2003-2022 GRAME, Centre National de Creation Musicale
---------------------------------------------------------------------
- This Architecture section is free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 3 of
- the License, or (at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; If not, see <http://www.gnu.org/licenses/>.
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
EXCEPTION : As a special exception, you may create a larger work
that contains this FAUST architecture section and distribute
@@ -308,36 +431,40 @@ class dsp_factory
#ifndef __meta__
#define __meta__
-struct Meta {
- virtual ~Meta(){};
+/**
+ The base class of Meta handler to be used in dsp::metadata(Meta* m) method to retrieve
+ (key, value) metadata.
+ */
+struct FAUST_API Meta {
+ virtual ~Meta() {}
virtual void declare(const char* key, const char* value) = 0;
};
#endif
/************************** END meta.h **************************/
-/************************** BEGIN UI.h **************************/
-/************************************************************************
+/************************** BEGIN UI.h *****************************
FAUST Architecture File
- Copyright (C) 2003-2020 GRAME, Centre National de Creation Musicale
+ Copyright (C) 2003-2022 GRAME, Centre National de Creation Musicale
---------------------------------------------------------------------
- This Architecture section is free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 3 of
- the License, or (at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; If not, see <http://www.gnu.org/licenses/>.
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
EXCEPTION : As a special exception, you may create a larger work
that contains this FAUST architecture section and distribute
that work under terms of your choice, so long as this FAUST
architecture section is not modified.
- ************************************************************************/
+ ********************************************************************/
#ifndef __UI_H__
#define __UI_H__
@@ -356,7 +483,7 @@ struct Meta {
struct Soundfile;
template<typename REAL>
-struct UIReal {
+struct FAUST_API UIReal {
UIReal() {}
virtual ~UIReal() {}
@@ -387,38 +514,41 @@ struct UIReal {
// -- soundfiles
- virtual void addSoundfile(const char* label, const char* filename,
- Soundfile** sf_zone) = 0;
+ virtual void addSoundfile(const char* /*label*/, const char* /*filename*/,
+ Soundfile** /*sf_zone*/) = 0;
// -- metadata declarations
- virtual void declare(REAL* zone, const char* key, const char* val) {}
+ virtual void declare(REAL* /*zone*/, const char* /*key*/, const char* /*val*/) {}
+
+ // To be used by LLVM client
+ virtual int sizeOfFAUSTFLOAT() { return sizeof(FAUSTFLOAT); }
};
-struct UI : public UIReal<FAUSTFLOAT> {
+struct FAUST_API UI : public UIReal<FAUSTFLOAT> {
UI() {}
virtual ~UI() {}
};
#endif
/************************** END UI.h **************************/
-/************************** BEGIN PathBuilder.h **************************/
-/************************************************************************
+/************************** BEGIN PathBuilder.h **************************
FAUST Architecture File
- Copyright (C) 2003-2017 GRAME, Centre National de Creation Musicale
+ Copyright (C) 2003-2022 GRAME, Centre National de Creation Musicale
---------------------------------------------------------------------
- This Architecture section is free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 3 of
- the License, or (at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; If not, see <http://www.gnu.org/licenses/>.
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
EXCEPTION : As a special exception, you may create a larger work
that contains this FAUST architecture section and distribute
@@ -426,10 +556,13 @@ struct UI : public UIReal<FAUSTFLOAT> {
architecture section is not modified.
************************************************************************/
-#ifndef FAUST_PATHBUILDER_H
-#define FAUST_PATHBUILDER_H
+#ifndef __PathBuilder__
+#define __PathBuilder__
#include <algorithm>
+#include <map>
+#include <regex>
+#include <set>
#include <string>
#include <vector>
@@ -438,113 +571,266 @@ struct UI : public UIReal<FAUSTFLOAT> {
* Helper class to build complete hierarchical path for UI items.
******************************************************************************/
-class PathBuilder
+class FAUST_API PathBuilder
{
protected:
std::vector<std::string> fControlsLevel;
+ std::vector<std::string> fFullPaths;
+ std::map<std::string, std::string> fFull2Short; // filled by computeShortNames()
+
+ /**
+ * @brief check if a character is acceptable for an ID
+ *
+ * @param c
+ * @return true is the character is acceptable for an ID
+ */
+ bool isIDChar(char c) const
+ {
+ return ((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z'))
+ || ((c >= '0') && (c <= '9'));
+ }
+
+ /**
+ * @brief remove all "/0x00" parts
+ *
+ * @param src
+ * @return modified string
+ */
+ std::string remove0x00(const std::string& src) const
+ {
+ return std::regex_replace(src, std::regex("/0x00"), "");
+ }
+
+ /**
+ * @brief replace all non ID char with '_' (one '_' may replace several non ID char)
+ *
+ * @param src
+ * @return modified string
+ */
+ std::string str2ID(const std::string& src) const
+ {
+ std::string dst;
+ bool need_underscore = false;
+ for (char c : src) {
+ if (isIDChar(c) || (c == '/')) {
+ if (need_underscore) {
+ dst.push_back('_');
+ need_underscore = false;
+ }
+ dst.push_back(c);
+ } else {
+ need_underscore = true;
+ }
+ }
+ return dst;
+ }
+
+ /**
+ * @brief Keep only the last n slash-parts
+ *
+ * @param src
+ * @param n : 1 indicates the last slash-part
+ * @return modified string
+ */
+ std::string cut(const std::string& src, int n) const
+ {
+ std::string rdst;
+ for (int i = int(src.length()) - 1; i >= 0; i--) {
+ char c = src[i];
+ if (c != '/') {
+ rdst.push_back(c);
+ } else if (n == 1) {
+ std::string dst;
+ for (int j = int(rdst.length()) - 1; j >= 0; j--) {
+ dst.push_back(rdst[j]);
+ }
+ return dst;
+ } else {
+ n--;
+ rdst.push_back(c);
+ }
+ }
+ return src;
+ }
+
+ void addFullPath(const std::string& label) { fFullPaths.push_back(buildPath(label)); }
+
+ /**
+ * @brief Compute the mapping between full path and short names
+ */
+ void computeShortNames()
+ {
+ std::vector<std::string>
+ uniquePaths; // all full paths transformed but made unique with a prefix
+ std::map<std::string, std::string>
+ unique2full; // all full paths transformed but made unique with a prefix
+ char num_buffer[16];
+ int pnum = 0;
+
+ for (const auto& s : fFullPaths) {
+ sprintf(num_buffer, "%d", pnum++);
+ std::string u = "/P" + std::string(num_buffer) + str2ID(remove0x00(s));
+ uniquePaths.push_back(u);
+ unique2full[u] = s; // remember the full path associated to a unique path
+ }
+
+ std::map<std::string, int> uniquePath2level; // map path to level
+ for (const auto& s : uniquePaths)
+ uniquePath2level[s] = 1; // we init all levels to 1
+ bool have_collisions = true;
+
+ while (have_collisions) {
+ // compute collision list
+ std::set<std::string> collisionSet;
+ std::map<std::string, std::string> short2full;
+ have_collisions = false;
+ for (const auto& it : uniquePath2level) {
+ std::string u = it.first;
+ int n = it.second;
+ std::string shortName = cut(u, n);
+ auto p = short2full.find(shortName);
+ if (p == short2full.end()) {
+ // no collision
+ short2full[shortName] = u;
+ } else {
+ // we have a collision, add the two paths to the collision set
+ have_collisions = true;
+ collisionSet.insert(u);
+ collisionSet.insert(p->second);
+ }
+ }
+ for (const auto& s : collisionSet)
+ uniquePath2level[s]++; // increase level of colliding path
+ }
+
+ for (const auto& it : uniquePath2level) {
+ std::string u = it.first;
+ int n = it.second;
+ std::string shortName = replaceCharList(cut(u, n), {'/'}, '_');
+ fFull2Short[unique2full[u]] = shortName;
+ }
+ }
+
+ std::string replaceCharList(const std::string& str, const std::vector<char>& ch1,
+ char ch2)
+ {
+ auto beg = ch1.begin();
+ auto end = ch1.end();
+ std::string res = str;
+ for (size_t i = 0; i < str.length(); ++i) {
+ if (std::find(beg, end, str[i]) != end)
+ res[i] = ch2;
+ }
+ return res;
+ }
public:
PathBuilder() {}
virtual ~PathBuilder() {}
+ // Return true for the first level of groups
+ bool pushLabel(const std::string& label)
+ {
+ fControlsLevel.push_back(label);
+ return fControlsLevel.size() == 1;
+ }
+
+ // Return true for the last level of groups
+ bool popLabel()
+ {
+ fControlsLevel.pop_back();
+ return fControlsLevel.size() == 0;
+ }
+
std::string buildPath(const std::string& label)
{
std::string res = "/";
for (size_t i = 0; i < fControlsLevel.size(); i++) {
- res += fControlsLevel[i];
- res += "/";
+ res = res + fControlsLevel[i] + "/";
}
res += label;
- std::replace(res.begin(), res.end(), ' ', '_');
- return res;
- }
-
- std::string buildLabel(std::string label)
- {
- std::replace(label.begin(), label.end(), ' ', '_');
- return label;
+ return replaceCharList(
+ res, {' ', '#', '*', ',', '?', '[', ']', '{', '}', '(', ')'}, '_');
}
-
- void pushLabel(const std::string& label) { fControlsLevel.push_back(label); }
- void popLabel() { fControlsLevel.pop_back(); }
};
-#endif // FAUST_PATHBUILDER_H
+#endif // __PathBuilder__
/************************** END PathBuilder.h **************************/
-/************************** BEGIN ValueConverter.h **************************/
-/************************************************************************
+/************************** BEGIN ValueConverter.h ********************
FAUST Architecture File
- Copyright (C) 2003-2017 GRAME, Centre National de Creation Musicale
+ Copyright (C) 2003-2022 GRAME, Centre National de Creation Musicale
---------------------------------------------------------------------
- This Architecture section is free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 3 of
- the License, or (at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; If not, see <http://www.gnu.org/licenses/>.
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
EXCEPTION : As a special exception, you may create a larger work
that contains this FAUST architecture section and distribute
that work under terms of your choice, so long as this FAUST
architecture section is not modified.
- ************************************************************************/
+ ********************************************************************/
#ifndef __ValueConverter__
#define __ValueConverter__
/***************************************************************************************
- ValueConverter.h
- (GRAME, Copyright 2015-2019)
+ ValueConverter.h
+ (GRAME, Copyright 2015-2019)
-Set of conversion objects used to map user interface values (for example a gui slider
-delivering values between 0 and 1) to faust values (for example a vslider between
-20 and 20000) using a log scale.
+ Set of conversion objects used to map user interface values (for example a gui slider
+ delivering values between 0 and 1) to faust values (for example a vslider between
+ 20 and 20000) using a log scale.
--- Utilities
+ -- Utilities
-Range(lo,hi) : clip a value x between lo and hi
-Interpolator(lo,hi,v1,v2) : Maps a value x between lo and hi to a value y between v1 and
+ Range(lo,hi) : clip a value x between lo and hi
+ Interpolator(lo,hi,v1,v2) : Maps a value x between lo and hi to a value y between v1 and
v2 Interpolator3pt(lo,mi,hi,v1,vm,v2) : Map values between lo mid hi to values between v1
vm v2
--- Value Converters
+ -- Value Converters
-ValueConverter::ui2faust(x)
-ValueConverter::faust2ui(x)
+ ValueConverter::ui2faust(x)
+ ValueConverter::faust2ui(x)
--- ValueConverters used for sliders depending of the scale
+ -- ValueConverters used for sliders depending of the scale
-LinearValueConverter(umin, umax, fmin, fmax)
-LinearValueConverter2(lo, mi, hi, v1, vm, v2) using 2 segments
-LogValueConverter(umin, umax, fmin, fmax)
-ExpValueConverter(umin, umax, fmin, fmax)
+ LinearValueConverter(umin, umax, fmin, fmax)
+ LinearValueConverter2(lo, mi, hi, v1, vm, v2) using 2 segments
+ LogValueConverter(umin, umax, fmin, fmax)
+ ExpValueConverter(umin, umax, fmin, fmax)
--- ValueConverters used for accelerometers based on 3 points
+ -- ValueConverters used for accelerometers based on 3 points
-AccUpConverter(amin, amid, amax, fmin, fmid, fmax) -- curve 0
-AccDownConverter(amin, amid, amax, fmin, fmid, fmax) -- curve 1
-AccUpDownConverter(amin, amid, amax, fmin, fmid, fmax) -- curve 2
-AccDownUpConverter(amin, amid, amax, fmin, fmid, fmax) -- curve 3
+ AccUpConverter(amin, amid, amax, fmin, fmid, fmax) -- curve 0
+ AccDownConverter(amin, amid, amax, fmin, fmid, fmax) -- curve 1
+ AccUpDownConverter(amin, amid, amax, fmin, fmid, fmax) -- curve 2
+ AccDownUpConverter(amin, amid, amax, fmin, fmid, fmax) -- curve 3
--- lists of ZoneControl are used to implement accelerometers metadata for each axes
+ -- lists of ZoneControl are used to implement accelerometers metadata for each axes
-ZoneControl(zone, valueConverter) : a zone with an accelerometer data converter
+ ZoneControl(zone, valueConverter) : a zone with an accelerometer data converter
--- ZoneReader are used to implement screencolor metadata
+ -- ZoneReader are used to implement screencolor metadata
-ZoneReader(zone, valueConverter) : a zone with a data converter
+ ZoneReader(zone, valueConverter) : a zone with a data converter
****************************************************************************************/
+#include <assert.h>
+#include <float.h>
+
#include <algorithm> // std::max
-#include <cassert>
-#include <cfloat>
#include <cmath>
#include <vector>
@@ -552,12 +838,12 @@ ZoneReader(zone, valueConverter) : a zone with a data converter
// Interpolator(lo,hi,v1,v2)
// Maps a value x between lo and hi to a value y between v1 and v2
// y = v1 + (x-lo)/(hi-lo)*(v2-v1)
-// y = v1 + (x-lo) * coef with coef = (v2-v1)/(hi-lo)
+// y = v1 + (x-lo) * coef with coef = (v2-v1)/(hi-lo)
// y = v1 + x*coef - lo*coef
// y = v1 - lo*coef + x*coef
-// y = offset + x*coef with offset = v1 - lo*coef
+// y = offset + x*coef with offset = v1 - lo*coef
//--------------------------------------------------------------------------------------
-class Interpolator
+class FAUST_API Interpolator
{
private:
//--------------------------------------------------------------------------------------
@@ -608,7 +894,7 @@ class Interpolator
// Interpolator3pt(lo,mi,hi,v1,vm,v2)
// Map values between lo mid hi to values between v1 vm v2
//--------------------------------------------------------------------------------------
-class Interpolator3pt
+class FAUST_API Interpolator3pt
{
private:
Interpolator fSegment1;
@@ -632,19 +918,19 @@ class Interpolator3pt
//--------------------------------------------------------------------------------------
// Abstract ValueConverter class. Converts values between UI and Faust representations
//--------------------------------------------------------------------------------------
-class ValueConverter
+class FAUST_API ValueConverter
{
public:
virtual ~ValueConverter() {}
- virtual double ui2faust(double x) = 0;
- virtual double faust2ui(double x) = 0;
+ virtual double ui2faust(double x) { return x; };
+ virtual double faust2ui(double x) { return x; };
};
//--------------------------------------------------------------------------------------
// A converter than can be updated
//--------------------------------------------------------------------------------------
-class UpdatableValueConverter : public ValueConverter
+class FAUST_API UpdatableValueConverter : public ValueConverter
{
protected:
bool fActive;
@@ -664,7 +950,7 @@ class UpdatableValueConverter : public ValueConverter
//--------------------------------------------------------------------------------------
// Linear conversion between ui and Faust values
//--------------------------------------------------------------------------------------
-class LinearValueConverter : public ValueConverter
+class FAUST_API LinearValueConverter : public ValueConverter
{
private:
Interpolator fUI2F;
@@ -684,7 +970,7 @@ class LinearValueConverter : public ValueConverter
//--------------------------------------------------------------------------------------
// Two segments linear conversion between ui and Faust values
//--------------------------------------------------------------------------------------
-class LinearValueConverter2 : public UpdatableValueConverter
+class FAUST_API LinearValueConverter2 : public UpdatableValueConverter
{
private:
Interpolator3pt fUI2F;
@@ -720,7 +1006,7 @@ class LinearValueConverter2 : public UpdatableValueConverter
//--------------------------------------------------------------------------------------
// Logarithmic conversion between ui and Faust values
//--------------------------------------------------------------------------------------
-class LogValueConverter : public LinearValueConverter
+class FAUST_API LogValueConverter : public LinearValueConverter
{
public:
LogValueConverter(double umin, double umax, double fmin, double fmax)
@@ -742,7 +1028,7 @@ class LogValueConverter : public LinearValueConverter
//--------------------------------------------------------------------------------------
// Exponential conversion between ui and Faust values
//--------------------------------------------------------------------------------------
-class ExpValueConverter : public LinearValueConverter
+class FAUST_API ExpValueConverter : public LinearValueConverter
{
public:
ExpValueConverter(double umin, double umax, double fmin, double fmax)
@@ -765,7 +1051,7 @@ class ExpValueConverter : public LinearValueConverter
// Convert accelerometer or gyroscope values to Faust values
// Using an Up curve (curve 0)
//--------------------------------------------------------------------------------------
-class AccUpConverter : public UpdatableValueConverter
+class FAUST_API AccUpConverter : public UpdatableValueConverter
{
private:
Interpolator3pt fA2F;
@@ -801,7 +1087,7 @@ class AccUpConverter : public UpdatableValueConverter
// Convert accelerometer or gyroscope values to Faust values
// Using a Down curve (curve 1)
//--------------------------------------------------------------------------------------
-class AccDownConverter : public UpdatableValueConverter
+class FAUST_API AccDownConverter : public UpdatableValueConverter
{
private:
Interpolator3pt fA2F;
@@ -837,14 +1123,14 @@ class AccDownConverter : public UpdatableValueConverter
// Convert accelerometer or gyroscope values to Faust values
// Using an Up-Down curve (curve 2)
//--------------------------------------------------------------------------------------
-class AccUpDownConverter : public UpdatableValueConverter
+class FAUST_API AccUpDownConverter : public UpdatableValueConverter
{
private:
Interpolator3pt fA2F;
Interpolator fF2A;
public:
- AccUpDownConverter(double amin, double amid, double amax, double fmin, double fmid,
+ AccUpDownConverter(double amin, double amid, double amax, double fmin, double /*fmid*/,
double fmax)
: fA2F(amin, amid, amax, fmin, fmax, fmin)
, fF2A(fmin, fmax, amin,
@@ -856,7 +1142,7 @@ class AccUpDownConverter : public UpdatableValueConverter
virtual double faust2ui(double x) { return fF2A(x); }
virtual void setMappingValues(double amin, double amid, double amax, double fmin,
- double fmid, double fmax)
+ double /*fmid*/, double fmax)
{
//__android_log_print(ANDROID_LOG_ERROR, "Faust", "AccUpDownConverter update %f %f
//%f %f %f %f", amin,amid,amax,fmin,fmid,fmax);
@@ -874,14 +1160,14 @@ class AccUpDownConverter : public UpdatableValueConverter
// Convert accelerometer or gyroscope values to Faust values
// Using a Down-Up curve (curve 3)
//--------------------------------------------------------------------------------------
-class AccDownUpConverter : public UpdatableValueConverter
+class FAUST_API AccDownUpConverter : public UpdatableValueConverter
{
private:
Interpolator3pt fA2F;
Interpolator fF2A;
public:
- AccDownUpConverter(double amin, double amid, double amax, double fmin, double fmid,
+ AccDownUpConverter(double amin, double amid, double amax, double fmin, double /*fmid*/,
double fmax)
: fA2F(amin, amid, amax, fmax, fmin, fmax)
, fF2A(fmin, fmax, amin,
@@ -893,7 +1179,7 @@ class AccDownUpConverter : public UpdatableValueConverter
virtual double faust2ui(double x) { return fF2A(x); }
virtual void setMappingValues(double amin, double amid, double amax, double fmin,
- double fmid, double fmax)
+ double /*fmid*/, double fmax)
{
//__android_log_print(ANDROID_LOG_ERROR, "Faust", "AccDownUpConverter update %f %f
//%f %f %f %f", amin,amid,amax,fmin,fmid,fmax);
@@ -910,7 +1196,7 @@ class AccDownUpConverter : public UpdatableValueConverter
//--------------------------------------------------------------------------------------
// Base class for ZoneControl
//--------------------------------------------------------------------------------------
-class ZoneControl
+class FAUST_API ZoneControl
{
protected:
FAUSTFLOAT* fZone;
@@ -919,17 +1205,17 @@ class ZoneControl
ZoneControl(FAUSTFLOAT* zone) : fZone(zone) {}
virtual ~ZoneControl() {}
- virtual void update(double v) const {}
+ virtual void update(double /*v*/) const {}
- virtual void setMappingValues(int curve, double amin, double amid, double amax,
- double min, double init, double max)
+ virtual void setMappingValues(int /*curve*/, double /*amin*/, double /*amid*/, double /*amax*/,
+ double /*min*/, double /*init*/, double /*max*/)
{
}
- virtual void getMappingValues(double& amin, double& amid, double& amax) {}
+ virtual void getMappingValues(double& /*amin*/, double& /*amid*/, double& /*amax*/) {}
FAUSTFLOAT* getZone() { return fZone; }
- virtual void setActive(bool on_off) {}
+ virtual void setActive(bool /*on_off*/) {}
virtual bool getActive() { return false; }
virtual int getCurve() { return -1; }
@@ -938,7 +1224,7 @@ class ZoneControl
//--------------------------------------------------------------------------------------
// Useful to implement accelerometers metadata as a list of ZoneControl for each axes
//--------------------------------------------------------------------------------------
-class ConverterZoneControl : public ZoneControl
+class FAUST_API ConverterZoneControl : public ZoneControl
{
protected:
ValueConverter* fValueConverter;
@@ -953,7 +1239,10 @@ class ConverterZoneControl : public ZoneControl
delete fValueConverter;
} // Assuming fValueConverter is not kept elsewhere...
- virtual void update(double v) const { *fZone = fValueConverter->ui2faust(v); }
+ virtual void update(double v) const
+ {
+ *fZone = FAUSTFLOAT(fValueConverter->ui2faust(v));
+ }
ValueConverter* getConverter() { return fValueConverter; }
};
@@ -962,7 +1251,7 @@ class ConverterZoneControl : public ZoneControl
// Association of a zone and a four value converter, each one for each possible curve.
// Useful to implement accelerometers metadata as a list of ZoneControl for each axes
//--------------------------------------------------------------------------------------
-class CurveZoneControl : public ZoneControl
+class FAUST_API CurveZoneControl : public ZoneControl
{
private:
std::vector<UpdatableValueConverter*> fValueConverters;
@@ -985,15 +1274,14 @@ class CurveZoneControl : public ZoneControl
}
virtual ~CurveZoneControl()
{
- std::vector<UpdatableValueConverter*>::iterator it;
- for (it = fValueConverters.begin(); it != fValueConverters.end(); it++) {
- delete (*it);
+ for (const auto& it : fValueConverters) {
+ delete it;
}
}
void update(double v) const
{
if (fValueConverters[fCurve]->getActive())
- *fZone = fValueConverters[fCurve]->ui2faust(v);
+ *fZone = FAUSTFLOAT(fValueConverters[fCurve]->ui2faust(v));
}
void setMappingValues(int curve, double amin, double amid, double amax, double min,
@@ -1010,16 +1298,15 @@ class CurveZoneControl : public ZoneControl
void setActive(bool on_off)
{
- std::vector<UpdatableValueConverter*>::iterator it;
- for (it = fValueConverters.begin(); it != fValueConverters.end(); it++) {
- (*it)->setActive(on_off);
+ for (const auto& it : fValueConverters) {
+ it->setActive(on_off);
}
}
int getCurve() { return fCurve; }
};
-class ZoneReader
+class FAUST_API ZoneReader
{
private:
FAUSTFLOAT* fZone;
@@ -1039,6 +1326,8 @@ class ZoneReader
#endif
/************************** END ValueConverter.h **************************/
+typedef unsigned int uint;
+
class APIUI
: public PathBuilder
, public Meta
@@ -1054,22 +1343,42 @@ class APIUI
kHBargraph,
kVBargraph
};
+ enum Type { kAcc = 0, kGyr = 1, kNoType };
protected:
- enum { kLin = 0, kLog = 1, kExp = 2 };
-
- int fNumParameters;
- std::vector<std::string> fPaths;
- std::vector<std::string> fLabels;
- std::map<std::string, int> fPathMap;
- std::map<std::string, int> fLabelMap;
- std::vector<ValueConverter*> fConversion;
- std::vector<FAUSTFLOAT*> fZone;
- std::vector<FAUSTFLOAT> fInit;
- std::vector<FAUSTFLOAT> fMin;
- std::vector<FAUSTFLOAT> fMax;
- std::vector<FAUSTFLOAT> fStep;
- std::vector<ItemType> fItemType;
+ enum Mapping { kLin = 0, kLog = 1, kExp = 2 };
+
+ struct Item {
+ std::string fLabel;
+ std::string fShortname;
+ std::string fPath;
+ ValueConverter* fConversion;
+ FAUSTFLOAT* fZone;
+ FAUSTFLOAT fInit;
+ FAUSTFLOAT fMin;
+ FAUSTFLOAT fMax;
+ FAUSTFLOAT fStep;
+ ItemType fItemType;
+
+ Item(const std::string& label, const std::string& short_name,
+ const std::string& path, ValueConverter* conversion, FAUSTFLOAT* zone,
+ FAUSTFLOAT init, FAUSTFLOAT min, FAUSTFLOAT max, FAUSTFLOAT step,
+ ItemType item_type)
+ : fLabel(label)
+ , fShortname(short_name)
+ , fPath(path)
+ , fConversion(conversion)
+ , fZone(zone)
+ , fInit(init)
+ , fMin(min)
+ , fMax(max)
+ , fStep(step)
+ , fItemType(item_type)
+ {
+ }
+ };
+ std::vector<Item> fItems;
+
std::vector<std::map<std::string, std::string> > fMetaData;
std::vector<ZoneControl*> fAcc[3];
std::vector<ZoneControl*> fGyr[3];
@@ -1096,33 +1405,31 @@ class APIUI
ItemType type)
{
std::string path = buildPath(label);
- fPathMap[path] = fLabelMap[label] = fNumParameters++;
- fPaths.push_back(path);
- fLabels.push_back(label);
- fZone.push_back(zone);
- fInit.push_back(init);
- fMin.push_back(min);
- fMax.push_back(max);
- fStep.push_back(step);
- fItemType.push_back(type);
+ fFullPaths.push_back(path);
// handle scale metadata
+ ValueConverter* converter = nullptr;
switch (fCurrentScale) {
case kLin:
- fConversion.push_back(new LinearValueConverter(0, 1, min, max));
+ converter = new LinearValueConverter(0, 1, min, max);
break;
case kLog:
- fConversion.push_back(new LogValueConverter(0, 1, min, max));
+ converter = new LogValueConverter(0, 1, min, max);
break;
case kExp:
- fConversion.push_back(new ExpValueConverter(0, 1, min, max));
+ converter = new ExpValueConverter(0, 1, min, max);
break;
}
fCurrentScale = kLin;
+ fItems.push_back(
+ Item(label, "", path, converter, zone, init, min, max, step, type));
+
if (fCurrentAcc.size() > 0 && fCurrentGyr.size() > 0) {
- std::cerr << "warning : 'acc' and 'gyr' metadata used for the same " << label
- << " parameter !!\n";
+ fprintf(
+ stderr,
+ "warning : 'acc' and 'gyr' metadata used for the same %s parameter !!\n",
+ label);
}
// handle acc metadata "...[acc : <axe> <curve> <amin> <amid> <amax>]..."
@@ -1137,7 +1444,7 @@ class APIUI
fAcc[axe].push_back(
new CurveZoneControl(zone, curve, amin, amid, amax, min, init, max));
} else {
- std::cerr << "incorrect acc metadata : " << fCurrentAcc << std::endl;
+ fprintf(stderr, "incorrect acc metadata : %s \n", fCurrentAcc.c_str());
}
fCurrentAcc = "";
}
@@ -1154,31 +1461,31 @@ class APIUI
fGyr[axe].push_back(
new CurveZoneControl(zone, curve, amin, amid, amax, min, init, max));
} else {
- std::cerr << "incorrect gyr metadata : " << fCurrentGyr << std::endl;
+ fprintf(stderr, "incorrect gyr metadata : %s \n", fCurrentGyr.c_str());
}
fCurrentGyr = "";
}
// handle screencolor metadata "...[screencolor:red|green|blue|white]..."
if (fCurrentColor.size() > 0) {
- if ((fCurrentColor == "red") && (fRedReader == 0)) {
+ if ((fCurrentColor == "red") && (fRedReader == nullptr)) {
fRedReader = new ZoneReader(zone, min, max);
fHasScreenControl = true;
- } else if ((fCurrentColor == "green") && (fGreenReader == 0)) {
+ } else if ((fCurrentColor == "green") && (fGreenReader == nullptr)) {
fGreenReader = new ZoneReader(zone, min, max);
fHasScreenControl = true;
- } else if ((fCurrentColor == "blue") && (fBlueReader == 0)) {
+ } else if ((fCurrentColor == "blue") && (fBlueReader == nullptr)) {
fBlueReader = new ZoneReader(zone, min, max);
fHasScreenControl = true;
- } else if ((fCurrentColor == "white") && (fRedReader == 0)
- && (fGreenReader == 0) && (fBlueReader == 0)) {
+ } else if ((fCurrentColor == "white") && (fRedReader == nullptr)
+ && (fGreenReader == nullptr) && (fBlueReader == nullptr)) {
fRedReader = new ZoneReader(zone, min, max);
fGreenReader = new ZoneReader(zone, min, max);
fBlueReader = new ZoneReader(zone, min, max);
fHasScreenControl = true;
} else {
- std::cerr << "incorrect screencolor metadata : " << fCurrentColor
- << std::endl;
+ fprintf(stderr, "incorrect screencolor metadata : %s \n",
+ fCurrentColor.c_str());
}
}
fCurrentColor = "";
@@ -1189,7 +1496,7 @@ class APIUI
int getZoneIndex(std::vector<ZoneControl*>* table, int p, int val)
{
- FAUSTFLOAT* zone = fZone[p];
+ FAUSTFLOAT* zone = fItems[uint(p)].fZone;
for (size_t i = 0; i < table[val].size(); i++) {
if (zone == table[val][i]->getZone())
return int(i);
@@ -1206,11 +1513,11 @@ class APIUI
// Deactivates everywhere..
if (id1 != -1)
- table[0][id1]->setActive(false);
+ table[0][uint(id1)]->setActive(false);
if (id2 != -1)
- table[1][id2]->setActive(false);
+ table[1][uint(id2)]->setActive(false);
if (id3 != -1)
- table[2][id3]->setActive(false);
+ table[2][uint(id3)]->setActive(false);
if (val == -1) { // Means: no more mapping...
// So stay all deactivated...
@@ -1218,14 +1525,16 @@ class APIUI
int id4 = getZoneIndex(table, p, val);
if (id4 != -1) {
// Reactivate the one we edit...
- table[val][id4]->setMappingValues(curve, amin, amid, amax, fMin[p],
- fInit[p], fMax[p]);
- table[val][id4]->setActive(true);
+ table[val][uint(id4)]->setMappingValues(
+ curve, amin, amid, amax, fItems[uint(p)].fMin, fItems[uint(p)].fInit,
+ fItems[uint(p)].fMax);
+ table[val][uint(id4)]->setActive(true);
} else {
// Allocate a new CurveZoneControl which is 'active' by default
- FAUSTFLOAT* zone = fZone[p];
- table[val].push_back(new CurveZoneControl(zone, curve, amin, amid, amax,
- fMin[p], fInit[p], fMax[p]));
+ FAUSTFLOAT* zone = fItems[uint(p)].fZone;
+ table[val].push_back(new CurveZoneControl(
+ zone, curve, amin, amid, amax, fItems[uint(p)].fMin,
+ fItems[uint(p)].fInit, fItems[uint(p)].fMax));
}
}
}
@@ -1239,16 +1548,16 @@ class APIUI
if (id1 != -1) {
val = 0;
- curve = table[val][id1]->getCurve();
- table[val][id1]->getMappingValues(amin, amid, amax);
+ curve = table[val][uint(id1)]->getCurve();
+ table[val][uint(id1)]->getMappingValues(amin, amid, amax);
} else if (id2 != -1) {
val = 1;
- curve = table[val][id2]->getCurve();
- table[val][id2]->getMappingValues(amin, amid, amax);
+ curve = table[val][uint(id2)]->getCurve();
+ table[val][uint(id2)]->getMappingValues(amin, amid, amax);
} else if (id3 != -1) {
val = 2;
- curve = table[val][id3]->getCurve();
- table[val][id3]->getMappingValues(amin, amid, amax);
+ curve = table[val][uint(id3)]->getCurve();
+ table[val][uint(id3)]->getMappingValues(amin, amid, amax);
} else {
val = -1; // No mapping
curve = 0;
@@ -1259,26 +1568,23 @@ class APIUI
}
public:
- enum Type { kAcc = 0, kGyr = 1, kNoType };
-
APIUI()
- : fNumParameters(0)
- , fHasScreenControl(false)
- , fRedReader(0)
- , fGreenReader(0)
- , fBlueReader(0)
+ : fHasScreenControl(false)
+ , fRedReader(nullptr)
+ , fGreenReader(nullptr)
+ , fBlueReader(nullptr)
, fCurrentScale(kLin)
{
}
virtual ~APIUI()
{
- for (auto& it : fConversion)
- delete it;
+ for (const auto& it : fItems)
+ delete it.fConversion;
for (int i = 0; i < 3; i++) {
- for (auto& it : fAcc[i])
+ for (const auto& it : fAcc[i])
delete it;
- for (auto& it : fGyr[i])
+ for (const auto& it : fGyr[i])
delete it;
}
delete fRedReader;
@@ -1291,7 +1597,18 @@ class APIUI
virtual void openTabBox(const char* label) { pushLabel(label); }
virtual void openHorizontalBox(const char* label) { pushLabel(label); }
virtual void openVerticalBox(const char* label) { pushLabel(label); }
- virtual void closeBox() { popLabel(); }
+ virtual void closeBox()
+ {
+ if (popLabel()) {
+ // Shortnames can be computed when all fullnames are known
+ computeShortNames();
+ // Fill 'shortname' field for each item
+ for (const auto& it : fFull2Short) {
+ int index = getParamIndex(it.first.c_str());
+ fItems[index].fShortname = it.second;
+ }
+ }
+ }
// -- active widgets
@@ -1328,25 +1645,25 @@ class APIUI
virtual void addHorizontalBargraph(const char* label, FAUSTFLOAT* zone,
FAUSTFLOAT min, FAUSTFLOAT max)
{
- addParameter(label, zone, min, min, max, (max - min) / 1000.0, kHBargraph);
+ addParameter(label, zone, min, min, max, (max - min) / 1000.0f, kHBargraph);
}
virtual void addVerticalBargraph(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT min,
FAUSTFLOAT max)
{
- addParameter(label, zone, min, min, max, (max - min) / 1000.0, kVBargraph);
+ addParameter(label, zone, min, min, max, (max - min) / 1000.0f, kVBargraph);
}
// -- soundfiles
- virtual void addSoundfile(const char* label, const char* filename,
- Soundfile** sf_zone)
+ virtual void addSoundfile(const char* /*label*/, const char* /*filename*/,
+ Soundfile** /*sf_zone*/)
{
}
// -- metadata declarations
- virtual void declare(FAUSTFLOAT* zone, const char* key, const char* val)
+ virtual void declare(FAUSTFLOAT* /*zone*/, const char* key, const char* val)
{
// Keep metadata
fCurrentMetadata[key] = val;
@@ -1372,29 +1689,31 @@ class APIUI
}
}
- virtual void declare(const char* key, const char* val) {}
+ virtual void declare(const char* /*key*/, const char* /*val*/) {}
//-------------------------------------------------------------------------------
// Simple API part
//-------------------------------------------------------------------------------
- int getParamsCount() { return fNumParameters; }
- int getParamIndex(const char* path)
+ int getParamsCount() { return int(fItems.size()); }
+
+ int getParamIndex(const char* path_aux)
{
- if (fPathMap.find(path) != fPathMap.end()) {
- return fPathMap[path];
- } else if (fLabelMap.find(path) != fLabelMap.end()) {
- return fLabelMap[path];
- } else {
- return -1;
- }
+ std::string path = std::string(path_aux);
+ auto it = find_if(fItems.begin(), fItems.end(), [=](const Item& it) {
+ return (it.fLabel == path) || (it.fShortname == path) || (it.fPath == path);
+ });
+ return (it != fItems.end()) ? int(it - fItems.begin()) : -1;
}
- const char* getParamAddress(int p) { return fPaths[p].c_str(); }
- const char* getParamLabel(int p) { return fLabels[p].c_str(); }
+
+ const char* getParamLabel(int p) { return fItems[uint(p)].fLabel.c_str(); }
+ const char* getParamShortname(int p) { return fItems[uint(p)].fShortname.c_str(); }
+ const char* getParamAddress(int p) { return fItems[uint(p)].fPath.c_str(); }
+
std::map<const char*, const char*> getMetadata(int p)
{
std::map<const char*, const char*> res;
- std::map<std::string, std::string> metadata = fMetaData[p];
- for (auto it : metadata) {
+ std::map<std::string, std::string> metadata = fMetaData[uint(p)];
+ for (const auto& it : metadata) {
res[it.first.c_str()] = it.second.c_str();
}
return res;
@@ -1402,26 +1721,62 @@ class APIUI
const char* getMetadata(int p, const char* key)
{
- return (fMetaData[p].find(key) != fMetaData[p].end()) ? fMetaData[p][key].c_str()
- : "";
+ return (fMetaData[uint(p)].find(key) != fMetaData[uint(p)].end())
+ ? fMetaData[uint(p)][key].c_str()
+ : "";
}
- FAUSTFLOAT getParamMin(int p) { return fMin[p]; }
- FAUSTFLOAT getParamMax(int p) { return fMax[p]; }
- FAUSTFLOAT getParamStep(int p) { return fStep[p]; }
- FAUSTFLOAT getParamInit(int p) { return fInit[p]; }
+ FAUSTFLOAT getParamMin(int p) { return fItems[uint(p)].fMin; }
+ FAUSTFLOAT getParamMax(int p) { return fItems[uint(p)].fMax; }
+ FAUSTFLOAT getParamStep(int p) { return fItems[uint(p)].fStep; }
+ FAUSTFLOAT getParamInit(int p) { return fItems[uint(p)].fInit; }
- FAUSTFLOAT* getParamZone(int p) { return fZone[p]; }
- FAUSTFLOAT getParamValue(int p) { return *fZone[p]; }
- void setParamValue(int p, FAUSTFLOAT v) { *fZone[p] = v; }
+ FAUSTFLOAT* getParamZone(int p) { return fItems[uint(p)].fZone; }
- double getParamRatio(int p) { return fConversion[p]->faust2ui(*fZone[p]); }
- void setParamRatio(int p, double r) { *fZone[p] = fConversion[p]->ui2faust(r); }
+ FAUSTFLOAT getParamValue(int p) { return *fItems[uint(p)].fZone; }
+ FAUSTFLOAT getParamValue(const char* path)
+ {
+ int index = getParamIndex(path);
+ if (index >= 0) {
+ return getParamValue(index);
+ } else {
+ fprintf(stderr, "getParamValue : '%s' not found\n",
+ (path == nullptr ? "NULL" : path));
+ return FAUSTFLOAT(0);
+ }
+ }
+
+ void setParamValue(int p, FAUSTFLOAT v) { *fItems[uint(p)].fZone = v; }
+ void setParamValue(const char* path, FAUSTFLOAT v)
+ {
+ int index = getParamIndex(path);
+ if (index >= 0) {
+ setParamValue(index, v);
+ } else {
+ fprintf(stderr, "setParamValue : '%s' not found\n",
+ (path == nullptr ? "NULL" : path));
+ }
+ }
+
+ double getParamRatio(int p)
+ {
+ return fItems[uint(p)].fConversion->faust2ui(*fItems[uint(p)].fZone);
+ }
+ void setParamRatio(int p, double r)
+ {
+ *fItems[uint(p)].fZone = FAUSTFLOAT(fItems[uint(p)].fConversion->ui2faust(r));
+ }
- double value2ratio(int p, double r) { return fConversion[p]->faust2ui(r); }
- double ratio2value(int p, double r) { return fConversion[p]->ui2faust(r); }
+ double value2ratio(int p, double r)
+ {
+ return fItems[uint(p)].fConversion->faust2ui(r);
+ }
+ double ratio2value(int p, double r)
+ {
+ return fItems[uint(p)].fConversion->ui2faust(r);
+ }
/**
- * Return the control type (kAcc, kGyr, or -1) for a given parameter
+ * Return the control type (kAcc, kGyr, or -1) for a given parameter.
*
* @param p - the UI parameter index
*
@@ -1443,13 +1798,13 @@ class APIUI
/**
* Return the Item type (kButton = 0, kCheckButton, kVSlider, kHSlider, kNumEntry,
- * kHBargraph, kVBargraph) for a given parameter
+ * kHBargraph, kVBargraph) for a given parameter.
*
* @param p - the UI parameter index
*
* @return the Item type
*/
- ItemType getParamItemType(int p) { return fItemType[p]; }
+ ItemType getParamItemType(int p) { return fItems[uint(p)].fItemType; }
/**
* Set a new value coming from an accelerometer, propagate it to all relevant
@@ -1489,7 +1844,7 @@ class APIUI
* given UI parameter.
*
* @param p - the UI parameter index
- * @param acc - 0 for X gyroscope, 1 for Y gyroscope, 2 for Z gyroscope (-1 means "no
+ * @param gyr - 0 for X gyroscope, 1 for Y gyroscope, 2 for Z gyroscope (-1 means "no
* mapping")
* @param curve - between 0 and 3
* @param amin - mapping 'min' point
@@ -1554,7 +1909,7 @@ class APIUI
}
/**
- * Get the number of FAUSTFLOAT* zones controlled with the accelerometer
+ * Get the number of FAUSTFLOAT* zones controlled with the accelerometer.
*
* @param acc - 0 for X accelerometer, 1 for Y accelerometer, 2 for Z accelerometer
* @return the number of zones
@@ -1563,7 +1918,7 @@ class APIUI
int getAccCount(int acc) { return (acc >= 0 && acc < 3) ? int(fAcc[acc].size()) : 0; }
/**
- * Get the number of FAUSTFLOAT* zones controlled with the gyroscope
+ * Get the number of FAUSTFLOAT* zones controlled with the gyroscope.
*
* @param gyr - 0 for X gyroscope, 1 for Y gyroscope, 2 for Z gyroscope
* @param the number of zones
@@ -1600,8 +1955,11 @@ class APIUI
#define FAUSTFLOAT float
#endif
+#include <math.h>
+
#include <algorithm>
#include <cmath>
+#include <cstdint>
#ifndef FAUSTCLASS
#define FAUSTCLASS freeverbmonodsp
@@ -1612,18 +1970,23 @@ class APIUI
#define exp10 __exp10
#endif
+#if defined(_WIN32)
+#define RESTRICT __restrict
+#else
+#define RESTRICT __restrict__
+#endif
+
class freeverbmonodsp : public dsp
{
private:
FAUSTFLOAT fVslider0;
int fSampleRate;
- float fConst0;
float fConst1;
FAUSTFLOAT fVslider1;
float fConst2;
FAUSTFLOAT fVslider2;
float fRec9[2];
- int IOTA;
+ int IOTA0;
float fVec0[8192];
int iConst3;
float fConst4;
@@ -1709,6 +2072,9 @@ class freeverbmonodsp : public dsp
public:
void metadata(Meta* m)
{
+ m->declare("compile_options",
+ "-a faust2header.cpp -lang cpp -i -inpl -cn freeverbmonodsp -es 1 "
+ "-mcd 16 -single -ftz 0");
m->declare("delays.lib/name", "Faust Delay Library");
m->declare("delays.lib/version", "0.1");
m->declare("filename", "freeverbmonodsp.dsp");
@@ -1719,6 +2085,7 @@ class freeverbmonodsp : public dsp
m->declare("filters.lib/allpass_comb:license", "MIT-style STK-4.3 license");
m->declare("filters.lib/lowpass0_highpass1", "MIT-style STK-4.3 license");
m->declare("filters.lib/name", "Faust Filters Library");
+ m->declare("filters.lib/version", "0.3");
m->declare("freeverbdsp.dsp/author", "Romain Michon");
m->declare("freeverbdsp.dsp/description",
"Freeverb implementation in Faust, from the Faust Library's "
@@ -1730,72 +2097,45 @@ class freeverbmonodsp : public dsp
m->declare("maths.lib/copyright", "GRAME");
m->declare("maths.lib/license", "LGPL with exception");
m->declare("maths.lib/name", "Faust Math Library");
- m->declare("maths.lib/version", "2.3");
+ m->declare("maths.lib/version", "2.5");
m->declare("name", "freeverbmonodsp");
m->declare("platform.lib/name", "Generic Platform Library");
- m->declare("platform.lib/version", "0.1");
+ m->declare("platform.lib/version", "0.2");
+ m->declare("reverbs.lib/mono_freeverb:author", "Romain Michon");
m->declare("reverbs.lib/name", "Faust Reverb Library");
- m->declare("reverbs.lib/version", "0.0");
+ m->declare("reverbs.lib/stereo_freeverb:author", "Romain Michon");
+ m->declare("reverbs.lib/version", "0.2");
}
virtual int getNumInputs() { return 1; }
virtual int getNumOutputs() { return 1; }
- virtual int getInputRate(int channel)
- {
- int rate;
- switch ((channel)) {
- case 0: {
- rate = 1;
- break;
- }
- default: {
- rate = -1;
- break;
- }
- }
- return rate;
- }
- virtual int getOutputRate(int channel)
- {
- int rate;
- switch ((channel)) {
- case 0: {
- rate = 1;
- break;
- }
- default: {
- rate = -1;
- break;
- }
- }
- return rate;
- }
static void classInit(int /*sample_rate*/) {}
virtual void instanceConstants(int sample_rate)
{
fSampleRate = sample_rate;
- fConst0 = std::min<float>(192000.0f, std::max<float>(1.0f, float(fSampleRate)));
- fConst1 = (12348.0f / fConst0);
- fConst2 = (17640.0f / fConst0);
- iConst3 = int((0.0253061224f * fConst0));
- fConst4 = (0.00104308384f * fConst0);
- iConst5 = int((0.0269387756f * fConst0));
- iConst6 = int((0.0289569162f * fConst0));
- iConst7 = int((0.0307482984f * fConst0));
- iConst8 = int((0.0322448984f * fConst0));
- iConst9 = int((0.033809524f * fConst0));
- iConst10 = int((0.0353061222f * fConst0));
- iConst11 = int((0.0366666652f * fConst0));
- iConst12 = int((0.0126077095f * fConst0));
- iConst13 = int((0.00999999978f * fConst0));
- iConst14 = int((0.00773242628f * fConst0));
- iConst15 = int((0.00510204071f * fConst0));
- iConst16 = std::min<int>(1024, std::max<int>(0, (iConst12 + -1)));
- iConst17 = std::min<int>(1024, std::max<int>(0, (iConst13 + -1)));
- iConst18 = std::min<int>(1024, std::max<int>(0, (iConst14 + -1)));
- iConst19 = std::min<int>(1024, std::max<int>(0, (iConst15 + -1)));
+ float fConst0 =
+ std::min<float>(192000.0f, std::max<float>(1.0f, float(fSampleRate)));
+ fConst1 = 12348.0f / fConst0;
+ fConst2 = 17640.0f / fConst0;
+ iConst3 = int(0.0253061224f * fConst0);
+ fConst4 = 0.00104308384f * fConst0;
+ iConst5 = int(0.0269387756f * fConst0);
+ iConst6 = int(0.0289569162f * fConst0);
+ iConst7 = int(0.0307482984f * fConst0);
+ iConst8 = int(0.0322448984f * fConst0);
+ iConst9 = int(0.033809524f * fConst0);
+ iConst10 = int(0.0353061222f * fConst0);
+ iConst11 = int(0.0366666652f * fConst0);
+ iConst12 = int(0.0126077095f * fConst0);
+ iConst13 = int(0.00999999978f * fConst0);
+ iConst14 = int(0.00773242628f * fConst0);
+ iConst15 = int(0.00510204071f * fConst0);
+ iConst16 = std::min<int>(1024, std::max<int>(0, iConst12 + -1));
+ iConst17 = std::min<int>(1024, std::max<int>(0, iConst13 + -1));
+ iConst18 = std::min<int>(1024, std::max<int>(0, iConst14 + -1));
+ iConst19 = std::min<int>(1024, std::max<int>(0, iConst15 + -1));
}
virtual void instanceResetUserInterface()
@@ -1808,197 +2148,197 @@ class freeverbmonodsp : public dsp
virtual void instanceClear()
{
- for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) {
+ for (int l0 = 0; l0 < 2; l0 = l0 + 1) {
fRec9[l0] = 0.0f;
}
- IOTA = 0;
- for (int l1 = 0; (l1 < 8192); l1 = (l1 + 1)) {
+ IOTA0 = 0;
+ for (int l1 = 0; l1 < 8192; l1 = l1 + 1) {
fVec0[l1] = 0.0f;
}
- for (int l2 = 0; (l2 < 2); l2 = (l2 + 1)) {
+ for (int l2 = 0; l2 < 2; l2 = l2 + 1) {
fRec8[l2] = 0.0f;
}
- for (int l3 = 0; (l3 < 2); l3 = (l3 + 1)) {
+ for (int l3 = 0; l3 < 2; l3 = l3 + 1) {
fRec11[l3] = 0.0f;
}
- for (int l4 = 0; (l4 < 8192); l4 = (l4 + 1)) {
+ for (int l4 = 0; l4 < 8192; l4 = l4 + 1) {
fVec1[l4] = 0.0f;
}
- for (int l5 = 0; (l5 < 2); l5 = (l5 + 1)) {
+ for (int l5 = 0; l5 < 2; l5 = l5 + 1) {
fRec10[l5] = 0.0f;
}
- for (int l6 = 0; (l6 < 2); l6 = (l6 + 1)) {
+ for (int l6 = 0; l6 < 2; l6 = l6 + 1) {
fRec13[l6] = 0.0f;
}
- for (int l7 = 0; (l7 < 8192); l7 = (l7 + 1)) {
+ for (int l7 = 0; l7 < 8192; l7 = l7 + 1) {
fVec2[l7] = 0.0f;
}
- for (int l8 = 0; (l8 < 2); l8 = (l8 + 1)) {
+ for (int l8 = 0; l8 < 2; l8 = l8 + 1) {
fRec12[l8] = 0.0f;
}
- for (int l9 = 0; (l9 < 2); l9 = (l9 + 1)) {
+ for (int l9 = 0; l9 < 2; l9 = l9 + 1) {
fRec15[l9] = 0.0f;
}
- for (int l10 = 0; (l10 < 8192); l10 = (l10 + 1)) {
+ for (int l10 = 0; l10 < 8192; l10 = l10 + 1) {
fVec3[l10] = 0.0f;
}
- for (int l11 = 0; (l11 < 2); l11 = (l11 + 1)) {
+ for (int l11 = 0; l11 < 2; l11 = l11 + 1) {
fRec14[l11] = 0.0f;
}
- for (int l12 = 0; (l12 < 2); l12 = (l12 + 1)) {
+ for (int l12 = 0; l12 < 2; l12 = l12 + 1) {
fRec17[l12] = 0.0f;
}
- for (int l13 = 0; (l13 < 8192); l13 = (l13 + 1)) {
+ for (int l13 = 0; l13 < 8192; l13 = l13 + 1) {
fVec4[l13] = 0.0f;
}
- for (int l14 = 0; (l14 < 2); l14 = (l14 + 1)) {
+ for (int l14 = 0; l14 < 2; l14 = l14 + 1) {
fRec16[l14] = 0.0f;
}
- for (int l15 = 0; (l15 < 2); l15 = (l15 + 1)) {
+ for (int l15 = 0; l15 < 2; l15 = l15 + 1) {
fRec19[l15] = 0.0f;
}
- for (int l16 = 0; (l16 < 8192); l16 = (l16 + 1)) {
+ for (int l16 = 0; l16 < 8192; l16 = l16 + 1) {
fVec5[l16] = 0.0f;
}
- for (int l17 = 0; (l17 < 2); l17 = (l17 + 1)) {
+ for (int l17 = 0; l17 < 2; l17 = l17 + 1) {
fRec18[l17] = 0.0f;
}
- for (int l18 = 0; (l18 < 2); l18 = (l18 + 1)) {
+ for (int l18 = 0; l18 < 2; l18 = l18 + 1) {
fRec21[l18] = 0.0f;
}
- for (int l19 = 0; (l19 < 8192); l19 = (l19 + 1)) {
+ for (int l19 = 0; l19 < 8192; l19 = l19 + 1) {
fVec6[l19] = 0.0f;
}
- for (int l20 = 0; (l20 < 2); l20 = (l20 + 1)) {
+ for (int l20 = 0; l20 < 2; l20 = l20 + 1) {
fRec20[l20] = 0.0f;
}
- for (int l21 = 0; (l21 < 2); l21 = (l21 + 1)) {
+ for (int l21 = 0; l21 < 2; l21 = l21 + 1) {
fRec23[l21] = 0.0f;
}
- for (int l22 = 0; (l22 < 8192); l22 = (l22 + 1)) {
+ for (int l22 = 0; l22 < 8192; l22 = l22 + 1) {
fVec7[l22] = 0.0f;
}
- for (int l23 = 0; (l23 < 2); l23 = (l23 + 1)) {
+ for (int l23 = 0; l23 < 2; l23 = l23 + 1) {
fRec22[l23] = 0.0f;
}
- for (int l24 = 0; (l24 < 2048); l24 = (l24 + 1)) {
+ for (int l24 = 0; l24 < 2048; l24 = l24 + 1) {
fVec8[l24] = 0.0f;
}
- for (int l25 = 0; (l25 < 2); l25 = (l25 + 1)) {
+ for (int l25 = 0; l25 < 2; l25 = l25 + 1) {
fRec6[l25] = 0.0f;
}
- for (int l26 = 0; (l26 < 2048); l26 = (l26 + 1)) {
+ for (int l26 = 0; l26 < 2048; l26 = l26 + 1) {
fVec9[l26] = 0.0f;
}
- for (int l27 = 0; (l27 < 2); l27 = (l27 + 1)) {
+ for (int l27 = 0; l27 < 2; l27 = l27 + 1) {
fRec4[l27] = 0.0f;
}
- for (int l28 = 0; (l28 < 2048); l28 = (l28 + 1)) {
+ for (int l28 = 0; l28 < 2048; l28 = l28 + 1) {
fVec10[l28] = 0.0f;
}
- for (int l29 = 0; (l29 < 2); l29 = (l29 + 1)) {
+ for (int l29 = 0; l29 < 2; l29 = l29 + 1) {
fRec2[l29] = 0.0f;
}
- for (int l30 = 0; (l30 < 2048); l30 = (l30 + 1)) {
+ for (int l30 = 0; l30 < 2048; l30 = l30 + 1) {
fVec11[l30] = 0.0f;
}
- for (int l31 = 0; (l31 < 2); l31 = (l31 + 1)) {
+ for (int l31 = 0; l31 < 2; l31 = l31 + 1) {
fRec0[l31] = 0.0f;
}
- for (int l32 = 0; (l32 < 2); l32 = (l32 + 1)) {
+ for (int l32 = 0; l32 < 2; l32 = l32 + 1) {
fRec33[l32] = 0.0f;
}
- for (int l33 = 0; (l33 < 8192); l33 = (l33 + 1)) {
+ for (int l33 = 0; l33 < 8192; l33 = l33 + 1) {
fVec12[l33] = 0.0f;
}
- for (int l34 = 0; (l34 < 2); l34 = (l34 + 1)) {
+ for (int l34 = 0; l34 < 2; l34 = l34 + 1) {
fRec32[l34] = 0.0f;
}
- for (int l35 = 0; (l35 < 2); l35 = (l35 + 1)) {
+ for (int l35 = 0; l35 < 2; l35 = l35 + 1) {
fRec35[l35] = 0.0f;
}
- for (int l36 = 0; (l36 < 8192); l36 = (l36 + 1)) {
+ for (int l36 = 0; l36 < 8192; l36 = l36 + 1) {
fVec13[l36] = 0.0f;
}
- for (int l37 = 0; (l37 < 2); l37 = (l37 + 1)) {
+ for (int l37 = 0; l37 < 2; l37 = l37 + 1) {
fRec34[l37] = 0.0f;
}
- for (int l38 = 0; (l38 < 2); l38 = (l38 + 1)) {
+ for (int l38 = 0; l38 < 2; l38 = l38 + 1) {
fRec37[l38] = 0.0f;
}
- for (int l39 = 0; (l39 < 8192); l39 = (l39 + 1)) {
+ for (int l39 = 0; l39 < 8192; l39 = l39 + 1) {
fVec14[l39] = 0.0f;
}
- for (int l40 = 0; (l40 < 2); l40 = (l40 + 1)) {
+ for (int l40 = 0; l40 < 2; l40 = l40 + 1) {
fRec36[l40] = 0.0f;
}
- for (int l41 = 0; (l41 < 2); l41 = (l41 + 1)) {
+ for (int l41 = 0; l41 < 2; l41 = l41 + 1) {
fRec39[l41] = 0.0f;
}
- for (int l42 = 0; (l42 < 8192); l42 = (l42 + 1)) {
+ for (int l42 = 0; l42 < 8192; l42 = l42 + 1) {
fVec15[l42] = 0.0f;
}
- for (int l43 = 0; (l43 < 2); l43 = (l43 + 1)) {
+ for (int l43 = 0; l43 < 2; l43 = l43 + 1) {
fRec38[l43] = 0.0f;
}
- for (int l44 = 0; (l44 < 2); l44 = (l44 + 1)) {
+ for (int l44 = 0; l44 < 2; l44 = l44 + 1) {
fRec41[l44] = 0.0f;
}
- for (int l45 = 0; (l45 < 8192); l45 = (l45 + 1)) {
+ for (int l45 = 0; l45 < 8192; l45 = l45 + 1) {
fVec16[l45] = 0.0f;
}
- for (int l46 = 0; (l46 < 2); l46 = (l46 + 1)) {
+ for (int l46 = 0; l46 < 2; l46 = l46 + 1) {
fRec40[l46] = 0.0f;
}
- for (int l47 = 0; (l47 < 2); l47 = (l47 + 1)) {
+ for (int l47 = 0; l47 < 2; l47 = l47 + 1) {
fRec43[l47] = 0.0f;
}
- for (int l48 = 0; (l48 < 8192); l48 = (l48 + 1)) {
+ for (int l48 = 0; l48 < 8192; l48 = l48 + 1) {
fVec17[l48] = 0.0f;
}
- for (int l49 = 0; (l49 < 2); l49 = (l49 + 1)) {
+ for (int l49 = 0; l49 < 2; l49 = l49 + 1) {
fRec42[l49] = 0.0f;
}
- for (int l50 = 0; (l50 < 2); l50 = (l50 + 1)) {
+ for (int l50 = 0; l50 < 2; l50 = l50 + 1) {
fRec45[l50] = 0.0f;
}
- for (int l51 = 0; (l51 < 8192); l51 = (l51 + 1)) {
+ for (int l51 = 0; l51 < 8192; l51 = l51 + 1) {
fVec18[l51] = 0.0f;
}
- for (int l52 = 0; (l52 < 2); l52 = (l52 + 1)) {
+ for (int l52 = 0; l52 < 2; l52 = l52 + 1) {
fRec44[l52] = 0.0f;
}
- for (int l53 = 0; (l53 < 2); l53 = (l53 + 1)) {
+ for (int l53 = 0; l53 < 2; l53 = l53 + 1) {
fRec47[l53] = 0.0f;
}
- for (int l54 = 0; (l54 < 8192); l54 = (l54 + 1)) {
+ for (int l54 = 0; l54 < 8192; l54 = l54 + 1) {
fVec19[l54] = 0.0f;
}
- for (int l55 = 0; (l55 < 2); l55 = (l55 + 1)) {
+ for (int l55 = 0; l55 < 2; l55 = l55 + 1) {
fRec46[l55] = 0.0f;
}
- for (int l56 = 0; (l56 < 2048); l56 = (l56 + 1)) {
+ for (int l56 = 0; l56 < 2048; l56 = l56 + 1) {
fVec20[l56] = 0.0f;
}
- for (int l57 = 0; (l57 < 2); l57 = (l57 + 1)) {
+ for (int l57 = 0; l57 < 2; l57 = l57 + 1) {
fRec30[l57] = 0.0f;
}
- for (int l58 = 0; (l58 < 2048); l58 = (l58 + 1)) {
+ for (int l58 = 0; l58 < 2048; l58 = l58 + 1) {
fVec21[l58] = 0.0f;
}
- for (int l59 = 0; (l59 < 2); l59 = (l59 + 1)) {
+ for (int l59 = 0; l59 < 2; l59 = l59 + 1) {
fRec28[l59] = 0.0f;
}
- for (int l60 = 0; (l60 < 2048); l60 = (l60 + 1)) {
+ for (int l60 = 0; l60 < 2048; l60 = l60 + 1) {
fVec22[l60] = 0.0f;
}
- for (int l61 = 0; (l61 < 2); l61 = (l61 + 1)) {
+ for (int l61 = 0; l61 < 2; l61 = l61 + 1) {
fRec26[l61] = 0.0f;
}
- for (int l62 = 0; (l62 < 1024); l62 = (l62 + 1)) {
+ for (int l62 = 0; l62 < 1024; l62 = l62 + 1) {
fVec23[l62] = 0.0f;
}
- for (int l63 = 0; (l63 < 2); l63 = (l63 + 1)) {
+ for (int l63 = 0; l63 < 2; l63 = l63 + 1) {
fRec24[l63] = 0.0f;
}
}
@@ -2028,29 +2368,33 @@ class freeverbmonodsp : public dsp
ui_interface->declare(&fVslider2, "style", "knob");
ui_interface->declare(&fVslider2, "tooltip",
"Somehow control the density of the reverb.");
- ui_interface->addVerticalSlider("Damp", &fVslider2, 0.5f, 0.0f, 1.0f,
- 0.0250000004f);
+ ui_interface->addVerticalSlider("Damp", &fVslider2, FAUSTFLOAT(0.5f),
+ FAUSTFLOAT(0.0f), FAUSTFLOAT(1.0f),
+ FAUSTFLOAT(0.0250000004f));
ui_interface->declare(&fVslider1, "1", "");
ui_interface->declare(&fVslider1, "style", "knob");
ui_interface->declare(
&fVslider1, "tooltip",
"The room size between 0 and 1 with 1 for the largest room.");
- ui_interface->addVerticalSlider("RoomSize", &fVslider1, 0.100000001f, 0.0f, 1.0f,
- 0.0250000004f);
+ ui_interface->addVerticalSlider("RoomSize", &fVslider1, FAUSTFLOAT(0.100000001f),
+ FAUSTFLOAT(0.0f), FAUSTFLOAT(1.0f),
+ FAUSTFLOAT(0.0250000004f));
ui_interface->declare(&fVslider3, "2", "");
ui_interface->declare(&fVslider3, "style", "knob");
ui_interface->declare(
&fVslider3, "tooltip",
"Spatial spread between 0 and 1 with 1 for maximum spread.");
- ui_interface->addVerticalSlider("Stereo Spread", &fVslider3, 0.5f, 0.0f, 1.0f,
- 0.00999999978f);
+ ui_interface->addVerticalSlider("Stereo Spread", &fVslider3, FAUSTFLOAT(0.5f),
+ FAUSTFLOAT(0.0f), FAUSTFLOAT(1.0f),
+ FAUSTFLOAT(0.00999999978f));
ui_interface->closeBox();
ui_interface->declare(&fVslider0, "1", "");
ui_interface->declare(&fVslider0, "tooltip",
"The amount of reverb applied to the signal between 0 "
"and 1 with 1 for the maximum amount of reverb.");
- ui_interface->addVerticalSlider("Wet", &fVslider0, 0.100000001f, 0.0f, 1.0f,
- 0.0250000004f);
+ ui_interface->addVerticalSlider("Wet", &fVslider0, FAUSTFLOAT(0.100000001f),
+ FAUSTFLOAT(0.0f), FAUSTFLOAT(1.0f),
+ FAUSTFLOAT(0.0250000004f));
ui_interface->closeBox();
}
@@ -2059,122 +2403,114 @@ class freeverbmonodsp : public dsp
FAUSTFLOAT* input0 = inputs[0];
FAUSTFLOAT* output0 = outputs[0];
float fSlow0 = float(fVslider0);
- float fSlow1 = (0.200000003f * fSlow0);
- float fSlow2 = ((fConst1 * float(fVslider1)) + 0.699999988f);
- float fSlow3 = (fConst2 * float(fVslider2));
- float fSlow4 = (1.0f - fSlow3);
- int iSlow5 = int((fConst4 * float(fVslider3)));
- int iSlow6 = (iConst3 + iSlow5);
- int iSlow7 = (iConst5 + iSlow5);
- int iSlow8 = (iConst6 + iSlow5);
- int iSlow9 = (iConst7 + iSlow5);
- int iSlow10 = (iConst8 + iSlow5);
- int iSlow11 = (iConst9 + iSlow5);
- int iSlow12 = (iConst10 + iSlow5);
- int iSlow13 = (iConst11 + iSlow5);
- int iSlow14 = (iSlow5 + -1);
- int iSlow15 = std::min<int>(1024, std::max<int>(0, (iConst12 + iSlow14)));
- int iSlow16 = std::min<int>(1024, std::max<int>(0, (iConst13 + iSlow14)));
- int iSlow17 = std::min<int>(1024, std::max<int>(0, (iConst14 + iSlow14)));
- int iSlow18 = std::min<int>(1024, std::max<int>(0, (iConst15 + iSlow14)));
- float fSlow19 = (2.0f * (1.0f - fSlow0));
- for (int i = 0; (i < count); i = (i + 1)) {
- float fTemp0 = float(input0[i]);
- float fTemp1 = (fSlow1 * fTemp0);
- fRec9[0] = ((fSlow3 * fRec9[1]) + (fSlow4 * fRec8[1]));
- fVec0[(IOTA & 8191)] = (fTemp1 + (fSlow2 * fRec9[0]));
- fRec8[0] = fVec0[((IOTA - iSlow6) & 8191)];
- fRec11[0] = ((fSlow3 * fRec11[1]) + (fSlow4 * fRec10[1]));
- fVec1[(IOTA & 8191)] = (fTemp1 + (fSlow2 * fRec11[0]));
- fRec10[0] = fVec1[((IOTA - iSlow7) & 8191)];
- fRec13[0] = ((fSlow3 * fRec13[1]) + (fSlow4 * fRec12[1]));
- fVec2[(IOTA & 8191)] = (fTemp1 + (fSlow2 * fRec13[0]));
- fRec12[0] = fVec2[((IOTA - iSlow8) & 8191)];
- fRec15[0] = ((fSlow3 * fRec15[1]) + (fSlow4 * fRec14[1]));
- fVec3[(IOTA & 8191)] = (fTemp1 + (fSlow2 * fRec15[0]));
- fRec14[0] = fVec3[((IOTA - iSlow9) & 8191)];
- fRec17[0] = ((fSlow3 * fRec17[1]) + (fSlow4 * fRec16[1]));
- fVec4[(IOTA & 8191)] = (fTemp1 + (fSlow2 * fRec17[0]));
- fRec16[0] = fVec4[((IOTA - iSlow10) & 8191)];
- fRec19[0] = ((fSlow3 * fRec19[1]) + (fSlow4 * fRec18[1]));
- fVec5[(IOTA & 8191)] = (fTemp1 + (fSlow2 * fRec19[0]));
- fRec18[0] = fVec5[((IOTA - iSlow11) & 8191)];
- fRec21[0] = ((fSlow3 * fRec21[1]) + (fSlow4 * fRec20[1]));
- fVec6[(IOTA & 8191)] = (fTemp1 + (fSlow2 * fRec21[0]));
- fRec20[0] = fVec6[((IOTA - iSlow12) & 8191)];
- fRec23[0] = ((fSlow3 * fRec23[1]) + (fSlow4 * fRec22[1]));
- fVec7[(IOTA & 8191)] = (fTemp1 + (fSlow2 * fRec23[0]));
- fRec22[0] = fVec7[((IOTA - iSlow13) & 8191)];
- float fTemp2 =
- ((((((((fRec8[0] + fRec10[0]) + fRec12[0]) + fRec14[0]) + fRec16[0])
- + fRec18[0])
- + fRec20[0])
- + fRec22[0])
- + (0.5f * fRec6[1]));
- fVec8[(IOTA & 2047)] = fTemp2;
- fRec6[0] = fVec8[((IOTA - iSlow15) & 2047)];
- float fRec7 = (0.0f - (0.5f * fTemp2));
- float fTemp3 = (fRec6[1] + (fRec7 + (0.5f * fRec4[1])));
- fVec9[(IOTA & 2047)] = fTemp3;
- fRec4[0] = fVec9[((IOTA - iSlow16) & 2047)];
- float fRec5 = (0.0f - (0.5f * fTemp3));
- float fTemp4 = (fRec4[1] + (fRec5 + (0.5f * fRec2[1])));
- fVec10[(IOTA & 2047)] = fTemp4;
- fRec2[0] = fVec10[((IOTA - iSlow17) & 2047)];
- float fRec3 = (0.0f - (0.5f * fTemp4));
- float fTemp5 = (fRec2[1] + (fRec3 + (0.5f * fRec0[1])));
- fVec11[(IOTA & 2047)] = fTemp5;
- fRec0[0] = fVec11[((IOTA - iSlow18) & 2047)];
- float fRec1 = (0.0f - (0.5f * fTemp5));
- fRec33[0] = ((fSlow3 * fRec33[1]) + (fSlow4 * fRec32[1]));
- fVec12[(IOTA & 8191)] = ((fSlow2 * fRec33[0]) + fTemp1);
- fRec32[0] = fVec12[((IOTA - iConst3) & 8191)];
- fRec35[0] = ((fSlow3 * fRec35[1]) + (fSlow4 * fRec34[1]));
- fVec13[(IOTA & 8191)] = (fTemp1 + (fSlow2 * fRec35[0]));
- fRec34[0] = fVec13[((IOTA - iConst5) & 8191)];
- fRec37[0] = ((fSlow3 * fRec37[1]) + (fSlow4 * fRec36[1]));
- fVec14[(IOTA & 8191)] = (fTemp1 + (fSlow2 * fRec37[0]));
- fRec36[0] = fVec14[((IOTA - iConst6) & 8191)];
- fRec39[0] = ((fSlow3 * fRec39[1]) + (fSlow4 * fRec38[1]));
- fVec15[(IOTA & 8191)] = (fTemp1 + (fSlow2 * fRec39[0]));
- fRec38[0] = fVec15[((IOTA - iConst7) & 8191)];
- fRec41[0] = ((fSlow3 * fRec41[1]) + (fSlow4 * fRec40[1]));
- fVec16[(IOTA & 8191)] = (fTemp1 + (fSlow2 * fRec41[0]));
- fRec40[0] = fVec16[((IOTA - iConst8) & 8191)];
- fRec43[0] = ((fSlow3 * fRec43[1]) + (fSlow4 * fRec42[1]));
- fVec17[(IOTA & 8191)] = (fTemp1 + (fSlow2 * fRec43[0]));
- fRec42[0] = fVec17[((IOTA - iConst9) & 8191)];
- fRec45[0] = ((fSlow3 * fRec45[1]) + (fSlow4 * fRec44[1]));
- fVec18[(IOTA & 8191)] = (fTemp1 + (fSlow2 * fRec45[0]));
- fRec44[0] = fVec18[((IOTA - iConst10) & 8191)];
- fRec47[0] = ((fSlow3 * fRec47[1]) + (fSlow4 * fRec46[1]));
- fVec19[(IOTA & 8191)] = (fTemp1 + (fSlow2 * fRec47[0]));
- fRec46[0] = fVec19[((IOTA - iConst11) & 8191)];
- float fTemp6 =
- ((((((((fRec32[0] + fRec34[0]) + fRec36[0]) + fRec38[0]) + fRec40[0])
- + fRec42[0])
- + fRec44[0])
- + fRec46[0])
- + (0.5f * fRec30[1]));
- fVec20[(IOTA & 2047)] = fTemp6;
- fRec30[0] = fVec20[((IOTA - iConst16) & 2047)];
- float fRec31 = (0.0f - (0.5f * fTemp6));
- float fTemp7 = (fRec30[1] + (fRec31 + (0.5f * fRec28[1])));
- fVec21[(IOTA & 2047)] = fTemp7;
- fRec28[0] = fVec21[((IOTA - iConst17) & 2047)];
- float fRec29 = (0.0f - (0.5f * fTemp7));
- float fTemp8 = (fRec28[1] + (fRec29 + (0.5f * fRec26[1])));
- fVec22[(IOTA & 2047)] = fTemp8;
- fRec26[0] = fVec22[((IOTA - iConst18) & 2047)];
- float fRec27 = (0.0f - (0.5f * fTemp8));
- float fTemp9 = (fRec26[1] + (fRec27 + (0.5f * fRec24[1])));
- fVec23[(IOTA & 1023)] = fTemp9;
- fRec24[0] = fVec23[((IOTA - iConst19) & 1023)];
- float fRec25 = (0.0f - (0.5f * fTemp9));
- output0[i] = FAUSTFLOAT(
- (fRec0[1] + ((fRec24[1] + (fRec25 + fRec1)) + (fSlow19 * fTemp0))));
+ float fSlow1 = 0.200000003f * fSlow0;
+ float fSlow2 = fConst1 * float(fVslider1) + 0.699999988f;
+ float fSlow3 = fConst2 * float(fVslider2);
+ float fSlow4 = 1.0f - fSlow3;
+ int iSlow5 = int(fConst4 * float(fVslider3));
+ int iSlow6 = iConst3 + iSlow5;
+ int iSlow7 = iConst5 + iSlow5;
+ int iSlow8 = iConst6 + iSlow5;
+ int iSlow9 = iConst7 + iSlow5;
+ int iSlow10 = iConst8 + iSlow5;
+ int iSlow11 = iConst9 + iSlow5;
+ int iSlow12 = iConst10 + iSlow5;
+ int iSlow13 = iConst11 + iSlow5;
+ int iSlow14 = iSlow5 + -1;
+ int iSlow15 = std::min<int>(1024, std::max<int>(0, iConst12 + iSlow14));
+ int iSlow16 = std::min<int>(1024, std::max<int>(0, iConst13 + iSlow14));
+ int iSlow17 = std::min<int>(1024, std::max<int>(0, iConst14 + iSlow14));
+ int iSlow18 = std::min<int>(1024, std::max<int>(0, iConst15 + iSlow14));
+ float fSlow19 = 2.0f * (1.0f - fSlow0);
+ for (int i0 = 0; i0 < count; i0 = i0 + 1) {
+ float fTemp0 = float(input0[i0]);
+ float fTemp1 = fSlow1 * fTemp0;
+ fRec9[0] = fSlow3 * fRec9[1] + fSlow4 * fRec8[1];
+ fVec0[IOTA0 & 8191] = fTemp1 + fSlow2 * fRec9[0];
+ fRec8[0] = fVec0[(IOTA0 - iSlow6) & 8191];
+ fRec11[0] = fSlow3 * fRec11[1] + fSlow4 * fRec10[1];
+ fVec1[IOTA0 & 8191] = fTemp1 + fSlow2 * fRec11[0];
+ fRec10[0] = fVec1[(IOTA0 - iSlow7) & 8191];
+ fRec13[0] = fSlow3 * fRec13[1] + fSlow4 * fRec12[1];
+ fVec2[IOTA0 & 8191] = fTemp1 + fSlow2 * fRec13[0];
+ fRec12[0] = fVec2[(IOTA0 - iSlow8) & 8191];
+ fRec15[0] = fSlow3 * fRec15[1] + fSlow4 * fRec14[1];
+ fVec3[IOTA0 & 8191] = fTemp1 + fSlow2 * fRec15[0];
+ fRec14[0] = fVec3[(IOTA0 - iSlow9) & 8191];
+ fRec17[0] = fSlow3 * fRec17[1] + fSlow4 * fRec16[1];
+ fVec4[IOTA0 & 8191] = fTemp1 + fSlow2 * fRec17[0];
+ fRec16[0] = fVec4[(IOTA0 - iSlow10) & 8191];
+ fRec19[0] = fSlow3 * fRec19[1] + fSlow4 * fRec18[1];
+ fVec5[IOTA0 & 8191] = fTemp1 + fSlow2 * fRec19[0];
+ fRec18[0] = fVec5[(IOTA0 - iSlow11) & 8191];
+ fRec21[0] = fSlow3 * fRec21[1] + fSlow4 * fRec20[1];
+ fVec6[IOTA0 & 8191] = fTemp1 + fSlow2 * fRec21[0];
+ fRec20[0] = fVec6[(IOTA0 - iSlow12) & 8191];
+ fRec23[0] = fSlow3 * fRec23[1] + fSlow4 * fRec22[1];
+ fVec7[IOTA0 & 8191] = fTemp1 + fSlow2 * fRec23[0];
+ fRec22[0] = fVec7[(IOTA0 - iSlow13) & 8191];
+ float fTemp2 = fRec8[0] + fRec10[0] + fRec12[0] + fRec14[0] + fRec16[0]
+ + fRec18[0] + fRec20[0] + fRec22[0] + 0.5f * fRec6[1];
+ fVec8[IOTA0 & 2047] = fTemp2;
+ fRec6[0] = fVec8[(IOTA0 - iSlow15) & 2047];
+ float fRec7 = 0.0f - 0.5f * fTemp2;
+ float fTemp3 = fRec6[1] + fRec7 + 0.5f * fRec4[1];
+ fVec9[IOTA0 & 2047] = fTemp3;
+ fRec4[0] = fVec9[(IOTA0 - iSlow16) & 2047];
+ float fRec5 = 0.0f - 0.5f * fTemp3;
+ float fTemp4 = fRec4[1] + fRec5 + 0.5f * fRec2[1];
+ fVec10[IOTA0 & 2047] = fTemp4;
+ fRec2[0] = fVec10[(IOTA0 - iSlow17) & 2047];
+ float fRec3 = 0.0f - 0.5f * fTemp4;
+ float fTemp5 = fRec2[1] + fRec3 + 0.5f * fRec0[1];
+ fVec11[IOTA0 & 2047] = fTemp5;
+ fRec0[0] = fVec11[(IOTA0 - iSlow18) & 2047];
+ float fRec1 = 0.0f - 0.5f * fTemp5;
+ fRec33[0] = fSlow3 * fRec33[1] + fSlow4 * fRec32[1];
+ fVec12[IOTA0 & 8191] = fSlow2 * fRec33[0] + fTemp1;
+ fRec32[0] = fVec12[(IOTA0 - iConst3) & 8191];
+ fRec35[0] = fSlow3 * fRec35[1] + fSlow4 * fRec34[1];
+ fVec13[IOTA0 & 8191] = fTemp1 + fSlow2 * fRec35[0];
+ fRec34[0] = fVec13[(IOTA0 - iConst5) & 8191];
+ fRec37[0] = fSlow3 * fRec37[1] + fSlow4 * fRec36[1];
+ fVec14[IOTA0 & 8191] = fTemp1 + fSlow2 * fRec37[0];
+ fRec36[0] = fVec14[(IOTA0 - iConst6) & 8191];
+ fRec39[0] = fSlow3 * fRec39[1] + fSlow4 * fRec38[1];
+ fVec15[IOTA0 & 8191] = fTemp1 + fSlow2 * fRec39[0];
+ fRec38[0] = fVec15[(IOTA0 - iConst7) & 8191];
+ fRec41[0] = fSlow3 * fRec41[1] + fSlow4 * fRec40[1];
+ fVec16[IOTA0 & 8191] = fTemp1 + fSlow2 * fRec41[0];
+ fRec40[0] = fVec16[(IOTA0 - iConst8) & 8191];
+ fRec43[0] = fSlow3 * fRec43[1] + fSlow4 * fRec42[1];
+ fVec17[IOTA0 & 8191] = fTemp1 + fSlow2 * fRec43[0];
+ fRec42[0] = fVec17[(IOTA0 - iConst9) & 8191];
+ fRec45[0] = fSlow3 * fRec45[1] + fSlow4 * fRec44[1];
+ fVec18[IOTA0 & 8191] = fTemp1 + fSlow2 * fRec45[0];
+ fRec44[0] = fVec18[(IOTA0 - iConst10) & 8191];
+ fRec47[0] = fSlow3 * fRec47[1] + fSlow4 * fRec46[1];
+ fVec19[IOTA0 & 8191] = fTemp1 + fSlow2 * fRec47[0];
+ fRec46[0] = fVec19[(IOTA0 - iConst11) & 8191];
+ float fTemp6 = fRec32[0] + fRec34[0] + fRec36[0] + fRec38[0] + fRec40[0]
+ + fRec42[0] + fRec44[0] + fRec46[0] + 0.5f * fRec30[1];
+ fVec20[IOTA0 & 2047] = fTemp6;
+ fRec30[0] = fVec20[(IOTA0 - iConst16) & 2047];
+ float fRec31 = 0.0f - 0.5f * fTemp6;
+ float fTemp7 = fRec30[1] + fRec31 + 0.5f * fRec28[1];
+ fVec21[IOTA0 & 2047] = fTemp7;
+ fRec28[0] = fVec21[(IOTA0 - iConst17) & 2047];
+ float fRec29 = 0.0f - 0.5f * fTemp7;
+ float fTemp8 = fRec28[1] + fRec29 + 0.5f * fRec26[1];
+ fVec22[IOTA0 & 2047] = fTemp8;
+ fRec26[0] = fVec22[(IOTA0 - iConst18) & 2047];
+ float fRec27 = 0.0f - 0.5f * fTemp8;
+ float fTemp9 = fRec26[1] + fRec27 + 0.5f * fRec24[1];
+ fVec23[IOTA0 & 1023] = fTemp9;
+ fRec24[0] = fVec23[(IOTA0 - iConst19) & 1023];
+ float fRec25 = 0.0f - 0.5f * fTemp9;
+ output0[i0] =
+ FAUSTFLOAT(fRec0[1] + fRec24[1] + fRec25 + fRec1 + fSlow19 * fTemp0);
fRec9[1] = fRec9[0];
- IOTA = (IOTA + 1);
+ IOTA0 = IOTA0 + 1;
fRec8[1] = fRec8[0];
fRec11[1] = fRec11[0];
fRec10[1] = fRec10[0];
diff --git a/src/gui/Connected.qml b/src/gui/Connected.qml
index 2f9f1b4..3cd5209 100644
--- a/src/gui/Connected.qml
+++ b/src/gui/Connected.qml
@@ -15,10 +15,23 @@ Item {
property int fontTiny: 8
property int bodyMargin: 60
+ property int bottomToolTipMargin: 8
+ property int rightToolTipMargin: 4
+ property string buttonColour: virtualstudio.darkMode ? "#494646" : "#EAECEC"
+ property string muteButtonMutedColor: "#FCB6B6"
property string textColour: virtualstudio.darkMode ? "#FAFBFB" : "#0F0D0D"
property string meterColor: virtualstudio.darkMode ? "gray" : "#E0E0E0"
property real imageLightnessValue: virtualstudio.darkMode ? 1.0 : 0.0
+ property real muteButtonLightnessValue: virtualstudio.darkMode ? 1.0 : 0.0
+ property real muteButtonMutedLightnessValue: 0.24
+ property real muteButtonMutedSaturationValue: 0.73
+ property string buttonStroke: virtualstudio.darkMode ? "#80827D7D" : "#34979797"
+ property string sliderColour: virtualstudio.darkMode ? "#BABCBC" : "#EAECEC"
+ property string sliderPressedColour: virtualstudio.darkMode ? "#ACAFAF" : "#DEE0E0"
+ property string shadowColour: virtualstudio.darkMode ? "#40000000" : "#80A1A1A1"
+ property string toolTipBackgroundColour: virtualstudio.darkMode ? "#323232" : "#F3F3F3"
+ property string toolTipTextColour: textColour
property string meterGreen: "#61C554"
property string meterYellow: "#F5BF4F"
@@ -86,7 +99,7 @@ Item {
Item {
id: inputDevice
- x: bodyMargin * virtualstudio.uiScale; y: 250 * virtualstudio.uiScale
+ x: bodyMargin * virtualstudio.uiScale; y: 230 * virtualstudio.uiScale
width: Math.min(parent.width / 2, 320 * virtualstudio.uiScale) - x
height: 100 * virtualstudio.uiScale
clip: true
@@ -132,7 +145,7 @@ Item {
Item {
id: outputDevice
- x: bodyMargin * virtualstudio.uiScale; y: 330 * virtualstudio.uiScale
+ x: bodyMargin * virtualstudio.uiScale; y: 320 * virtualstudio.uiScale
width: Math.min(parent.width / 2, 320 * virtualstudio.uiScale) - x
height: 100 * virtualstudio.uiScale
clip: true
@@ -176,22 +189,139 @@ Item {
}
}
- Meter {
- id: inputDeviceMeters
- x: inputDevice.x + inputDevice.width; y: 250 * virtualstudio.uiScale
+ Item {
+ id: inputControls
+ x: inputDevice.x + inputDevice.width; y: 230 * virtualstudio.uiScale
width: parent.width - inputDevice.width - 2 * bodyMargin * virtualstudio.uiScale
- height: 100 * virtualstudio.uiScale
- model: inputMeterModel
- clipped: inputClipped
+
+ Meter {
+ id: inputDeviceMeters
+ x: 0; y: 0
+ width: parent.width
+ height: 100 * virtualstudio.uiScale
+ model: inputMeterModel
+ clipped: inputClipped
+ }
+
+ Slider {
+ id: inputSlider
+ from: 0.0
+ value: virtualstudio ? virtualstudio.inputVolume : 0.5
+ onMoved: { virtualstudio.inputVolume = value }
+ to: 1.0
+ enabled: !virtualstudio.inputMuted
+ padding: 0
+ y: inputDeviceMeters.y + 36 * virtualstudio.uiScale
+ anchors.left: inputMute.right
+ anchors.leftMargin: 8 * virtualstudio.uiScale
+ anchors.right: inputDeviceMeters.right
+ opacity: virtualstudio.inputMuted ? 0.3 : 1
+ handle: Rectangle {
+ x: inputSlider.leftPadding + inputSlider.visualPosition * (inputSlider.availableWidth - width)
+ y: inputSlider.topPadding + inputSlider.availableHeight / 2 - height / 2
+ implicitWidth: 26 * virtualstudio.uiScale
+ implicitHeight: 26 * virtualstudio.uiScale
+ radius: 13 * virtualstudio.uiScale
+ color: inputSlider.pressed ? sliderPressedColour : sliderColour
+ border.color: buttonStroke
+ opacity: virtualstudio.inputMuted ? 0.3 : 1
+ }
+ }
+
+ Button {
+ id: inputMute
+ width: 24 * virtualstudio.uiScale
+ height: 24
+ anchors.left: inputDeviceMeters.left
+ anchors.verticalCenter: inputDeviceMeters.verticalCenter
+ background: Rectangle {
+ color: virtualstudio.inputMuted ? muteButtonMutedColor : buttonColour
+ width: 24 * virtualstudio.uiScale
+ radius: 4 * virtualstudio.uiScale
+ }
+ onClicked: { virtualstudio.inputMuted = !virtualstudio.inputMuted }
+ Image {
+ id: micMute
+ width: 11.57 * virtualstudio.uiScale; height: 18 * virtualstudio.uiScale
+ anchors { verticalCenter: parent.verticalCenter; horizontalCenter: parent.horizontalCenter }
+ source: virtualstudio.inputMuted ? "micoff.svg" : "mic.svg"
+ }
+ Colorize {
+ anchors.fill: micMute
+ source: micMute
+ hue: 0
+ saturation: virtualstudio.inputMuted ? muteButtonMutedSaturationValue : 0
+ lightness: virtualstudio.inputMuted ? (inputMute.hovered ? muteButtonMutedLightnessValue + .1 : muteButtonMutedLightnessValue) : (inputMute.hovered ? muteButtonLightnessValue - .1 : muteButtonLightnessValue)
+ }
+ ToolTip {
+ parent: inputMute
+ visible: inputMute.hovered
+ bottomPadding: bottomToolTipMargin * virtualstudio.uiScale
+ rightPadding: rightToolTipMargin * virtualstudio.uiScale
+ delay: 100
+ contentItem: Rectangle {
+ color: toolTipBackgroundColour
+ radius: 3
+ anchors.fill: parent
+ anchors.bottomMargin: bottomToolTipMargin * virtualstudio.uiScale
+ anchors.rightMargin: rightToolTipMargin * virtualstudio.uiScale
+ layer.enabled: true
+ layer.effect: DropShadow {
+ horizontalOffset: 1 * virtualstudio.uiScale
+ verticalOffset: 1 * virtualstudio.uiScale
+ radius: 10.0 * virtualstudio.uiScale
+ samples: 21
+ color: shadowColour
+ }
+
+ Text {
+ anchors.centerIn: parent
+ font { family: "Poppins"; pixelSize: fontSmall * virtualstudio.fontScale * virtualstudio.uiScale}
+ text: virtualstudio.inputMuted ? qsTr("Click to unmute yourself") : qsTr("Click to mute yourself")
+ color: toolTipTextColour
+ }
+ }
+ background: Rectangle {
+ color: "transparent"
+ }
+ }
+ }
}
- Meter {
- id: outputDeviceMeters
- x: outputDevice.x + outputDevice.width; y: 330 * virtualstudio.uiScale
+ Item {
+ id: outputControls
+ x: outputDevice.x + outputDevice.width; y: 320 * virtualstudio.uiScale
width: parent.width - inputDevice.width - 2 * bodyMargin * virtualstudio.uiScale
- height: 100 * virtualstudio.uiScale
- model: outputMeterModel
- clipped: outputClipped
+
+ Meter {
+ id: outputDeviceMeters
+ x: 0; y: 0
+ width: parent.width
+ height: 100 * virtualstudio.uiScale
+ model: outputMeterModel
+ clipped: outputClipped
+ }
+
+ Slider {
+ id: outputSlider
+ from: 0.0
+ value: virtualstudio ? virtualstudio.outputVolume : 0.5
+ onMoved: { virtualstudio.outputVolume = value }
+ to: 1.0
+ padding: 0
+ y: outputDeviceMeters.y + 36 * virtualstudio.uiScale
+ anchors.left: outputDeviceMeters.left
+ anchors.right: outputDeviceMeters.right
+ handle: Rectangle {
+ x: outputSlider.leftPadding + outputSlider.visualPosition * (outputSlider.availableWidth - width)
+ y: outputSlider.topPadding + outputSlider.availableHeight / 2 - height / 2
+ implicitWidth: 26 * virtualstudio.uiScale
+ implicitHeight: 26 * virtualstudio.uiScale
+ radius: 13 * virtualstudio.uiScale
+ color: outputSlider.pressed ? sliderPressedColour : sliderColour
+ border.color: buttonStroke
+ }
+ }
}
Item {
diff --git a/src/gui/Settings.qml b/src/gui/Settings.qml
index 45d75b5..7e478af 100644
--- a/src/gui/Settings.qml
+++ b/src/gui/Settings.qml
@@ -4,7 +4,7 @@ import QtQuick.Controls 2.12
Item {
width: parent.width; height: parent.height
clip: true
-
+
Rectangle {
width: parent.width; height: parent.height
color: backgroundColour
@@ -13,11 +13,12 @@ Item {
property int fontBig: 28
property int fontMedium: 13
property int fontSmall: 11
-
+
property int leftMargin: 48
+ property int rightMargin: 16
property int buttonWidth: 103
property int buttonHeight: 25
-
+
property string backgroundColour: virtualstudio.darkMode ? "#272525" : "#FAFBFB"
property string textColour: virtualstudio.darkMode ? "#FAFBFB" : "#0F0D0D"
property string buttonColour: virtualstudio.darkMode ? "#494646" : "#EAECEC"
@@ -176,7 +177,7 @@ Item {
width: parent.width - x - (16 * virtualstudio.uiScale); height: 36 * virtualstudio.uiScale
visible: virtualstudio.selectableBackend
}
-
+
Text {
id: backendLabel
anchors.verticalCenter: backendCombo.verticalCenter
@@ -186,7 +187,7 @@ Item {
visible: virtualstudio.selectableBackend
color: textColour
}
-
+
Text {
id: jackLabel
x: leftMargin * virtualstudio.uiScale; y: 100 * virtualstudio.uiScale
@@ -197,7 +198,7 @@ Item {
visible: virtualstudio.audioBackend == "JACK" && !virtualstudio.selectableBackend
color: textColour
}
-
+
ComboBox {
id: inputCombo
model: inputComboModel
@@ -207,17 +208,28 @@ Item {
width: parent.width - x - (16 * virtualstudio.uiScale); height: 36 * virtualstudio.uiScale
visible: virtualstudio.audioBackend != "JACK"
}
-
+
+ Meter {
+ id: inputDeviceMeters
+ anchors.left: backendCombo.left
+ anchors.right: parent.right
+ anchors.rightMargin: rightMargin * virtualstudio.uiScale
+ y: virtualstudio.audioBackend != "JACK" ? inputCombo.y + 48 * virtualstudio.uiScale : virtualstudio.uiScale * (virtualstudio.selectableBackend ? 148 : 100)
+ height: 100 * virtualstudio.uiScale
+ model: inputMeterModel
+ clipped: inputClipped
+ }
+
ComboBox {
id: outputCombo
model: outputComboModel
currentIndex: virtualstudio.outputDevice
onActivated: { virtualstudio.outputDevice = currentIndex }
- x: backendCombo.x; y: inputCombo.y + (48 * virtualstudio.uiScale)
+ x: backendCombo.x; y: inputDeviceMeters.y + (48 * virtualstudio.uiScale)
width: backendCombo.width; height: backendCombo.height
visible: virtualstudio.audioBackend != "JACK"
}
-
+
Text {
anchors.verticalCenter: inputCombo.verticalCenter
x: leftMargin * virtualstudio.uiScale
@@ -226,7 +238,7 @@ Item {
visible: virtualstudio.audioBackend != "JACK"
color: textColour
}
-
+
Text {
anchors.verticalCenter: outputCombo.verticalCenter
x: leftMargin * virtualstudio.uiScale
@@ -237,6 +249,26 @@ Item {
}
Button {
+ id: testOutputAudioButton
+ background: Rectangle {
+ radius: 6 * virtualstudio.uiScale
+ color: testOutputAudioButton.down ? buttonPressedColour : (testOutputAudioButton.hovered ? buttonHoverColour : buttonColour)
+ border.width: 1
+ border.color: testOutputAudioButton.down ? buttonPressedStroke : (testOutputAudioButton.hovered ? buttonHoverStroke : buttonStroke)
+ }
+ onClicked: { virtualstudio.playOutputAudio() }
+ width: 216 * virtualstudio.uiScale; height: 30 * virtualstudio.uiScale
+ x: parent.width - (232 * virtualstudio.uiScale)
+ y: virtualstudio.audioBackend != "JACK" ? outputCombo.y + (60 * virtualstudio.uiScale) : inputDeviceMeters.y + (48 * virtualstudio.uiScale)
+ Text {
+ text: "Test Output Audio"
+ font { family: "Poppins"; pixelSize: fontSmall * virtualstudio.fontScale * virtualstudio.uiScale }
+ anchors { horizontalCenter: parent.horizontalCenter; verticalCenter: parent.verticalCenter }
+ color: textColour
+ }
+ }
+
+ Button {
id: refreshButton
background: Rectangle {
radius: 6 * virtualstudio.uiScale
@@ -245,27 +277,29 @@ Item {
border.color: refreshButton.down ? buttonPressedStroke : (refreshButton.hovered ? buttonHoverStroke : buttonStroke)
}
onClicked: { virtualstudio.refreshDevices() }
- x: parent.width - (232 * virtualstudio.uiScale); y: inputCombo.y + (100 * virtualstudio.uiScale)
+ x: parent.width - (232 * virtualstudio.uiScale); y: testOutputAudioButton.y + (48 * virtualstudio.uiScale)
width: 216 * virtualstudio.uiScale; height: 30 * virtualstudio.uiScale
visible: virtualstudio.audioBackend != "JACK"
Text {
- text: "Refresh Device List"
- font { family: "Poppins"; pixelSize: 11 * virtualstudio.fontScale * virtualstudio.uiScale }
+ text: "Refresh Devices"
+ font { family: "Poppins"; pixelSize: fontSmall * virtualstudio.fontScale * virtualstudio.uiScale }
anchors { horizontalCenter: parent.horizontalCenter; verticalCenter: parent.verticalCenter }
color: textColour
}
}
-
+
Rectangle {
- x: leftMargin * virtualstudio.uiScale; y: inputCombo.y + (146 * virtualstudio.uiScale)
+ id: divider
+ x: leftMargin * virtualstudio.uiScale
+ y: virtualstudio.audioBackend != "JACK" ? refreshButton.y + (48 * virtualstudio.uiScale) : testOutputAudioButton.y + (48 * virtualstudio.uiScale)
width: parent.width - x - (16 * virtualstudio.uiScale); height: 1 * virtualstudio.uiScale
color: textColour
visible: virtualstudio.audioBackend != "JACK"
}
-
+
ComboBox {
id: bufferCombo
- x: backendCombo.x; y: inputCombo.y + (162 * virtualstudio.uiScale)
+ x: backendCombo.x; y: divider.y + (24 * virtualstudio.uiScale)
width: backendCombo.width; height: backendCombo.height
model: bufferComboModel
currentIndex: virtualstudio.bufferSize
@@ -300,7 +334,7 @@ Item {
from: 1; to: 2; value: virtualstudio.uiScale
onMoved: { virtualstudio.uiScale = value }
}
-
+
Text {
anchors.verticalCenter: scaleSlider.verticalCenter
x: leftMargin * virtualstudio.uiScale
@@ -308,7 +342,7 @@ Item {
font { family: "Poppins"; pixelSize: fontMedium * virtualstudio.fontScale * virtualstudio.uiScale }
color: textColour
}
-
+
Button {
id: darkButton
background: Rectangle {
@@ -422,7 +456,7 @@ Item {
y: header.height
color: backgroundColour
visible: settingsGroupView == "Profile"
-
+
Image {
id: profilePicture
width: 96; height: 96
@@ -489,6 +523,27 @@ Item {
color: textColour
}
}
+
+ Button {
+ id: testModeButton
+ background: Rectangle {
+ radius: 6 * virtualstudio.uiScale
+ color: testModeButton.down ? buttonPressedColour : (testModeButton.hovered ? buttonHoverColour : buttonColour)
+ border.width: 1
+ border.color: testModeButton.down ? buttonPressedStroke : (testModeButton.hovered ? buttonHoverStroke : buttonStroke)
+ }
+ onClicked: { virtualstudio.testMode = !virtualstudio.testMode; window.state = "login"; virtualstudio.logout() }
+ anchors.horizontalCenter: parent.horizontalCenter
+ y: logoutButton.y + (48 * virtualstudio.uiScale)
+ width: 260 * virtualstudio.uiScale; height: 30 * virtualstudio.uiScale
+ visible: virtualstudio.userMetadata.email ? ( virtualstudio.userMetadata.email.endsWith("@jacktrip.org") ? true : false ) : false
+ Text {
+ text: virtualstudio.testMode ? "Switch to Prod Mode" : "Switch to Test Mode"
+ font { family: "Poppins"; pixelSize: fontSmall * virtualstudio.fontScale * virtualstudio.uiScale }
+ anchors { horizontalCenter: parent.horizontalCenter; verticalCenter: parent.verticalCenter }
+ color: textColour
+ }
+ }
}
Rectangle {
diff --git a/src/gui/Setup.qml b/src/gui/Setup.qml
index 7a27a20..b8e8358 100644
--- a/src/gui/Setup.qml
+++ b/src/gui/Setup.qml
@@ -9,11 +9,14 @@ Item {
property int fontBig: 28
property int fontMedium: 13
property int fontSmall: 11
-
- property int leftMargin: 48
+ property int fontExtraSmall: 8
+
property int buttonWidth: 103
property int buttonHeight: 25
+ property int leftMargin: 48
+ property int rightMargin: 16
+
property string backgroundColour: virtualstudio.darkMode ? "#272525" : "#FAFBFB"
property real imageLightnessValue: virtualstudio.darkMode ? 1.0 : 0.0
property string textColour: virtualstudio.darkMode ? "#FAFBFB" : "#0F0D0D"
@@ -23,6 +26,8 @@ Item {
property string buttonStroke: virtualstudio.darkMode ? "#80827D7D" : "#34979797"
property string buttonHoverStroke: virtualstudio.darkMode ? "#7B7777" : "#BABCBC"
property string buttonPressedStroke: virtualstudio.darkMode ? "#827D7D" : "#BABCBC"
+ property string sliderColour: virtualstudio.darkMode ? "#BABCBC" : "#EAECEC"
+ property string sliderPressedColour: virtualstudio.darkMode ? "#ACAFAF" : "#DEE0E0"
property string saveButtonShadow: "#80A1A1A1"
property string saveButtonBackgroundColour: "#F2F3F3"
property string saveButtonPressedColour: "#E7E8E8"
@@ -57,7 +62,7 @@ Item {
saturation: 0
lightness: imageLightnessValue
}
-
+
Text {
id: ethernetWarningHeader
text: "Connect via Wired Ethernet"
@@ -193,7 +198,7 @@ Item {
saturation: 0
lightness: imageLightnessValue
}
-
+
Text {
id: headphoneWarningHeader
text: "Use Wired Headphones"
@@ -318,24 +323,27 @@ Item {
id: setupItem
width: parent.width; height: parent.height
visible: warningScreen == "acknowledged"
-
+
Text {
+ id: pageTitle
x: 16 * virtualstudio.uiScale; y: 32 * virtualstudio.uiScale
text: "Choose your audio devices"
font { family: "Poppins"; weight: Font.Bold; pixelSize: fontBig * virtualstudio.fontScale * virtualstudio.uiScale }
color: textColour
}
-
+
ComboBox {
id: backendCombo
model: backendComboModel
currentIndex: virtualstudio.audioBackend == "JACK" ? 0 : 1
onActivated: { virtualstudio.audioBackend = currentText }
- x: 234 * virtualstudio.uiScale; y: 150 * virtualstudio.uiScale
- width: parent.width - x - (16 * virtualstudio.uiScale); height: 36 * virtualstudio.uiScale
+ anchors.right: parent.right
+ anchors.rightMargin: rightMargin * virtualstudio.uiScale
+ y: pageTitle.y + 96 * virtualstudio.uiScale
+ width: parent.width - (234 * virtualstudio.uiScale); height: 36 * virtualstudio.uiScale
visible: virtualstudio.selectableBackend
}
-
+
Text {
id: backendLabel
anchors.verticalCenter: backendCombo.verticalCenter
@@ -345,7 +353,7 @@ Item {
visible: virtualstudio.selectableBackend
color: textColour
}
-
+
Text {
id: jackLabel
x: leftMargin * virtualstudio.uiScale; y: 150 * virtualstudio.uiScale
@@ -356,47 +364,125 @@ Item {
visible: virtualstudio.audioBackend == "JACK" && !virtualstudio.selectableBackend
color: textColour
}
-
- ComboBox {
- id: inputCombo
- model: inputComboModel
- currentIndex: virtualstudio.inputDevice
- onActivated: { virtualstudio.inputDevice = currentIndex }
- x: 234 * virtualstudio.uiScale; y: virtualstudio.uiScale * (virtualstudio.selectableBackend ? 198 : 150)
- width: parent.width - x - (16 * virtualstudio.uiScale); height: 36 * virtualstudio.uiScale
- visible: virtualstudio.audioBackend != "JACK"
- }
-
+
ComboBox {
id: outputCombo
model: outputComboModel
currentIndex: virtualstudio.outputDevice
onActivated: { virtualstudio.outputDevice = currentIndex }
- x: backendCombo.x; y: inputCombo.y + (48 * virtualstudio.uiScale)
+ x: backendCombo.x; y: backendCombo.y + virtualstudio.uiScale * (virtualstudio.selectableBackend ? 48 : 0)
width: backendCombo.width; height: backendCombo.height
visible: virtualstudio.audioBackend != "JACK"
}
-
+
Text {
- id: inputLabel
- anchors.verticalCenter: inputCombo.verticalCenter
+ id: outputLabel
+ anchors.verticalCenter: virtualstudio.audioBackend != "JACK" ? outputCombo.verticalCenter : outputSlider.verticalCenter
x: leftMargin * virtualstudio.uiScale
- text: "Input Device"
+ text: virtualstudio.audioBackend != "JACK" ? "Output Device" : "Output Volume"
font { family: "Poppins"; pixelSize: fontMedium * virtualstudio.fontScale * virtualstudio.uiScale }
- visible: virtualstudio.audioBackend != "JACK"
color: textColour
}
-
+
+ Slider {
+ id: outputSlider
+ from: 0.0
+ value: audioInterface ? audioInterface.outputVolume : 0.5
+ onMoved: { audioInterface.outputVolume = value }
+ to: 1.0
+ padding: 0
+ y: virtualstudio.audioBackend != "JACK" ? outputCombo.y + 48 * virtualstudio.uiScale : backendCombo.y + virtualstudio.uiScale * (virtualstudio.selectableBackend ? 60 : 0)
+ anchors.left: outputCombo.left
+ anchors.right: parent.right
+ anchors.rightMargin: rightMargin * virtualstudio.uiScale
+ handle: Rectangle {
+ x: outputSlider.leftPadding + outputSlider.visualPosition * (outputSlider.availableWidth - width)
+ y: outputSlider.topPadding + outputSlider.availableHeight / 2 - height / 2
+ implicitWidth: 26 * virtualstudio.uiScale
+ implicitHeight: 26 * virtualstudio.uiScale
+ radius: 13 * virtualstudio.uiScale
+ color: outputSlider.pressed ? sliderPressedColour : sliderColour
+ border.color: buttonStroke
+ }
+ }
+
+ Button {
+ id: testOutputAudioButton
+ background: Rectangle {
+ radius: 6 * virtualstudio.uiScale
+ color: testOutputAudioButton.down ? buttonPressedColour : (testOutputAudioButton.hovered ? buttonHoverColour : buttonColour)
+ border.width: 1
+ border.color: testOutputAudioButton.down ? buttonPressedStroke : (testOutputAudioButton.hovered ? buttonHoverStroke : buttonStroke)
+ }
+ onClicked: { virtualstudio.playOutputAudio() }
+ anchors.right: parent.right
+ anchors.rightMargin: rightMargin * virtualstudio.uiScale
+ y: outputSlider.y + (36 * virtualstudio.uiScale)
+ width: 216 * virtualstudio.uiScale; height: 30 * virtualstudio.uiScale
+ visible: virtualstudio.audioBackend != "JACK"
+ Text {
+ text: "Test Output Audio"
+ font { family: "Poppins"; pixelSize: fontSmall * virtualstudio.fontScale * virtualstudio.uiScale }
+ anchors { horizontalCenter: parent.horizontalCenter; verticalCenter: parent.verticalCenter }
+ color: textColour
+ }
+ }
+
+ ComboBox {
+ id: inputCombo
+ model: inputComboModel
+ currentIndex: virtualstudio.inputDevice
+ onActivated: { virtualstudio.inputDevice = currentIndex }
+ anchors.right: parent.right
+ anchors.rightMargin: rightMargin * virtualstudio.uiScale
+ y: testOutputAudioButton.y + (48 * virtualstudio.uiScale)
+ width: parent.width - (234 * virtualstudio.uiScale); height: 36 * virtualstudio.uiScale
+ visible: virtualstudio.audioBackend != "JACK"
+ }
+
Text {
- id: outputLabel
- anchors.verticalCenter: outputCombo.verticalCenter
+ id: inputLabel
+ anchors.top: virtualstudio.audioBackend != "JACK" ? inputCombo.top : inputDeviceMeters.top
+ anchors.topMargin: virtualstudio.audioBackend != "JACK" ? (inputCombo.height - inputLabel.height)/2 : 0
x: leftMargin * virtualstudio.uiScale
- text: "Output Device"
+ text: virtualstudio.audioBackend != "JACK" ? "Input Device" : "Input Volume"
font { family: "Poppins"; pixelSize: fontMedium * virtualstudio.fontScale * virtualstudio.uiScale }
- visible: virtualstudio.audioBackend != "JACK"
color: textColour
}
+ Meter {
+ id: inputDeviceMeters
+ anchors.left: backendCombo.left
+ anchors.right: parent.right
+ anchors.rightMargin: rightMargin * virtualstudio.uiScale
+ y: virtualstudio.audioBackend != "JACK" ? inputCombo.y + 72 * virtualstudio.uiScale : outputSlider.y + (72 * virtualstudio.uiScale)
+ height: 100 * virtualstudio.uiScale
+ model: inputMeterModel
+ clipped: inputClipped
+ }
+
+ Slider {
+ id: inputSlider
+ from: 0.0
+ value: audioInterface ? audioInterface.inputVolume : 0.5
+ onMoved: { audioInterface.inputVolume = value }
+ to: 1.0
+ padding: 0
+ y: inputDeviceMeters.y + 48 * virtualstudio.uiScale
+ anchors.left: inputDeviceMeters.left
+ anchors.right: parent.right
+ anchors.rightMargin: rightMargin * virtualstudio.uiScale
+ handle: Rectangle {
+ x: inputSlider.leftPadding + inputSlider.visualPosition * (inputSlider.availableWidth - width)
+ y: inputSlider.topPadding + inputSlider.availableHeight / 2 - height / 2
+ implicitWidth: 26 * virtualstudio.uiScale
+ implicitHeight: 26 * virtualstudio.uiScale
+ radius: 13 * virtualstudio.uiScale
+ color: inputSlider.pressed ? sliderPressedColour : sliderColour
+ border.color: buttonStroke
+ }
+ }
+
Button {
id: refreshButton
background: Rectangle {
@@ -406,11 +492,14 @@ Item {
border.color: refreshButton.down ? buttonPressedStroke : (refreshButton.hovered ? buttonHoverStroke : buttonStroke)
}
onClicked: { virtualstudio.refreshDevices() }
- x: parent.width - (232 * virtualstudio.uiScale); y: inputCombo.y + (100 * virtualstudio.uiScale)
+ anchors.right: parent.right
+ anchors.rightMargin: rightMargin * virtualstudio.uiScale
+ anchors.topMargin: 18 * virtualstudio.uiScale
+ anchors.top: inputSlider.bottom
width: 216 * virtualstudio.uiScale; height: 30 * virtualstudio.uiScale
visible: virtualstudio.audioBackend != "JACK"
Text {
- text: "Refresh Device List"
+ text: "Refresh Devices"
font { family: "Poppins"; pixelSize: fontSmall * virtualstudio.fontScale * virtualstudio.uiScale }
anchors { horizontalCenter: parent.horizontalCenter; verticalCenter: parent.verticalCenter }
color: textColour
@@ -422,12 +511,13 @@ Item {
anchors.right: outputCombo.right
anchors.leftMargin: 16 * virtualstudio.uiScale
anchors.rightMargin: 16 * virtualstudio.uiScale
- y: inputCombo.y + (160 * virtualstudio.uiScale)
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: 60 * virtualstudio.uiScale
text: "JackTrip on Windows requires use of an audio device with ASIO drivers. If you do not see your device, you may need to install drivers from your manufacturer."
horizontalAlignment: Text.AlignHCenter
wrapMode: Text.WordWrap
color: warningText
- font { family: "Poppins"; pixelSize: fontSmall * virtualstudio.fontScale * virtualstudio.uiScale }
+ font { family: "Poppins"; pixelSize: fontExtraSmall * virtualstudio.fontScale * virtualstudio.uiScale }
visible: Qt.platform.os == "windows" && virtualstudio.audioBackend != "JACK"
}
@@ -449,8 +539,8 @@ Item {
}
onClicked: { window.state = "browse"; virtualstudio.applySettings() }
anchors.right: parent.right
- anchors.rightMargin: 16 * virtualstudio.uiScale
- anchors.bottomMargin: 16 * virtualstudio.uiScale
+ anchors.rightMargin: rightMargin * virtualstudio.uiScale
+ anchors.bottomMargin: rightMargin * virtualstudio.uiScale
anchors.bottom: parent.bottom
width: 150 * virtualstudio.uiScale; height: 30 * virtualstudio.uiScale
Text {
diff --git a/src/gui/Studio.qml b/src/gui/Studio.qml
index 9f07b58..fffc304 100644
--- a/src/gui/Studio.qml
+++ b/src/gui/Studio.qml
@@ -21,6 +21,7 @@ Rectangle {
property string serverLocation: "Germany - Berlin"
property string flagImage: "flags/DE.svg"
+ property string hostname: "app.jacktrip.org"
property string studioName: "Test Studio"
property string studioId: ""
property string inviteKeyString: ""
@@ -205,10 +206,13 @@ Rectangle {
}
onClicked: {
inviteCopied = true;
+ if (virtualstudio.testMode) {
+ hostname = "test.jacktrip.org";
+ }
if (!inviteKeyString) {
- clipboard.setText(qsTr("https://app.jacktrip.org/studios/" + studioId + "?invited=true"));
+ clipboard.setText(qsTr("https://" + hostname + "/studios/" + studioId + "?invited=true"));
} else {
- clipboard.setText(qsTr("https://app.jacktrip.org/studios/" + studioId + "?invited=" + inviteKeyString));
+ clipboard.setText(qsTr("https://" + hostname + "/studios/" + studioId + "?invited=" + inviteKeyString));
}
copiedResetTimer.restart()
}
diff --git a/src/gui/about.cpp b/src/gui/about.cpp
index 08e81cf..7b82019 100644
--- a/src/gui/about.cpp
+++ b/src/gui/about.cpp
@@ -48,6 +48,8 @@ About::About(QWidget* parent) : QDialog(parent), m_ui(new Ui::About)
m_ui->aboutLabel->setText(
m_ui->aboutLabel->text().replace(QLatin1String("%VERSION%"), gVersion));
+ m_ui->aboutLabel->setText(
+ m_ui->aboutLabel->text().replace(QLatin1String("%QTVERSION%"), qVersion()));
#ifdef QT_OPENSOURCE
m_ui->aboutLabel->setText(m_ui->aboutLabel->text().replace(
QLatin1String("%LICENSE%"),
diff --git a/src/gui/about.ui b/src/gui/about.ui
index afff2b3..9d140e8 100644
--- a/src/gui/about.ui
+++ b/src/gui/about.ui
@@ -93,7 +93,7 @@ border: 4px solid black; </string>
</size>
</property>
<property name="text">
- <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;A system for high quality audio network performance over the internet.&lt;/p&gt;&lt;p&gt;Version %VERSION%%BUILD%&lt;/p&gt;&lt;p&gt;Copyright © 2008-2020 Juan-Pablo Caceres, Chris Chafe, et al. SoundWIRE group at CCRMA, Stanford University.&lt;/p&gt;&lt;p&gt;Graphical user interface component originally released as QJackTrip, Copyright © 2020 Aaron Wyatt.&lt;p&gt;%LICENSE%JackTrip source code is released under MIT and GPL licenses. See LICENSE.md file for more information.&lt;/p&gt;This is free software and is provided &amp;quot;as is&amp;quot;, without warranty of any kind.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;A system for high quality audio network performance over the internet.&lt;/p&gt;&lt;p&gt;Version %VERSION%%BUILD%&lt;br/&gt;Using Qt %QTVERSION%&lt;/p&gt;&lt;p&gt;Copyright © 2008-2020 Juan-Pablo Caceres, Chris Chafe, et al. SoundWIRE group at CCRMA, Stanford University.&lt;/p&gt;&lt;p&gt;Graphical user interface component originally released as QJackTrip, Copyright © 2020 Aaron Wyatt.&lt;/p&gt;&lt;p&gt;%LICENSE%JackTrip source code is released under MIT and GPL licenses. See LICENSE.md file for more information.&lt;/p&gt;&lt;p&gt;This is free software and is provided &amp;quot;as is&amp;quot;, without warranty of any kind.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
diff --git a/src/gui/Jacktrip.ai b/src/gui/alt/Jacktrip.ai
index fc14ad6..fc14ad6 100644
--- a/src/gui/Jacktrip.ai
+++ b/src/gui/alt/Jacktrip.ai
diff --git a/src/gui/alt/about.png b/src/gui/alt/about.png
new file mode 100644
index 0000000..99d8c77
--- /dev/null
+++ b/src/gui/alt/about.png
Binary files differ
diff --git a/src/gui/alt/about@2x.png b/src/gui/alt/about@2x.png
new file mode 100644
index 0000000..0b2f82c
--- /dev/null
+++ b/src/gui/alt/about@2x.png
Binary files differ
diff --git a/src/gui/alt/icon.png b/src/gui/alt/icon.png
new file mode 100644
index 0000000..d6a2d90
--- /dev/null
+++ b/src/gui/alt/icon.png
Binary files differ
diff --git a/src/gui/micoff.svg b/src/gui/micoff.svg
new file mode 100644
index 0000000..e827d6f
--- /dev/null
+++ b/src/gui/micoff.svg
@@ -0,0 +1,17 @@
+<svg width="19" height="28" viewBox="0 0 19 28" fill="none" xmlns="http://www.w3.org/2000/svg">
+<g clip-path="url(#clip0_1_2)">
+<g clip-path="url(#clip1_1_2)">
+<path d="M14.7516 5.43539C14.7516 2.43351 12.3181 0 9.31624 0C6.31436 0 3.88086 2.43351 3.88086 5.43539V13.4077C3.88086 16.4096 6.31436 18.8431 9.31624 18.8431C12.3181 18.8431 14.7516 16.4096 14.7516 13.4077V5.43539Z" fill="#0F0D0D"/>
+<path d="M0.906172 12.2445C0.66584 12.2445 0.435352 12.34 0.265412 12.5099C0.0954714 12.6799 0 12.9104 0 13.1507C0 17.9818 3.69688 21.9658 8.41039 22.4224V26.1882H4.7868C4.66596 26.1852 4.54575 26.2065 4.43324 26.2507C4.32074 26.2949 4.21821 26.3611 4.1317 26.4455C4.04518 26.5299 3.97643 26.6308 3.92949 26.7422C3.88255 26.8536 3.85837 26.9732 3.85837 27.0941C3.85837 27.215 3.88255 27.3346 3.92949 27.446C3.97643 27.5574 4.04518 27.6583 4.1317 27.7427C4.21821 27.8271 4.32074 27.8934 4.43324 27.9375C4.54575 27.9817 4.66596 28.003 4.7868 28H13.8463C14.0827 27.9942 14.3075 27.8962 14.4727 27.7269C14.6378 27.5577 14.7302 27.3306 14.7302 27.0941C14.7302 26.8576 14.6378 26.6305 14.4727 26.4613C14.3075 26.292 14.0827 26.194 13.8463 26.1882H10.2227V22.4219C14.9363 21.9647 18.6331 17.9813 18.6331 13.1502C18.6273 12.9138 18.5293 12.689 18.3601 12.5238C18.1908 12.3587 17.9637 12.2663 17.7272 12.2663C17.4908 12.2663 17.2636 12.3587 17.0944 12.5238C16.9251 12.689 16.8271 12.9138 16.8213 13.1502C16.8213 17.2878 13.4548 20.6544 9.31711 20.6544C5.17945 20.6544 1.81234 17.2884 1.81234 13.1507C1.81234 12.9104 1.71687 12.6799 1.54693 12.5099C1.37699 12.34 1.1465 12.2445 0.906172 12.2445Z" fill="#0F0D0D"/>
+<line x1="1.38898" y1="2.26597" x2="17.111" y2="25.4353" stroke="#0F0D0D" stroke-width="2" stroke-linecap="round"/>
+</g>
+</g>
+<defs>
+<clipPath id="clip0_1_2">
+<rect width="19" height="28" fill="white"/>
+</clipPath>
+<clipPath id="clip1_1_2">
+<rect width="19" height="28" fill="white"/>
+</clipPath>
+</defs>
+</svg>
diff --git a/src/gui/qjacktrip.cpp b/src/gui/qjacktrip.cpp
index c685a7d..191d544 100644
--- a/src/gui/qjacktrip.cpp
+++ b/src/gui/qjacktrip.cpp
@@ -37,11 +37,7 @@
#ifndef NO_VS
#include "virtualstudio.h"
#endif
-#ifdef PSI
-#include "ui_qjacktrip_novs.h"
-#else
#include "ui_qjacktrip.h"
-#endif
#ifdef USE_WEAK_JACK
#include "weak_libjack.h"
#endif
@@ -57,11 +53,7 @@
QJackTrip::QJackTrip(int argc, bool suppressCommandlineWarning, QWidget* parent)
: QMainWindow(parent)
-#ifdef PSI
, m_ui(new Ui::QJackTrip)
-#else
- , m_ui(new Ui::QJackTripVS)
-#endif
, m_netManager(new QNetworkAccessManager(this))
, m_statsDialog(new MessageDialog(this, QStringLiteral("Stats")))
, m_debugDialog(new MessageDialog(this, QStringLiteral("Debug"), 2))
@@ -69,6 +61,7 @@ QJackTrip::QJackTrip(int argc, bool suppressCommandlineWarning, QWidget* parent)
, m_realCerr(std::cerr.rdbuf())
, m_jackTripRunning(false)
, m_isExiting(false)
+ , m_exitSent(false)
, m_hasIPv4Reply(false)
, m_argc(argc)
, m_hideWarning(false)
@@ -107,7 +100,12 @@ QJackTrip::QJackTrip(int argc, bool suppressCommandlineWarning, QWidget* parent)
About about(this);
about.exec();
});
-#ifndef NO_VS
+#ifdef NO_VS
+ m_ui->authNotVSLabel->setText(
+ QStringLiteral("(This is for JackTrip's inbuilt authentication system. To easily "
+ "connect to a Virtual Studio server, download a Virtual Studio "
+ "enabled version of JackTrip.)"));
+#else
connect(m_ui->vsModeButton, &QPushButton::clicked, this,
&QJackTrip::virtualStudioMode);
#endif
@@ -314,7 +312,9 @@ QJackTrip::QJackTrip(int argc, bool suppressCommandlineWarning, QWidget* parent)
// Check if Jack is actually available
if (have_libjack() != 0) {
#ifdef RT_AUDIO
+#ifdef PSI
bool usingRtAudioAlready = m_ui->backendComboBox->currentIndex() == 1;
+#endif // PSI
m_ui->backendComboBox->setCurrentIndex(1);
m_ui->backendComboBox->setEnabled(false);
m_ui->backendLabel->setEnabled(false);
@@ -382,9 +382,11 @@ QJackTrip::QJackTrip(int argc, bool suppressCommandlineWarning, QWidget* parent)
void QJackTrip::closeEvent(QCloseEvent* event)
{
- // Ignore the close event so that we can override the handling of it.
- event->ignore();
- exit();
+ if (!m_exitSent) {
+ // Ignore the close event so that we can override the handling of it.
+ event->ignore();
+ exit();
+ }
}
void QJackTrip::resizeEvent(QResizeEvent* event)
@@ -417,6 +419,15 @@ void QJackTrip::resizeEvent(QResizeEvent* event)
rect = metrics.boundingRect(0, 0, width, 0, Qt::TextWordWrap,
m_ui->authDisclaimerLabel->text());
m_ui->authDisclaimerLabel->setMinimumHeight(rect.height());
+
+ width = m_ui->authGroupBox->contentsRect().width()
+ - m_ui->authGroupBox->contentsMargins().left()
+ - m_ui->authGroupBox->contentsMargins().right()
+ - m_ui->authGroupBox->layout()->contentsMargins().left()
+ - m_ui->authGroupBox->contentsMargins().right();
+ rect = metrics.boundingRect(0, 0, width, 0, Qt::TextWordWrap,
+ m_ui->authNotVSLabel->text());
+ m_ui->authNotVSLabel->setMinimumHeight(rect.height());
}
void QJackTrip::showEvent(QShowEvent* event)
@@ -467,6 +478,7 @@ void QJackTrip::processFinished()
m_jackTrip.reset();
}
if (m_isExiting) {
+ m_exitSent = true;
emit signalExit();
} else {
enableUi(true);
@@ -722,6 +734,17 @@ void QJackTrip::start()
// Start the appropriate JackTrip process.
try {
+ AudioInterface::audioBitResolutionT resolution;
+ if (m_ui->resolutionComboBox->currentIndex() == 0) {
+ resolution = AudioInterface::BIT8;
+ } else if (m_ui->resolutionComboBox->currentIndex() == 1) {
+ resolution = AudioInterface::BIT16;
+ } else if (m_ui->resolutionComboBox->currentIndex() == 2) {
+ resolution = AudioInterface::BIT24;
+ } else {
+ resolution = AudioInterface::BIT32;
+ }
+
if (m_ui->typeComboBox->currentIndex() == HUB_SERVER) {
m_udpHub.reset(new UdpHubListener(m_ui->localPortSpinBox->value(),
m_ui->basePortSpinBox->value()));
@@ -745,6 +768,7 @@ void QJackTrip::start()
// Set buffers to zero when underrun
m_udpHub->setUnderRunMode(JackTrip::ZEROS);
}
+ m_udpHub->setAudioBitResolution(resolution);
if (!m_ui->jitterCheckBox->isChecked()) {
m_udpHub->setBufferStrategy(-1);
@@ -797,17 +821,6 @@ void QJackTrip::start()
jackTripMode = JackTrip::CLIENTTOPINGSERVER;
}
- AudioInterface::audioBitResolutionT resolution;
- if (m_ui->resolutionComboBox->currentIndex() == 0) {
- resolution = AudioInterface::BIT8;
- } else if (m_ui->resolutionComboBox->currentIndex() == 1) {
- resolution = AudioInterface::BIT16;
- } else if (m_ui->resolutionComboBox->currentIndex() == 2) {
- resolution = AudioInterface::BIT24;
- } else {
- resolution = AudioInterface::BIT32;
- }
-
m_jackTrip.reset(new JackTrip(jackTripMode, JackTrip::UDP,
m_ui->channelSendSpinBox->value(),
m_ui->channelRecvSpinBox->value(),
@@ -975,6 +988,7 @@ void QJackTrip::exit()
if (m_jackTripRunning) {
stop();
} else {
+ m_exitSent = true;
emit signalExit();
}
}
diff --git a/src/gui/qjacktrip.h b/src/gui/qjacktrip.h
index 3a396e5..4359b31 100644
--- a/src/gui/qjacktrip.h
+++ b/src/gui/qjacktrip.h
@@ -51,11 +51,7 @@
namespace Ui
{
-#ifdef PSI
class QJackTrip;
-#else
-class QJackTripVS;
-#endif
} // namespace Ui
#ifndef NO_VS
@@ -76,7 +72,7 @@ class QJackTrip : public QMainWindow
void showEvent(QShowEvent* event) override;
#ifndef NO_VS
- enum uiModeT{UNSET, VIRTUAL_STUDIO, STANDARD};
+ enum uiModeT { UNSET, VIRTUAL_STUDIO, STANDARD };
void setVs(QSharedPointer<VirtualStudio> vs);
#endif
@@ -123,11 +119,7 @@ class QJackTrip : public QMainWindow
QString commandLineFromCurrentOptions();
void showCommandLineMessageBox();
-#ifdef PSI
QScopedPointer<Ui::QJackTrip> m_ui;
-#else
- QScopedPointer<Ui::QJackTripVS> m_ui;
-#endif
QScopedPointer<UdpHubListener> m_udpHub;
QScopedPointer<JackTrip> m_jackTrip;
QScopedPointer<QNetworkAccessManager> m_netManager;
@@ -137,6 +129,7 @@ class QJackTrip : public QMainWindow
std::ostream m_realCerr;
bool m_jackTripRunning;
bool m_isExiting;
+ bool m_exitSent;
QMutex m_requestMutex;
QString m_IPv6Address;
diff --git a/src/gui/qjacktrip.qrc b/src/gui/qjacktrip.qrc
index 2861744..c34366f 100644
--- a/src/gui/qjacktrip.qrc
+++ b/src/gui/qjacktrip.qrc
@@ -27,6 +27,7 @@
<file>share.svg</file>
<file>cog.svg</file>
<file>mic.svg</file>
+ <file>micoff.svg</file>
<file>ethernet.png</file>
<file>ohno.png</file>
<file>headphones.svg</file>
diff --git a/src/gui/qjacktrip.ui b/src/gui/qjacktrip.ui
index 9044e47..9ead504 100644
--- a/src/gui/qjacktrip.ui
+++ b/src/gui/qjacktrip.ui
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
- <class>QJackTripVS</class>
- <widget class="QMainWindow" name="QJackTripVS">
+ <class>QJackTrip</class>
+ <widget class="QMainWindow" name="QJackTrip">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>409</width>
- <height>845</height>
+ <height>913</height>
</rect>
</property>
<property name="windowTitle">
@@ -165,6 +165,280 @@ To connect to a hub server you need to run as a hub client.</string>
<string>Basic options</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_3">
+ <item row="3" column="0" colspan="2">
+ <widget class="QGroupBox" name="autoPatchGroupBox">
+ <property name="title">
+ <string/>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_10">
+ <item row="0" column="0" rowspan="2" colspan="2">
+ <widget class="QLabel" name="autoPatchLabel">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Hub auto&amp;patch mode</string>
+ </property>
+ <property name="buddy">
+ <cstring>autoPatchComboBox</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="2">
+ <widget class="QComboBox" name="autoPatchComboBox">
+ <property name="toolTip">
+ <string>Select how you want audio to be routed by the hub server.</string>
+ </property>
+ <property name="currentIndex">
+ <number>0</number>
+ </property>
+ <item>
+ <property name="text">
+ <string>Server to clients</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Client loopback</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Client fan out/in but no loopback</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Full Mix</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>No auto patching</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ <item row="3" column="0" colspan="3">
+ <widget class="QCheckBox" name="upmixCheckBox">
+ <property name="toolTip">
+ <string>For clients that only send one channel of audio, relay their signal in stereo.</string>
+ </property>
+ <property name="text">
+ <string>&amp;Upmix mono clients to stereo</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" colspan="3">
+ <widget class="QCheckBox" name="patchServerCheckBox">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="toolTip">
+ <string>Include the server in the audio patching. This allows an ensemble member to
+play from this machine. (Available in client fan out/in and full mix modes.)</string>
+ </property>
+ <property name="text">
+ <string>&amp;Include server in patching</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="2" column="0" colspan="2">
+ <widget class="QGroupBox" name="channelGroupBox">
+ <layout class="QGridLayout" name="gridLayout_9">
+ <item row="3" column="0">
+ <widget class="QLabel" name="channelRecvLabel">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>&amp;Received from network:</string>
+ </property>
+ <property name="buddy">
+ <cstring>channelRecvSpinBox</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1">
+ <widget class="QSpinBox" name="channelRecvSpinBox">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="toolTip">
+ <string>Number of audio channels toaccept from the network.</string>
+ </property>
+ <property name="minimum">
+ <number>1</number>
+ </property>
+ <property name="value">
+ <number>2</number>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="1">
+ <widget class="QSpinBox" name="channelSendSpinBox">
+ <property name="toolTip">
+ <string>Number of audio channels to send to the network.</string>
+ </property>
+ <property name="minimum">
+ <number>1</number>
+ </property>
+ <property name="value">
+ <number>2</number>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0">
+ <widget class="QLabel" name="channelSendLabel">
+ <property name="text">
+ <string>&amp;Sent to network:</string>
+ </property>
+ <property name="buddy">
+ <cstring>channelSendSpinBox</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" colspan="2">
+ <widget class="QLabel" name="channelLabel">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>&amp;Number of channels</string>
+ </property>
+ <property name="buddy">
+ <cstring>channelRecvSpinBox</cstring>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="6" column="0" colspan="2">
+ <widget class="QCheckBox" name="timeoutCheckBox">
+ <property name="toolTip">
+ <string>Stop JackTrip if no network traffic has been received for 10 seconds.</string>
+ </property>
+ <property name="text">
+ <string>&amp;Disconnect after 10 seconds of no network activity</string>
+ </property>
+ </widget>
+ </item>
+ <item row="8" column="0" colspan="2">
+ <widget class="QGroupBox" name="authGroupBox">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="title">
+ <string/>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_6">
+ <item row="4" column="1">
+ <widget class="QLineEdit" name="passwordEdit">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="toolTip">
+ <string>Enter your password. (This will not be shown or saved.)</string>
+ </property>
+ <property name="echoMode">
+ <enum>QLineEdit::Password</enum>
+ </property>
+ <property name="cursorPosition">
+ <number>0</number>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="0" colspan="2">
+ <widget class="QCheckBox" name="authCheckBox">
+ <property name="toolTip">
+ <string>Supply a username and password to connect to the server.</string>
+ </property>
+ <property name="text">
+ <string>&amp;Use Authentication</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1">
+ <widget class="QLineEdit" name="usernameEdit">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="toolTip">
+ <string>Enter your username for the server.</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0">
+ <widget class="QLabel" name="passwordLabel">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>&amp;Password</string>
+ </property>
+ <property name="buddy">
+ <cstring>passwordEdit</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0">
+ <widget class="QLabel" name="usernameLabel">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>&amp;Username</string>
+ </property>
+ <property name="buddy">
+ <cstring>usernameEdit</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" colspan="2">
+ <widget class="QLabel" name="authNotVSLabel">
+ <property name="text">
+ <string>(This is for JackTrip's inbuilt authentication system, not for the Virtual Studio. To connect to a Virtual Studio server, press the &quot;Virtual Studio Mode&quot; button below.)</string>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="9" column="0">
+ <spacer name="basicVerticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Expanding</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
<item row="7" column="0" colspan="2">
<widget class="QGroupBox" name="requireAuthGroupBox">
<property name="title">
@@ -311,7 +585,7 @@ To connect to a hub server you need to run as a hub client.</string>
<item>
<widget class="QPushButton" name="vsModeButton">
<property name="text">
- <string>Virtual Studio Mode</string>
+ <string>&amp;Virtual Studio Mode</string>
</property>
</widget>
</item>
@@ -324,102 +598,6 @@ To connect to a hub server you need to run as a hub client.</string>
</item>
</layout>
</item>
- <item row="9" column="0">
- <spacer name="basicVerticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::Expanding</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="2" column="0" colspan="2">
- <widget class="QGroupBox" name="channelGroupBox">
- <layout class="QGridLayout" name="gridLayout_9">
- <item row="3" column="0">
- <widget class="QLabel" name="channelRecvLabel">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>&amp;Received from network:</string>
- </property>
- <property name="buddy">
- <cstring>channelRecvSpinBox</cstring>
- </property>
- </widget>
- </item>
- <item row="3" column="1">
- <widget class="QSpinBox" name="channelRecvSpinBox">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="toolTip">
- <string>Number of audio channels toaccept from the network.</string>
- </property>
- <property name="minimum">
- <number>1</number>
- </property>
- <property name="value">
- <number>2</number>
- </property>
- </widget>
- </item>
- <item row="4" column="1">
- <widget class="QSpinBox" name="channelSendSpinBox">
- <property name="toolTip">
- <string>Number of audio channels to send to the network.</string>
- </property>
- <property name="minimum">
- <number>1</number>
- </property>
- <property name="value">
- <number>2</number>
- </property>
- </widget>
- </item>
- <item row="4" column="0">
- <widget class="QLabel" name="channelSendLabel">
- <property name="text">
- <string>&amp;Sent to network:</string>
- </property>
- <property name="buddy">
- <cstring>channelSendSpinBox</cstring>
- </property>
- </widget>
- </item>
- <item row="2" column="0" colspan="2">
- <widget class="QLabel" name="channelLabel">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>&amp;Number of channels</string>
- </property>
- <property name="buddy">
- <cstring>channelRecvSpinBox</cstring>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
<item row="5" column="0" colspan="2">
<widget class="QCheckBox" name="zeroCheckBox">
<property name="toolTip">
@@ -430,100 +608,6 @@ To connect to a hub server you need to run as a hub client.</string>
</property>
</widget>
</item>
- <item row="6" column="0" colspan="2">
- <widget class="QCheckBox" name="timeoutCheckBox">
- <property name="toolTip">
- <string>Stop JackTrip if no network traffic has been received for 10 seconds.</string>
- </property>
- <property name="text">
- <string>&amp;Disconnect after 10 seconds of no network activity</string>
- </property>
- </widget>
- </item>
- <item row="3" column="0" colspan="2">
- <widget class="QGroupBox" name="autoPatchGroupBox">
- <property name="title">
- <string/>
- </property>
- <layout class="QGridLayout" name="gridLayout_10">
- <item row="2" column="0" colspan="2">
- <widget class="QCheckBox" name="upmixCheckBox">
- <property name="toolTip">
- <string>For clients that only send one channel of audio, relay their signal in stereo.</string>
- </property>
- <property name="text">
- <string>&amp;Upmix mono clients to stereo</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QComboBox" name="autoPatchComboBox">
- <property name="toolTip">
- <string>Select how you want audio to be routed by the hub server.</string>
- </property>
- <property name="currentIndex">
- <number>0</number>
- </property>
- <item>
- <property name="text">
- <string>Server to clients</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Client loopback</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Client fan out/in but no loopback</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Full Mix</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>No auto patching</string>
- </property>
- </item>
- </widget>
- </item>
- <item row="0" column="0">
- <widget class="QLabel" name="autoPatchLabel">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Hub auto&amp;patch mode</string>
- </property>
- <property name="buddy">
- <cstring>autoPatchComboBox</cstring>
- </property>
- </widget>
- </item>
- <item row="1" column="0" colspan="2">
- <widget class="QCheckBox" name="patchServerCheckBox">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="toolTip">
- <string>Include the server in the audio patching. This allows an ensemble member to
-play from this machine. (Available in client fan out/in and full mix modes.)</string>
- </property>
- <property name="text">
- <string>&amp;Include server in patching</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
</layout>
</widget>
<widget class="QWidget" name="advancedTab">
@@ -534,6 +618,48 @@ play from this machine. (Available in client fan out/in and full mix modes.)</st
<string>Advanced options</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_4">
+ <item row="5" column="0">
+ <widget class="QLabel" name="queueLengthLabel">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>&amp;Queue Buffer Length</string>
+ </property>
+ <property name="buddy">
+ <cstring>queueLengthSpinBox</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1" colspan="2">
+ <widget class="QLineEdit" name="clientNameEdit">
+ <property name="toolTip">
+ <string>Set the name of the Jack client.</string>
+ </property>
+ <property name="maxLength">
+ <number>64</number>
+ </property>
+ <property name="placeholderText">
+ <string>JackTrip</string>
+ </property>
+ </widget>
+ </item>
+ <item row="13" column="0">
+ <spacer name="advancedVerticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
<item row="7" column="0">
<widget class="QLabel" name="resolutionLabel">
<property name="sizePolicy">
@@ -550,6 +676,16 @@ play from this machine. (Available in client fan out/in and full mix modes.)</st
</property>
</widget>
</item>
+ <item row="1" column="1" colspan="2">
+ <widget class="QLineEdit" name="remoteNameEdit">
+ <property name="toolTip">
+ <string>Set the name of the Jack client as it will appear on the hub server.</string>
+ </property>
+ <property name="maxLength">
+ <number>64</number>
+ </property>
+ </widget>
+ </item>
<item row="7" column="1" colspan="2">
<widget class="QComboBox" name="resolutionComboBox">
<property name="toolTip">
@@ -580,69 +716,40 @@ play from this machine. (Available in client fan out/in and full mix modes.)</st
</item>
</widget>
</item>
- <item row="1" column="1" colspan="2">
- <widget class="QLineEdit" name="remoteNameEdit">
- <property name="toolTip">
- <string>Set the name of the Jack client as it will appear on the hub server.</string>
- </property>
- <property name="maxLength">
- <number>64</number>
- </property>
- </widget>
- </item>
- <item row="11" column="0">
- <widget class="QCheckBox" name="ioStatsCheckBox">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Maximum" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
+ <item row="9" column="0" colspan="3">
+ <widget class="QCheckBox" name="realTimeCheckBox">
<property name="toolTip">
- <string>Display IO stats in another window.</string>
- </property>
- <property name="text">
- <string>Display &amp;IO Stats</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="remoteNameLabel">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
+ <string>Use real time priority for the networking threads.</string>
</property>
<property name="text">
- <string>Remote Client &amp;Name</string>
+ <string>Enable real&amp;time priority for networking threads</string>
</property>
- <property name="buddy">
- <cstring>remoteNameEdit</cstring>
+ <property name="checked">
+ <bool>true</bool>
</property>
</widget>
</item>
- <item row="3" column="0">
- <widget class="QLabel" name="remotePortLabel">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
+ <item row="11" column="1">
+ <widget class="QSpinBox" name="ioStatsSpinBox">
+ <property name="enabled">
+ <bool>false</bool>
</property>
- <property name="text">
- <string>Remote &amp;Port</string>
+ <property name="toolTip">
+ <string>Choose how often stats should be reported.</string>
</property>
- <property name="buddy">
- <cstring>remotePortSpinBox</cstring>
+ <property name="minimum">
+ <number>1</number>
+ </property>
+ <property name="maximum">
+ <number>120</number>
</property>
</widget>
</item>
- <item row="2" column="1" colspan="2">
- <widget class="QSpinBox" name="localPortSpinBox">
+ <item row="4" column="1" colspan="2">
+ <widget class="QSpinBox" name="basePortSpinBox">
<property name="toolTip">
- <string>Set the local port to use for the connection. The default is 4464.
-(Useful for running multiple hub clients behind the same router.)</string>
+ <string>Set the base UDP port to be used by connecting hub clients. The default is 61002.
+(You should manually set this if running multiple hub servers on the same machine.)</string>
</property>
<property name="minimum">
<number>1024</number>
@@ -651,86 +758,46 @@ play from this machine. (Available in client fan out/in and full mix modes.)</st
<number>65535</number>
</property>
<property name="value">
- <number>4464</number>
+ <number>61002</number>
</property>
</widget>
</item>
- <item row="13" column="0" colspan="3">
- <widget class="QGroupBox" name="authGroupBox">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="title">
- <string/>
- </property>
- <layout class="QGridLayout" name="gridLayout_6">
- <item row="0" column="0" colspan="2">
- <widget class="QCheckBox" name="authCheckBox">
- <property name="toolTip">
- <string>Supply a username and password to connect to the server.</string>
- </property>
- <property name="text">
- <string>&amp;Use Authentication</string>
- </property>
- </widget>
- </item>
- <item row="3" column="1">
- <widget class="QLineEdit" name="passwordEdit">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="toolTip">
- <string>Enter your password. (This will not be shown or saved.)</string>
- </property>
- <property name="echoMode">
- <enum>QLineEdit::Password</enum>
- </property>
- <property name="cursorPosition">
- <number>0</number>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QLineEdit" name="usernameEdit">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="toolTip">
- <string>Enter your username for the server.</string>
- </property>
- </widget>
- </item>
- <item row="3" column="0">
- <widget class="QLabel" name="passwordLabel">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>&amp;Password</string>
- </property>
- <property name="buddy">
- <cstring>passwordEdit</cstring>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QLabel" name="usernameLabel">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>&amp;Username</string>
- </property>
- <property name="buddy">
- <cstring>usernameEdit</cstring>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
+ <item row="14" column="0" colspan="3">
+ <layout class="QHBoxLayout" name="useDefaultsLayout">
+ <item>
+ <spacer name="useDefaultsSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="commandLineButton">
+ <property name="toolTip">
+ <string>Show the equivalent command line for the current settings.</string>
+ </property>
+ <property name="text">
+ <string>Get Command &amp;Line</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="useDefaultsButton">
+ <property name="text">
+ <string>Use &amp;Defaults</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
</item>
- <item row="2" column="0">
- <widget class="QLabel" name="localPortLabel">
+ <item row="1" column="0">
+ <widget class="QLabel" name="remoteNameLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
@@ -738,44 +805,31 @@ play from this machine. (Available in client fan out/in and full mix modes.)</st
</sizepolicy>
</property>
<property name="text">
- <string>&amp;Local Port</string>
+ <string>Remote Client &amp;Name</string>
</property>
<property name="buddy">
- <cstring>localPortSpinBox</cstring>
+ <cstring>remoteNameEdit</cstring>
</property>
</widget>
</item>
- <item row="5" column="0">
- <widget class="QLabel" name="queueLengthLabel">
+ <item row="11" column="0">
+ <widget class="QCheckBox" name="ioStatsCheckBox">
<property name="sizePolicy">
- <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
+ <sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
- <property name="text">
- <string>&amp;Queue Buffer Length</string>
+ <property name="toolTip">
+ <string>Display IO stats in another window.</string>
</property>
- <property name="buddy">
- <cstring>queueLengthSpinBox</cstring>
+ <property name="text">
+ <string>Display &amp;IO Stats</string>
</property>
</widget>
</item>
- <item row="14" column="0">
- <spacer name="advancedVerticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="4" column="0">
- <widget class="QLabel" name="basePortLabel">
+ <item row="3" column="0">
+ <widget class="QLabel" name="remotePortLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
@@ -783,10 +837,10 @@ play from this machine. (Available in client fan out/in and full mix modes.)</st
</sizepolicy>
</property>
<property name="text">
- <string>&amp;UDP Base Port</string>
+ <string>Remote &amp;Port</string>
</property>
<property name="buddy">
- <cstring>basePortSpinBox</cstring>
+ <cstring>remotePortSpinBox</cstring>
</property>
</widget>
</item>
@@ -806,11 +860,8 @@ play from this machine. (Available in client fan out/in and full mix modes.)</st
</property>
</widget>
</item>
- <item row="11" column="2">
- <widget class="QLabel" name="ioStatsLabel">
- <property name="enabled">
- <bool>false</bool>
- </property>
+ <item row="6" column="0">
+ <widget class="QLabel" name="redundancyLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
@@ -818,44 +869,61 @@ play from this machine. (Available in client fan out/in and full mix modes.)</st
</sizepolicy>
</property>
<property name="text">
- <string>Reporting &amp;Interval (s)</string>
+ <string>&amp;Redundancy</string>
</property>
<property name="buddy">
- <cstring>ioStatsSpinBox</cstring>
+ <cstring>redundancySpinBox</cstring>
</property>
</widget>
</item>
- <item row="5" column="1" colspan="2">
- <widget class="QSpinBox" name="queueLengthSpinBox">
+ <item row="8" column="0" colspan="3">
+ <widget class="QCheckBox" name="connectAudioCheckBox">
<property name="toolTip">
- <string>Set the queue buffer length, in packet size.</string>
+ <string>Connect the Jack client to the default system audio ports.</string>
+ </property>
+ <property name="text">
+ <string>&amp;Connect default audio ports</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1" colspan="2">
+ <widget class="QSpinBox" name="localPortSpinBox">
+ <property name="toolTip">
+ <string>Set the local port to use for the connection. The default is 4464.
+(Useful for running multiple hub clients behind the same router.)</string>
</property>
<property name="minimum">
- <number>2</number>
+ <number>1024</number>
</property>
<property name="maximum">
- <number>999</number>
+ <number>65535</number>
</property>
<property name="value">
- <number>4</number>
+ <number>4464</number>
</property>
</widget>
</item>
- <item row="6" column="1" colspan="2">
- <widget class="QSpinBox" name="redundancySpinBox">
+ <item row="3" column="1" colspan="2">
+ <widget class="QSpinBox" name="remotePortSpinBox">
<property name="toolTip">
- <string>Number of redundant packets to be sent to avoid glitches related to packet loss.</string>
+ <string>Set the remote port to use for the connection. The default is 4464.</string>
</property>
<property name="minimum">
- <number>1</number>
+ <number>1024</number>
+ </property>
+ <property name="maximum">
+ <number>65535</number>
</property>
<property name="value">
- <number>1</number>
+ <number>4464</number>
</property>
</widget>
</item>
- <item row="6" column="0">
- <widget class="QLabel" name="redundancyLabel">
+ <item row="4" column="0">
+ <widget class="QLabel" name="basePortLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
@@ -863,92 +931,98 @@ play from this machine. (Available in client fan out/in and full mix modes.)</st
</sizepolicy>
</property>
<property name="text">
- <string>&amp;Redundancy</string>
+ <string>&amp;UDP Base Port</string>
</property>
<property name="buddy">
- <cstring>redundancySpinBox</cstring>
+ <cstring>basePortSpinBox</cstring>
</property>
</widget>
</item>
- <item row="11" column="1">
- <widget class="QSpinBox" name="ioStatsSpinBox">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="toolTip">
- <string>Choose how often stats should be reported.</string>
+ <item row="2" column="0">
+ <widget class="QLabel" name="localPortLabel">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
</property>
- <property name="minimum">
- <number>1</number>
+ <property name="text">
+ <string>&amp;Local Port</string>
</property>
- <property name="maximum">
- <number>120</number>
+ <property name="buddy">
+ <cstring>localPortSpinBox</cstring>
</property>
</widget>
</item>
- <item row="3" column="1" colspan="2">
- <widget class="QSpinBox" name="remotePortSpinBox">
+ <item row="6" column="1" colspan="2">
+ <widget class="QSpinBox" name="redundancySpinBox">
<property name="toolTip">
- <string>Set the remote port to use for the connection. The default is 4464.</string>
+ <string>Number of redundant packets to be sent to avoid glitches related to packet loss.</string>
</property>
<property name="minimum">
- <number>1024</number>
- </property>
- <property name="maximum">
- <number>65535</number>
+ <number>1</number>
</property>
<property name="value">
- <number>4464</number>
+ <number>1</number>
</property>
</widget>
</item>
- <item row="8" column="0" colspan="3">
- <widget class="QCheckBox" name="connectAudioCheckBox">
- <property name="toolTip">
- <string>Connect the Jack client to the default system audio ports.</string>
+ <item row="11" column="2">
+ <widget class="QLabel" name="ioStatsLabel">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
</property>
<property name="text">
- <string>&amp;Connect default audio ports</string>
+ <string>Reporting &amp;Interval (s)</string>
</property>
- <property name="checked">
- <bool>true</bool>
+ <property name="buddy">
+ <cstring>ioStatsSpinBox</cstring>
</property>
</widget>
</item>
- <item row="0" column="1" colspan="2">
- <widget class="QLineEdit" name="clientNameEdit">
+ <item row="5" column="1" colspan="2">
+ <widget class="QSpinBox" name="queueLengthSpinBox">
<property name="toolTip">
- <string>Set the name of the Jack client.</string>
+ <string>Set the queue buffer length, in packet size.</string>
</property>
- <property name="maxLength">
- <number>64</number>
+ <property name="minimum">
+ <number>2</number>
</property>
- <property name="placeholderText">
- <string>JackTrip</string>
+ <property name="maximum">
+ <number>999</number>
+ </property>
+ <property name="value">
+ <number>4</number>
</property>
</widget>
</item>
- <item row="4" column="1" colspan="2">
- <widget class="QSpinBox" name="basePortSpinBox">
+ <item row="12" column="0" colspan="3">
+ <widget class="QCheckBox" name="verboseCheckBox">
<property name="toolTip">
- <string>Set the base UDP port to be used by connecting hub clients. The default is 61002.
-(You should manually set this if running multiple hub servers on the same machine.)</string>
- </property>
- <property name="minimum">
- <number>1024</number>
- </property>
- <property name="maximum">
- <number>65535</number>
+ <string>Display debugging information that would normally appear on the console.</string>
</property>
- <property name="value">
- <number>61002</number>
+ <property name="text">
+ <string>Show &amp;Debug Information</string>
</property>
</widget>
</item>
- <item row="15" column="0" colspan="3">
- <layout class="QHBoxLayout" name="useDefaultsLayout">
+ </layout>
+ </widget>
+ <widget class="QWidget" name="backendTab">
+ <attribute name="title">
+ <string>Audio Backend</string>
+ </attribute>
+ <layout class="QGridLayout" name="gridLayout_11">
+ <item row="9" column="0" colspan="2">
+ <layout class="QHBoxLayout" name="deviceManagementLayout">
<item>
- <spacer name="useDefaultsSpacer">
+ <spacer name="backendTabSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@@ -961,54 +1035,34 @@ play from this machine. (Available in client fan out/in and full mix modes.)</st
</spacer>
</item>
<item>
- <widget class="QPushButton" name="commandLineButton">
- <property name="toolTip">
- <string>Show the equivalent command line for the current settings.</string>
- </property>
- <property name="text">
- <string>Get Command &amp;Line</string>
+ <widget class="QPushButton" name="refreshDevicesButton">
+ <property name="enabled">
+ <bool>false</bool>
</property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="useDefaultsButton">
<property name="text">
- <string>Use &amp;Defaults</string>
+ <string>&amp;Refresh Device List</string>
</property>
</widget>
</item>
</layout>
</item>
- <item row="9" column="0" colspan="3">
- <widget class="QCheckBox" name="realTimeCheckBox">
- <property name="toolTip">
- <string>Use real time priority for the networking threads.</string>
- </property>
- <property name="text">
- <string>Enable real&amp;time priority for networking threads</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item row="12" column="0" colspan="3">
- <widget class="QCheckBox" name="verboseCheckBox">
+ <item row="0" column="1">
+ <widget class="QComboBox" name="backendComboBox">
<property name="toolTip">
- <string>Display debugging information that would normally appear on the console.</string>
- </property>
- <property name="text">
- <string>Show &amp;Debug Information</string>
+ <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Choose the audio backend to use. JACK is the default and is well tested, but requires the JACK audio server to be installed.&lt;/p&gt;&lt;p&gt;RtAudio is still a work in progress, but it works with your operating system's native audio drivers and requires no additional software.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
+ <item>
+ <property name="text">
+ <string>JACK</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>RtAudio</string>
+ </property>
+ </item>
</widget>
</item>
- </layout>
- </widget>
- <widget class="QWidget" name="backendTab">
- <attribute name="title">
- <string>Audio Backend</string>
- </attribute>
- <layout class="QGridLayout" name="gridLayout_11">
<item row="3" column="1">
<widget class="QComboBox" name="inputDeviceComboBox">
<property name="enabled">
@@ -1016,8 +1070,24 @@ play from this machine. (Available in client fan out/in and full mix modes.)</st
</property>
</widget>
</item>
- <item row="0" column="0">
- <widget class="QLabel" name="backendLabel">
+ <item row="6" column="1">
+ <spacer name="backendSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>444</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="3" column="0">
+ <widget class="QLabel" name="inputDeviceLabel">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
@@ -1025,10 +1095,10 @@ play from this machine. (Available in client fan out/in and full mix modes.)</st
</sizepolicy>
</property>
<property name="text">
- <string>Audio &amp;Backend:</string>
+ <string>&amp;Input Device:</string>
</property>
<property name="buddy">
- <cstring>backendComboBox</cstring>
+ <cstring>inputDeviceComboBox</cstring>
</property>
</widget>
</item>
@@ -1080,6 +1150,41 @@ play from this machine. (Available in client fan out/in and full mix modes.)</st
</item>
</widget>
</item>
+ <item row="0" column="0">
+ <widget class="QLabel" name="backendLabel">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Audio &amp;Backend:</string>
+ </property>
+ <property name="buddy">
+ <cstring>backendComboBox</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="bufferSizeLabel">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>&amp;Buffer Size:</string>
+ </property>
+ <property name="buddy">
+ <cstring>bufferSizeComboBox</cstring>
+ </property>
+ </widget>
+ </item>
<item row="1" column="1">
<widget class="QComboBox" name="sampleRateComboBox">
<property name="enabled">
@@ -1131,8 +1236,8 @@ play from this machine. (Available in client fan out/in and full mix modes.)</st
</item>
</widget>
</item>
- <item row="3" column="0">
- <widget class="QLabel" name="inputDeviceLabel">
+ <item row="1" column="0">
+ <widget class="QLabel" name="sampleRateLabel">
<property name="enabled">
<bool>false</bool>
</property>
@@ -1143,50 +1248,13 @@ play from this machine. (Available in client fan out/in and full mix modes.)</st
</sizepolicy>
</property>
<property name="text">
- <string>&amp;Input Device:</string>
+ <string>&amp;Sampling Rate:</string>
</property>
<property name="buddy">
- <cstring>inputDeviceComboBox</cstring>
+ <cstring>sampleRateComboBox</cstring>
</property>
</widget>
</item>
- <item row="6" column="1">
- <spacer name="backendSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>444</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="9" column="0" colspan="2">
- <layout class="QHBoxLayout" name="deviceManagementLayout">
- <item>
- <spacer name="backendTabSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QPushButton" name="refreshDevicesButton">
- <property name="text">
- <string>&amp;Refresh Device List</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
<item row="4" column="0">
<widget class="QLabel" name="outputDeviceLabel">
<property name="enabled">
@@ -1206,61 +1274,6 @@ play from this machine. (Available in client fan out/in and full mix modes.)</st
</property>
</widget>
</item>
- <item row="2" column="0">
- <widget class="QLabel" name="bufferSizeLabel">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="sizePolicy">
- <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>&amp;Buffer Size:</string>
- </property>
- <property name="buddy">
- <cstring>bufferSizeComboBox</cstring>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QComboBox" name="backendComboBox">
- <property name="toolTip">
- <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Choose the audio backend to use. JACK is the default and is well tested, but requires the JACK audio server to be installed.&lt;/p&gt;&lt;p&gt;RtAudio is still a work in progress, but it works with your operating system's native audio drivers and requires no additional software.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
- </property>
- <item>
- <property name="text">
- <string>JACK</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>RtAudio</string>
- </property>
- </item>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="sampleRateLabel">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="sizePolicy">
- <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>&amp;Sampling Rate:</string>
- </property>
- <property name="buddy">
- <cstring>sampleRateComboBox</cstring>
- </property>
- </widget>
- </item>
<item row="4" column="1">
<widget class="QComboBox" name="outputDeviceComboBox">
<property name="enabled">
@@ -1271,7 +1284,7 @@ play from this machine. (Available in client fan out/in and full mix modes.)</st
<item row="5" column="0" colspan="2">
<widget class="QLabel" name="backendWarningLabel">
<property name="text">
- <string>These settings are ignored in Hub Server mode which requires JACK to operate.</string>
+ <string>These settings are ignored in hub server mode which requires JACK to operate.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
@@ -1827,6 +1840,9 @@ and wetness is the essence of beauty.</string>
<tabstop>keyBrowse</tabstop>
<tabstop>credsEdit</tabstop>
<tabstop>credsBrowse</tabstop>
+ <tabstop>authCheckBox</tabstop>
+ <tabstop>usernameEdit</tabstop>
+ <tabstop>passwordEdit</tabstop>
<tabstop>vsModeButton</tabstop>
<tabstop>aboutButton</tabstop>
<tabstop>clientNameEdit</tabstop>
@@ -1842,9 +1858,6 @@ and wetness is the essence of beauty.</string>
<tabstop>ioStatsCheckBox</tabstop>
<tabstop>ioStatsSpinBox</tabstop>
<tabstop>verboseCheckBox</tabstop>
- <tabstop>authCheckBox</tabstop>
- <tabstop>usernameEdit</tabstop>
- <tabstop>passwordEdit</tabstop>
<tabstop>commandLineButton</tabstop>
<tabstop>useDefaultsButton</tabstop>
<tabstop>backendComboBox</tabstop>
diff --git a/src/gui/qjacktrip_novs.ui b/src/gui/qjacktrip_novs.ui
deleted file mode 100644
index 7aaced2..0000000
--- a/src/gui/qjacktrip_novs.ui
+++ /dev/null
@@ -1,1880 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>QJackTrip</class>
- <widget class="QMainWindow" name="QJackTrip">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>409</width>
- <height>889</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>JackTrip</string>
- </property>
- <property name="windowIcon">
- <iconset resource="qjacktrip.qrc">
- <normaloff>:/qjacktrip/icon.png</normaloff>:/qjacktrip/icon.png</iconset>
- </property>
- <widget class="QWidget" name="centralWidget">
- <layout class="QGridLayout" name="gridLayout">
- <item row="0" column="1">
- <widget class="QComboBox" name="typeComboBox">
- <property name="toolTip">
- <string>To connect to a p2p (peer to peer) server you need to run as a p2p client.
-To connect to a hub server you need to run as a hub client.</string>
- </property>
- <property name="currentIndex">
- <number>2</number>
- </property>
- <item>
- <property name="text">
- <string>P2P Client</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>P2P Server</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Hub Client</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Hub Server</string>
- </property>
- </item>
- </widget>
- </item>
- <item row="6" column="0" colspan="2">
- <layout class="QHBoxLayout" name="buttonLayout">
- <item>
- <widget class="QPushButton" name="connectButton">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>Connect</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="disconnectButton">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>Disconnect</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="exitButton">
- <property name="text">
- <string>Exit</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="3" column="1">
- <widget class="QLabel" name="ipLabel">
- <property name="toolTip">
- <string>If running as a server, this is the address you should supply to the other clients.
-(You will need to enable any port forwarding on your router manually.)</string>
- </property>
- <property name="text">
- <string>Looking up external IP address...</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QComboBox" name="addressComboBox">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="toolTip">
- <string>Enter the IP address or the hostname of the server you want to connect to.</string>
- </property>
- <property name="editable">
- <bool>true</bool>
- </property>
- <property name="maxCount">
- <number>5</number>
- </property>
- <property name="insertPolicy">
- <enum>QComboBox::NoInsert</enum>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="addressLabel">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>&amp;Address of server</string>
- </property>
- <property name="buddy">
- <cstring>addressComboBox</cstring>
- </property>
- </widget>
- </item>
- <item row="0" column="0">
- <widget class="QLabel" name="typeLabel">
- <property name="text">
- <string>&amp;Run JackTrip as</string>
- </property>
- <property name="buddy">
- <cstring>typeComboBox</cstring>
- </property>
- </widget>
- </item>
- <item row="5" column="0" colspan="2">
- <widget class="QTabWidget" name="optionsTabWidget">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="minimumSize">
- <size>
- <width>391</width>
- <height>0</height>
- </size>
- </property>
- <property name="currentIndex">
- <number>0</number>
- </property>
- <property name="tabsClosable">
- <bool>false</bool>
- </property>
- <property name="movable">
- <bool>false</bool>
- </property>
- <widget class="QWidget" name="basicTab">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <attribute name="title">
- <string>Basic options</string>
- </attribute>
- <layout class="QGridLayout" name="gridLayout_3">
- <item row="3" column="0" colspan="2">
- <widget class="QGroupBox" name="autoPatchGroupBox">
- <property name="title">
- <string/>
- </property>
- <layout class="QGridLayout" name="gridLayout_10">
- <item row="0" column="0" rowspan="2" colspan="2">
- <widget class="QLabel" name="autoPatchLabel">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Hub auto&amp;patch mode</string>
- </property>
- <property name="buddy">
- <cstring>autoPatchComboBox</cstring>
- </property>
- </widget>
- </item>
- <item row="0" column="2">
- <widget class="QComboBox" name="autoPatchComboBox">
- <property name="toolTip">
- <string>Select how you want audio to be routed by the hub server.</string>
- </property>
- <property name="currentIndex">
- <number>0</number>
- </property>
- <item>
- <property name="text">
- <string>Server to clients</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Client loopback</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Client fan out/in but no loopback</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Full Mix</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>No auto patching</string>
- </property>
- </item>
- </widget>
- </item>
- <item row="3" column="0" colspan="3">
- <widget class="QCheckBox" name="upmixCheckBox">
- <property name="toolTip">
- <string>For clients that only send one channel of audio, relay their signal in stereo.</string>
- </property>
- <property name="text">
- <string>&amp;Upmix mono clients to stereo</string>
- </property>
- </widget>
- </item>
- <item row="2" column="0" colspan="3">
- <widget class="QCheckBox" name="patchServerCheckBox">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="toolTip">
- <string>Include the server in the audio patching. This allows an ensemble member to
-play from this machine. (Available in client fan out/in and full mix modes.)</string>
- </property>
- <property name="text">
- <string>&amp;Include server in patching</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item row="2" column="0" colspan="2">
- <widget class="QGroupBox" name="channelGroupBox">
- <layout class="QGridLayout" name="gridLayout_9">
- <item row="3" column="0">
- <widget class="QLabel" name="channelRecvLabel">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>&amp;Received from network:</string>
- </property>
- <property name="buddy">
- <cstring>channelRecvSpinBox</cstring>
- </property>
- </widget>
- </item>
- <item row="3" column="1">
- <widget class="QSpinBox" name="channelRecvSpinBox">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="toolTip">
- <string>Number of audio channels toaccept from the network.</string>
- </property>
- <property name="minimum">
- <number>1</number>
- </property>
- <property name="value">
- <number>2</number>
- </property>
- </widget>
- </item>
- <item row="4" column="1">
- <widget class="QSpinBox" name="channelSendSpinBox">
- <property name="toolTip">
- <string>Number of audio channels to send to the network.</string>
- </property>
- <property name="minimum">
- <number>1</number>
- </property>
- <property name="value">
- <number>2</number>
- </property>
- </widget>
- </item>
- <item row="4" column="0">
- <widget class="QLabel" name="channelSendLabel">
- <property name="text">
- <string>&amp;Sent to network:</string>
- </property>
- <property name="buddy">
- <cstring>channelSendSpinBox</cstring>
- </property>
- </widget>
- </item>
- <item row="2" column="0" colspan="2">
- <widget class="QLabel" name="channelLabel">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>&amp;Number of channels</string>
- </property>
- <property name="buddy">
- <cstring>channelRecvSpinBox</cstring>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item row="6" column="0" colspan="2">
- <widget class="QCheckBox" name="timeoutCheckBox">
- <property name="toolTip">
- <string>Stop JackTrip if no network traffic has been received for 10 seconds.</string>
- </property>
- <property name="text">
- <string>&amp;Disconnect after 10 seconds of no network activity</string>
- </property>
- </widget>
- </item>
- <item row="8" column="0" colspan="2">
- <widget class="QGroupBox" name="authGroupBox">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="title">
- <string/>
- </property>
- <layout class="QGridLayout" name="gridLayout_6">
- <item row="0" column="0" colspan="2">
- <widget class="QCheckBox" name="authCheckBox">
- <property name="toolTip">
- <string>Supply a username and password to connect to the server.</string>
- </property>
- <property name="text">
- <string>&amp;Use Authentication</string>
- </property>
- </widget>
- </item>
- <item row="3" column="1">
- <widget class="QLineEdit" name="passwordEdit">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="toolTip">
- <string>Enter your password. (This will not be shown or saved.)</string>
- </property>
- <property name="echoMode">
- <enum>QLineEdit::Password</enum>
- </property>
- <property name="cursorPosition">
- <number>0</number>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QLineEdit" name="usernameEdit">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="toolTip">
- <string>Enter your username for the server.</string>
- </property>
- </widget>
- </item>
- <item row="3" column="0">
- <widget class="QLabel" name="passwordLabel">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>&amp;Password</string>
- </property>
- <property name="buddy">
- <cstring>passwordEdit</cstring>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QLabel" name="usernameLabel">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>&amp;Username</string>
- </property>
- <property name="buddy">
- <cstring>usernameEdit</cstring>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item row="9" column="0">
- <spacer name="basicVerticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::Expanding</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="7" column="0" colspan="2">
- <widget class="QGroupBox" name="requireAuthGroupBox">
- <property name="title">
- <string/>
- </property>
- <layout class="QGridLayout" name="gridLayout_7">
- <item row="3" column="2">
- <widget class="QPushButton" name="keyBrowse">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>Browse</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0" colspan="3">
- <widget class="QLabel" name="authDisclaimerLabel">
- <property name="text">
- <string>(This is a work in progress and needs to be manually configured outside of the app. Only use if you know what you're doing.)</string>
- </property>
- <property name="wordWrap">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QLabel" name="certLabel">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>&amp;Certificate File</string>
- </property>
- <property name="buddy">
- <cstring>certEdit</cstring>
- </property>
- </widget>
- </item>
- <item row="3" column="0">
- <widget class="QLabel" name="keyLabel">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>&amp;Key File</string>
- </property>
- <property name="buddy">
- <cstring>keyEdit</cstring>
- </property>
- </widget>
- </item>
- <item row="3" column="1">
- <widget class="QLineEdit" name="keyEdit">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="toolTip">
- <string>Choose the private key that the server should use for the SSL connection.</string>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QLineEdit" name="certEdit">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="toolTip">
- <string>Choose the certificate file that the server should use to establish an initial SSL connection.</string>
- </property>
- </widget>
- </item>
- <item row="2" column="2">
- <widget class="QPushButton" name="certBrowse">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>Browse</string>
- </property>
- </widget>
- </item>
- <item row="0" column="0" colspan="2">
- <widget class="QCheckBox" name="requireAuthCheckBox">
- <property name="toolTip">
- <string>Require clients to connect with a username and password.</string>
- </property>
- <property name="text">
- <string>&amp;Require Authentication</string>
- </property>
- </widget>
- </item>
- <item row="4" column="0">
- <widget class="QLabel" name="credsLabel">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>&amp;Credentials File</string>
- </property>
- <property name="buddy">
- <cstring>credsEdit</cstring>
- </property>
- </widget>
- </item>
- <item row="4" column="1">
- <widget class="QLineEdit" name="credsEdit">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="toolTip">
- <string>Choose the file containing the list of usernames and passwords.</string>
- </property>
- </widget>
- </item>
- <item row="4" column="2">
- <widget class="QPushButton" name="credsBrowse">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>Browse</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item row="11" column="0" colspan="2">
- <layout class="QHBoxLayout" name="aboutLayout">
- <item>
- <spacer name="aboutSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QPushButton" name="vsModeButton">
- <property name="text">
- <string>&amp;Virtual Studio Mode</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="aboutButton">
- <property name="text">
- <string>About</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="5" column="0" colspan="2">
- <widget class="QCheckBox" name="zeroCheckBox">
- <property name="toolTip">
- <string>Silence the audio when there's a buffer underrun.</string>
- </property>
- <property name="text">
- <string>Set buffer to &amp;zero when underrun occurs</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="advancedTab">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <attribute name="title">
- <string>Advanced options</string>
- </attribute>
- <layout class="QGridLayout" name="gridLayout_4">
- <item row="5" column="0">
- <widget class="QLabel" name="queueLengthLabel">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>&amp;Queue Buffer Length</string>
- </property>
- <property name="buddy">
- <cstring>queueLengthSpinBox</cstring>
- </property>
- </widget>
- </item>
- <item row="0" column="1" colspan="2">
- <widget class="QLineEdit" name="clientNameEdit">
- <property name="toolTip">
- <string>Set the name of the Jack client.</string>
- </property>
- <property name="maxLength">
- <number>64</number>
- </property>
- <property name="placeholderText">
- <string>JackTrip</string>
- </property>
- </widget>
- </item>
- <item row="13" column="0">
- <spacer name="advancedVerticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="7" column="0">
- <widget class="QLabel" name="resolutionLabel">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Audio &amp;Bit Resolution</string>
- </property>
- <property name="buddy">
- <cstring>resolutionComboBox</cstring>
- </property>
- </widget>
- </item>
- <item row="1" column="1" colspan="2">
- <widget class="QLineEdit" name="remoteNameEdit">
- <property name="toolTip">
- <string>Set the name of the Jack client as it will appear on the hub server.</string>
- </property>
- <property name="maxLength">
- <number>64</number>
- </property>
- </widget>
- </item>
- <item row="7" column="1" colspan="2">
- <widget class="QComboBox" name="resolutionComboBox">
- <property name="toolTip">
- <string>Select the audio bit resolution.</string>
- </property>
- <property name="currentIndex">
- <number>1</number>
- </property>
- <item>
- <property name="text">
- <string>8</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>16</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>24</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>32</string>
- </property>
- </item>
- </widget>
- </item>
- <item row="9" column="0" colspan="3">
- <widget class="QCheckBox" name="realTimeCheckBox">
- <property name="toolTip">
- <string>Use real time priority for the networking threads.</string>
- </property>
- <property name="text">
- <string>Enable real&amp;time priority for networking threads</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item row="11" column="1">
- <widget class="QSpinBox" name="ioStatsSpinBox">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="toolTip">
- <string>Choose how often stats should be reported.</string>
- </property>
- <property name="minimum">
- <number>1</number>
- </property>
- <property name="maximum">
- <number>120</number>
- </property>
- </widget>
- </item>
- <item row="4" column="1" colspan="2">
- <widget class="QSpinBox" name="basePortSpinBox">
- <property name="toolTip">
- <string>Set the base UDP port to be used by connecting hub clients. The default is 61002.
-(You should manually set this if running multiple hub servers on the same machine.)</string>
- </property>
- <property name="minimum">
- <number>1024</number>
- </property>
- <property name="maximum">
- <number>65535</number>
- </property>
- <property name="value">
- <number>61002</number>
- </property>
- </widget>
- </item>
- <item row="14" column="0" colspan="3">
- <layout class="QHBoxLayout" name="useDefaultsLayout">
- <item>
- <spacer name="useDefaultsSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QPushButton" name="commandLineButton">
- <property name="toolTip">
- <string>Show the equivalent command line for the current settings.</string>
- </property>
- <property name="text">
- <string>Get Command &amp;Line</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="useDefaultsButton">
- <property name="text">
- <string>Use &amp;Defaults</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="remoteNameLabel">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Remote Client &amp;Name</string>
- </property>
- <property name="buddy">
- <cstring>remoteNameEdit</cstring>
- </property>
- </widget>
- </item>
- <item row="11" column="0">
- <widget class="QCheckBox" name="ioStatsCheckBox">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Maximum" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="toolTip">
- <string>Display IO stats in another window.</string>
- </property>
- <property name="text">
- <string>Display &amp;IO Stats</string>
- </property>
- </widget>
- </item>
- <item row="3" column="0">
- <widget class="QLabel" name="remotePortLabel">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Remote &amp;Port</string>
- </property>
- <property name="buddy">
- <cstring>remotePortSpinBox</cstring>
- </property>
- </widget>
- </item>
- <item row="0" column="0">
- <widget class="QLabel" name="clientNameLabel">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Custom Client &amp;Name</string>
- </property>
- <property name="buddy">
- <cstring>clientNameEdit</cstring>
- </property>
- </widget>
- </item>
- <item row="6" column="0">
- <widget class="QLabel" name="redundancyLabel">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>&amp;Redundancy</string>
- </property>
- <property name="buddy">
- <cstring>redundancySpinBox</cstring>
- </property>
- </widget>
- </item>
- <item row="8" column="0" colspan="3">
- <widget class="QCheckBox" name="connectAudioCheckBox">
- <property name="toolTip">
- <string>Connect the Jack client to the default system audio ports.</string>
- </property>
- <property name="text">
- <string>&amp;Connect default audio ports</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item row="2" column="1" colspan="2">
- <widget class="QSpinBox" name="localPortSpinBox">
- <property name="toolTip">
- <string>Set the local port to use for the connection. The default is 4464.
-(Useful for running multiple hub clients behind the same router.)</string>
- </property>
- <property name="minimum">
- <number>1024</number>
- </property>
- <property name="maximum">
- <number>65535</number>
- </property>
- <property name="value">
- <number>4464</number>
- </property>
- </widget>
- </item>
- <item row="3" column="1" colspan="2">
- <widget class="QSpinBox" name="remotePortSpinBox">
- <property name="toolTip">
- <string>Set the remote port to use for the connection. The default is 4464.</string>
- </property>
- <property name="minimum">
- <number>1024</number>
- </property>
- <property name="maximum">
- <number>65535</number>
- </property>
- <property name="value">
- <number>4464</number>
- </property>
- </widget>
- </item>
- <item row="4" column="0">
- <widget class="QLabel" name="basePortLabel">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>&amp;UDP Base Port</string>
- </property>
- <property name="buddy">
- <cstring>basePortSpinBox</cstring>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QLabel" name="localPortLabel">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>&amp;Local Port</string>
- </property>
- <property name="buddy">
- <cstring>localPortSpinBox</cstring>
- </property>
- </widget>
- </item>
- <item row="6" column="1" colspan="2">
- <widget class="QSpinBox" name="redundancySpinBox">
- <property name="toolTip">
- <string>Number of redundant packets to be sent to avoid glitches related to packet loss.</string>
- </property>
- <property name="minimum">
- <number>1</number>
- </property>
- <property name="value">
- <number>1</number>
- </property>
- </widget>
- </item>
- <item row="11" column="2">
- <widget class="QLabel" name="ioStatsLabel">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="sizePolicy">
- <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Reporting &amp;Interval (s)</string>
- </property>
- <property name="buddy">
- <cstring>ioStatsSpinBox</cstring>
- </property>
- </widget>
- </item>
- <item row="5" column="1" colspan="2">
- <widget class="QSpinBox" name="queueLengthSpinBox">
- <property name="toolTip">
- <string>Set the queue buffer length, in packet size.</string>
- </property>
- <property name="minimum">
- <number>2</number>
- </property>
- <property name="maximum">
- <number>999</number>
- </property>
- <property name="value">
- <number>4</number>
- </property>
- </widget>
- </item>
- <item row="12" column="0" colspan="3">
- <widget class="QCheckBox" name="verboseCheckBox">
- <property name="toolTip">
- <string>Display debugging information that would normally appear on the console.</string>
- </property>
- <property name="text">
- <string>Show &amp;Debug Information</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="backendTab">
- <attribute name="title">
- <string>Audio Backend</string>
- </attribute>
- <layout class="QGridLayout" name="gridLayout_11">
- <item row="9" column="0" colspan="2">
- <layout class="QHBoxLayout" name="deviceManagementLayout">
- <item>
- <spacer name="backendTabSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QPushButton" name="refreshDevicesButton">
- <property name="text">
- <string>&amp;Refresh Device List</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="0" column="1">
- <widget class="QComboBox" name="backendComboBox">
- <property name="toolTip">
- <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Choose the audio backend to use. JACK is the default and is well tested, but requires the JACK audio server to be installed.&lt;/p&gt;&lt;p&gt;RtAudio is still a work in progress, but it works with your operating system's native audio drivers and requires no additional software.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
- </property>
- <item>
- <property name="text">
- <string>JACK</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>RtAudio</string>
- </property>
- </item>
- </widget>
- </item>
- <item row="3" column="1">
- <widget class="QComboBox" name="inputDeviceComboBox">
- <property name="enabled">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item row="6" column="1">
- <spacer name="backendSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>444</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="3" column="0">
- <widget class="QLabel" name="inputDeviceLabel">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="sizePolicy">
- <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>&amp;Input Device:</string>
- </property>
- <property name="buddy">
- <cstring>inputDeviceComboBox</cstring>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QComboBox" name="bufferSizeComboBox">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="toolTip">
- <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Set the driver's buffer size to use with the RtAudio backend.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
- </property>
- <property name="currentIndex">
- <number>3</number>
- </property>
- <item>
- <property name="text">
- <string>16</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>32</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>64</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>128</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>256</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>512</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>1024</string>
- </property>
- </item>
- </widget>
- </item>
- <item row="0" column="0">
- <widget class="QLabel" name="backendLabel">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Audio &amp;Backend:</string>
- </property>
- <property name="buddy">
- <cstring>backendComboBox</cstring>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QLabel" name="bufferSizeLabel">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="sizePolicy">
- <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>&amp;Buffer Size:</string>
- </property>
- <property name="buddy">
- <cstring>bufferSizeComboBox</cstring>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QComboBox" name="sampleRateComboBox">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="toolTip">
- <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Set the audio sample rate to use with the RtAudio backend. This setting should be the same on both ends of the connection.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
- </property>
- <property name="currentText">
- <string>48000</string>
- </property>
- <property name="currentIndex">
- <number>3</number>
- </property>
- <item>
- <property name="text">
- <string>22050</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>32000</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>44100</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>48000</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>88200</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>96000</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>192000</string>
- </property>
- </item>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="sampleRateLabel">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="sizePolicy">
- <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>&amp;Sampling Rate:</string>
- </property>
- <property name="buddy">
- <cstring>sampleRateComboBox</cstring>
- </property>
- </widget>
- </item>
- <item row="4" column="0">
- <widget class="QLabel" name="outputDeviceLabel">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="sizePolicy">
- <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>&amp;Output Device:</string>
- </property>
- <property name="buddy">
- <cstring>outputDeviceComboBox</cstring>
- </property>
- </widget>
- </item>
- <item row="4" column="1">
- <widget class="QComboBox" name="outputDeviceComboBox">
- <property name="enabled">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item row="5" column="0" colspan="2">
- <widget class="QLabel" name="backendWarningLabel">
- <property name="text">
- <string>These settings are ignored in hub server mode which requires JACK to operate.</string>
- </property>
- <property name="wordWrap">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="JitterTab">
- <attribute name="title">
- <string>Jitter Buffer</string>
- </attribute>
- <layout class="QGridLayout" name="gridLayout_8">
- <item row="10" column="2">
- <widget class="QLabel" name="packetsLabel">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Packets</string>
- </property>
- </widget>
- </item>
- <item row="8" column="0" colspan="3">
- <widget class="QCheckBox" name="autoQueueCheckBox">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Automatically set the &amp;queue length</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item row="9" column="0" colspan="2">
- <widget class="QLabel" name="autoQueueLabel">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="sizePolicy">
- <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Aim to &amp;drop no more than one in every</string>
- </property>
- <property name="buddy">
- <cstring>autoQueueSpinBox</cstring>
- </property>
- </widget>
- </item>
- <item row="5" column="0" colspan="3">
- <widget class="Line" name="bufferLine">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- </widget>
- </item>
- <item row="9" column="2">
- <widget class="QSpinBox" name="autoQueueSpinBox">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="sizePolicy">
- <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="maximum">
- <number>1000000</number>
- </property>
- <property name="singleStep">
- <number>100</number>
- </property>
- <property name="value">
- <number>500</number>
- </property>
- </widget>
- </item>
- <item row="3" column="0" colspan="3">
- <widget class="QCheckBox" name="broadcastCheckBox">
- <property name="toolTip">
- <string>Enable a second, broadcast output with a higher queue length
-for better quality at the expense of latency.</string>
- </property>
- <property name="text">
- <string>Enable &amp;Broadcast Output</string>
- </property>
- </widget>
- </item>
- <item row="12" column="0">
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="11" column="0" colspan="3">
- <widget class="QLabel" name="autoQueueExplanationLabel">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>This will override the queue buffer length entered in the advanced options tab. (The default value is 500.)</string>
- </property>
- <property name="wordWrap">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item row="0" column="0" colspan="2">
- <widget class="QCheckBox" name="jitterCheckBox">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="toolTip">
- <string>Enable the new jitter buffer. This is now the default.</string>
- </property>
- <property name="text">
- <string>Enable &amp;Jitter Buffer</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item row="2" column="1" colspan="2">
- <widget class="QComboBox" name="bufferStrategyComboBox">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="toolTip">
- <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Buffer strategy 1 attempts to drop as little audio data as possible without exceeding the maximum queue length. It operates very similarly to the original buffer implementation with a few fixes to drop even less audio.&lt;/p&gt;&lt;p&gt;Buffer strategy 2 is optimized to keep the latency stable, so that the delay experienced over the connection doesn't fluctuate and is as predictable as possible. The trade off is that more audio might be dropped, but the difference should be negligible with the right queue length.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
- </property>
- <property name="currentIndex">
- <number>0</number>
- </property>
- <item>
- <property name="text">
- <string>1</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>2</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>3 (experimental)</string>
- </property>
- </item>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QLabel" name="bufferStrategyLabel">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="sizePolicy">
- <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Use buffer &amp;strategy</string>
- </property>
- <property name="buddy">
- <cstring>bufferStrategyComboBox</cstring>
- </property>
- </widget>
- </item>
- <item row="4" column="0">
- <widget class="QLabel" name="broadcastQueueLabel">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>Broadcast &amp;Queue Length</string>
- </property>
- <property name="buddy">
- <cstring>broadcastQueueSpinBox</cstring>
- </property>
- </widget>
- </item>
- <item row="4" column="1" colspan="2">
- <widget class="QSpinBox" name="broadcastQueueSpinBox">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="toolTip">
- <string>Set the broadcast queue buffer length, in packet size.</string>
- </property>
- <property name="minimum">
- <number>2</number>
- </property>
- <property name="maximum">
- <number>999</number>
- </property>
- <property name="value">
- <number>8</number>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="pluginsTab">
- <attribute name="title">
- <string>Plugins</string>
- </attribute>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QGroupBox" name="incomingGroupBox">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="title">
- <string>Incoming</string>
- </property>
- <layout class="QGridLayout" name="gridLayout_5">
- <item row="1" column="1">
- <widget class="QSlider" name="inZitarevWetnessSlider">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="toolTip">
- <string>Set the wet/dry mix.</string>
- </property>
- <property name="maximum">
- <number>100</number>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="tickPosition">
- <enum>QSlider::TicksBelow</enum>
- </property>
- <property name="tickInterval">
- <number>20</number>
- </property>
- </widget>
- </item>
- <item row="0" column="2">
- <widget class="QLabel" name="inFreeverbLabel">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>Wetness</string>
- </property>
- </widget>
- </item>
- <item row="4" column="0">
- <widget class="QCheckBox" name="inLimiterCheckBox">
- <property name="toolTip">
- <string>Enable the limiter on incoming audio.</string>
- </property>
- <property name="text">
- <string>&amp;Limiter</string>
- </property>
- </widget>
- </item>
- <item row="0" column="0">
- <widget class="QCheckBox" name="inFreeverbCheckBox">
- <property name="toolTip">
- <string>Enable the freeverb plugin on incoming audio.</string>
- </property>
- <property name="text">
- <string>&amp;Freeverb</string>
- </property>
- </widget>
- </item>
- <item row="1" column="2" alignment="Qt::AlignHCenter">
- <widget class="QLabel" name="inZitarevLabel">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>Wetness</string>
- </property>
- </widget>
- </item>
- <item row="3" column="0">
- <widget class="QCheckBox" name="inCompressorCheckBox">
- <property name="toolTip">
- <string>Enable the compressor plugin on incoming audio.</string>
- </property>
- <property name="text">
- <string>&amp;Compressor</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QCheckBox" name="inZitarevCheckBox">
- <property name="toolTip">
- <string>Enable the zitarev reverb plugin on incoming audio.</string>
- </property>
- <property name="text">
- <string>&amp;Zitarev</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QSlider" name="inFreeverbWetnessSlider">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="toolTip">
- <string>Set the wet/dry mix.</string>
- </property>
- <property name="maximum">
- <number>100</number>
- </property>
- <property name="singleStep">
- <number>1</number>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="invertedAppearance">
- <bool>false</bool>
- </property>
- <property name="tickPosition">
- <enum>QSlider::TicksBelow</enum>
- </property>
- <property name="tickInterval">
- <number>20</number>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QGroupBox" name="outgoingGroupBox">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="title">
- <string>Outgoing</string>
- </property>
- <layout class="QGridLayout" name="gridLayout_2">
- <item row="0" column="0">
- <widget class="QCheckBox" name="outFreeverbCheckBox">
- <property name="toolTip">
- <string>Enable the freeverb plugin on outgoing audio.</string>
- </property>
- <property name="text">
- <string>Free&amp;verb</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QSlider" name="outFreeverbWetnessSlider">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="toolTip">
- <string>Set the wet/dry mix.</string>
- </property>
- <property name="maximum">
- <number>100</number>
- </property>
- <property name="singleStep">
- <number>1</number>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="invertedAppearance">
- <bool>false</bool>
- </property>
- <property name="tickPosition">
- <enum>QSlider::TicksBelow</enum>
- </property>
- <property name="tickInterval">
- <number>20</number>
- </property>
- </widget>
- </item>
- <item row="0" column="2">
- <widget class="QLabel" name="outFreeverbLabel">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>Wetness</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QCheckBox" name="outZitarevCheckBox">
- <property name="toolTip">
- <string>Enable the zitarev reverb plugin on outgoing audio.</string>
- </property>
- <property name="text">
- <string>Zi&amp;tarev</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QSlider" name="outZitarevWetnessSlider">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="toolTip">
- <string>Set the wet/dry mix.</string>
- </property>
- <property name="maximum">
- <number>100</number>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="tickPosition">
- <enum>QSlider::TicksBelow</enum>
- </property>
- <property name="tickInterval">
- <number>20</number>
- </property>
- </widget>
- </item>
- <item row="1" column="2">
- <widget class="QLabel" name="outZitarevLabel">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="toolTip">
- <string>Moisture is the essence of wetness,
-and wetness is the essence of beauty.</string>
- </property>
- <property name="text">
- <string>Wetness</string>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QCheckBox" name="outCompressorCheckBox">
- <property name="toolTip">
- <string>Enable the compressor plugin on outgoing audio.</string>
- </property>
- <property name="text">
- <string>Com&amp;pressor</string>
- </property>
- </widget>
- </item>
- <item row="3" column="0">
- <widget class="QCheckBox" name="outLimiterCheckBox">
- <property name="toolTip">
- <string>Enable the limiter on outgoing audio.</string>
- </property>
- <property name="text">
- <string>Li&amp;miter</string>
- </property>
- </widget>
- </item>
- <item row="3" column="1">
- <widget class="QSpinBox" name="outClientsSpinBox">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="toolTip">
- <string>Enter the anticipated number of clients that will be connected to the server.</string>
- </property>
- <property name="minimum">
- <number>1</number>
- </property>
- <property name="maximum">
- <number>100</number>
- </property>
- <property name="value">
- <number>2</number>
- </property>
- </widget>
- </item>
- <item row="3" column="2">
- <widget class="QLabel" name="outLimiterLabel">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>Clients</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <spacer name="pluginsVerticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- </widget>
- </item>
- </layout>
- </widget>
- <widget class="QMenuBar" name="menuBar">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>409</width>
- <height>30</height>
- </rect>
- </property>
- </widget>
- <widget class="QStatusBar" name="statusBar"/>
- </widget>
- <tabstops>
- <tabstop>typeComboBox</tabstop>
- <tabstop>addressComboBox</tabstop>
- <tabstop>connectButton</tabstop>
- <tabstop>disconnectButton</tabstop>
- <tabstop>exitButton</tabstop>
- <tabstop>optionsTabWidget</tabstop>
- <tabstop>channelRecvSpinBox</tabstop>
- <tabstop>channelSendSpinBox</tabstop>
- <tabstop>autoPatchComboBox</tabstop>
- <tabstop>patchServerCheckBox</tabstop>
- <tabstop>upmixCheckBox</tabstop>
- <tabstop>zeroCheckBox</tabstop>
- <tabstop>timeoutCheckBox</tabstop>
- <tabstop>requireAuthCheckBox</tabstop>
- <tabstop>certEdit</tabstop>
- <tabstop>certBrowse</tabstop>
- <tabstop>keyEdit</tabstop>
- <tabstop>keyBrowse</tabstop>
- <tabstop>credsEdit</tabstop>
- <tabstop>credsBrowse</tabstop>
- <tabstop>authCheckBox</tabstop>
- <tabstop>usernameEdit</tabstop>
- <tabstop>passwordEdit</tabstop>
- <tabstop>vsModeButton</tabstop>
- <tabstop>aboutButton</tabstop>
- <tabstop>clientNameEdit</tabstop>
- <tabstop>remoteNameEdit</tabstop>
- <tabstop>localPortSpinBox</tabstop>
- <tabstop>remotePortSpinBox</tabstop>
- <tabstop>basePortSpinBox</tabstop>
- <tabstop>queueLengthSpinBox</tabstop>
- <tabstop>redundancySpinBox</tabstop>
- <tabstop>resolutionComboBox</tabstop>
- <tabstop>connectAudioCheckBox</tabstop>
- <tabstop>realTimeCheckBox</tabstop>
- <tabstop>ioStatsCheckBox</tabstop>
- <tabstop>ioStatsSpinBox</tabstop>
- <tabstop>verboseCheckBox</tabstop>
- <tabstop>commandLineButton</tabstop>
- <tabstop>useDefaultsButton</tabstop>
- <tabstop>backendComboBox</tabstop>
- <tabstop>sampleRateComboBox</tabstop>
- <tabstop>bufferSizeComboBox</tabstop>
- <tabstop>inputDeviceComboBox</tabstop>
- <tabstop>outputDeviceComboBox</tabstop>
- <tabstop>refreshDevicesButton</tabstop>
- <tabstop>jitterCheckBox</tabstop>
- <tabstop>bufferStrategyComboBox</tabstop>
- <tabstop>broadcastCheckBox</tabstop>
- <tabstop>broadcastQueueSpinBox</tabstop>
- <tabstop>autoQueueCheckBox</tabstop>
- <tabstop>autoQueueSpinBox</tabstop>
- <tabstop>inFreeverbCheckBox</tabstop>
- <tabstop>inFreeverbWetnessSlider</tabstop>
- <tabstop>inZitarevCheckBox</tabstop>
- <tabstop>inZitarevWetnessSlider</tabstop>
- <tabstop>inCompressorCheckBox</tabstop>
- <tabstop>inLimiterCheckBox</tabstop>
- <tabstop>outFreeverbCheckBox</tabstop>
- <tabstop>outFreeverbWetnessSlider</tabstop>
- <tabstop>outZitarevCheckBox</tabstop>
- <tabstop>outZitarevWetnessSlider</tabstop>
- <tabstop>outCompressorCheckBox</tabstop>
- <tabstop>outLimiterCheckBox</tabstop>
- <tabstop>outClientsSpinBox</tabstop>
- </tabstops>
- <resources>
- <include location="qjacktrip.qrc"/>
- </resources>
- <connections/>
-</ui>
diff --git a/src/gui/virtualstudio.cpp b/src/gui/virtualstudio.cpp
index b2ccf52..6b133ac 100644
--- a/src/gui/virtualstudio.cpp
+++ b/src/gui/virtualstudio.cpp
@@ -72,7 +72,8 @@ VirtualStudio::VirtualStudio(bool firstRun, QObject* parent)
m_userId = settings.value(QStringLiteral("UserId"), "").toString();
m_uiScale = settings.value(QStringLiteral("UiScale"), 1).toFloat();
m_darkMode = settings.value(QStringLiteral("DarkMode"), false).toBool();
- m_showInactive = settings.value(QStringLiteral("ShowInactive"), false).toBool();
+ m_testMode = settings.value(QStringLiteral("TestMode"), false).toBool();
+ m_showInactive = settings.value(QStringLiteral("ShowInactive"), true).toBool();
m_showSelfHosted = settings.value(QStringLiteral("ShowSelfHosted"), false).toBool();
m_showDeviceSetup = settings.value(QStringLiteral("ShowDeviceSetup"), true).toBool();
m_showWarnings = settings.value(QStringLiteral("ShowWarnings"), true).toBool();
@@ -107,6 +108,10 @@ VirtualStudio::VirtualStudio(bool firstRun, QObject* parent)
});
settings.beginGroup(QStringLiteral("Audio"));
+ m_inMultiplier = settings.value(QStringLiteral("InMultiplier"), 1).toFloat();
+ m_outMultiplier = settings.value(QStringLiteral("OutMultiplier"), 1).toFloat();
+ m_inMuted = settings.value(QStringLiteral("InMuted"), false).toBool();
+ m_outMuted = settings.value(QStringLiteral("OutMuted"), false).toBool();
#ifdef RT_AUDIO
m_useRtAudio = settings.value(QStringLiteral("Backend"), 0).toInt() == 1;
m_inputDevice = settings.value(QStringLiteral("InputDevice"), "").toString();
@@ -118,6 +123,7 @@ VirtualStudio::VirtualStudio(bool firstRun, QObject* parent)
m_previousOutput = m_outputDevice;
#else
m_selectableBackend = false;
+ m_vsAudioInterface.reset(new VsAudioInterface());
// Set our combo box models to an empty list to avoid a reference error
m_view.engine()->rootContext()->setContextProperty(
@@ -158,6 +164,8 @@ VirtualStudio::VirtualStudio(bool firstRun, QObject* parent)
this);
m_view.engine()->rootContext()->setContextProperty(QStringLiteral("serverModel"),
QVariant::fromValue(m_servers));
+ m_view.engine()->rootContext()->setContextProperty(QStringLiteral("audioInterface"),
+ m_vsAudioInterface.data());
m_view.engine()->rootContext()->setContextProperty(
QStringLiteral("inputMeterModel"), QVariant::fromValue(QVector<float>()));
@@ -270,7 +278,7 @@ void VirtualStudio::setAudioBackend(const QString& backend)
return;
}
m_useRtAudio = (backend == QStringLiteral("RtAudio"));
- emit audioBackendChanged();
+ emit audioBackendChanged(m_useRtAudio);
}
int VirtualStudio::inputDevice()
@@ -291,6 +299,7 @@ void VirtualStudio::setInputDevice([[maybe_unused]] int device)
}
#ifdef RT_AUDIO
m_inputDevice = m_inputDeviceList.at(device);
+ emit inputDeviceSelected(m_inputDevice);
#endif
}
@@ -312,9 +321,70 @@ void VirtualStudio::setOutputDevice([[maybe_unused]] int device)
}
#ifdef RT_AUDIO
m_outputDevice = m_outputDeviceList.at(device);
+ emit outputDeviceSelected(m_outputDevice);
#endif
}
+float VirtualStudio::inputVolume()
+{
+ return m_inMultiplier;
+}
+
+float VirtualStudio::outputVolume()
+{
+ return m_outMultiplier;
+}
+
+bool VirtualStudio::inputMuted()
+{
+ return m_inMuted;
+}
+
+bool VirtualStudio::outputMuted()
+{
+ return m_outMuted;
+}
+
+void VirtualStudio::setInputVolume(float multiplier)
+{
+ m_inMultiplier = multiplier;
+ QSettings settings;
+ settings.beginGroup(QStringLiteral("Audio"));
+ settings.setValue(QStringLiteral("InMultiplier"), m_inMultiplier);
+ settings.endGroup();
+ emit updatedInputVolume(multiplier);
+}
+
+void VirtualStudio::setOutputVolume(float multiplier)
+{
+ m_outMultiplier = multiplier;
+ QSettings settings;
+ settings.beginGroup(QStringLiteral("Audio"));
+ settings.setValue(QStringLiteral("OutMultiplier"), m_outMultiplier);
+ settings.endGroup();
+ emit updatedOutputVolume(multiplier);
+}
+
+void VirtualStudio::setInputMuted(bool muted)
+{
+ m_inMuted = muted;
+ QSettings settings;
+ settings.beginGroup(QStringLiteral("Audio"));
+ settings.setValue(QStringLiteral("InMuted"), m_inMuted ? 1 : 0);
+ settings.endGroup();
+ emit updatedInputMuted(muted);
+}
+
+void VirtualStudio::setOutputMuted(bool muted)
+{
+ m_outMuted = muted;
+ QSettings settings;
+ settings.beginGroup(QStringLiteral("Audio"));
+ settings.setValue(QStringLiteral("OutMuted"), m_outMuted ? 1 : 0);
+ settings.endGroup();
+ emit updatedOutputMuted(muted);
+}
+
int VirtualStudio::bufferSize()
{
#ifdef RT_AUDIO
@@ -497,6 +567,27 @@ void VirtualStudio::setDarkMode(bool dark)
emit darkModeChanged();
}
+bool VirtualStudio::testMode()
+{
+ return m_testMode;
+}
+
+void VirtualStudio::setTestMode(bool test)
+{
+ QString userEmail = m_userMetadata[QStringLiteral("email")].toString();
+ if (m_userMetadata.isEmpty() || userEmail == ""
+ || !userEmail.endsWith("@jacktrip.org")) {
+ qDebug() << "Not allowed";
+ return;
+ }
+ m_testMode = test;
+ QSettings settings;
+ settings.beginGroup(QStringLiteral("VirtualStudio"));
+ settings.setValue(QStringLiteral("TestMode"), m_testMode);
+ settings.endGroup();
+ emit testModeChanged();
+}
+
QUrl VirtualStudio::studioToJoin()
{
return m_studioToJoin;
@@ -615,11 +706,10 @@ void VirtualStudio::toVirtualStudio()
QByteArray code = parameters->value(QStringLiteral("code")).toByteArray();
(*parameters)[QStringLiteral("code")] = QUrl::fromPercentEncoding(code);
} else if (stage == QAbstractOAuth2::Stage::RequestingAuthorization) {
- parameters->insert(QStringLiteral("audience"),
- QStringLiteral("https://api.jacktrip.org"));
+ parameters->insert(QStringLiteral("audience"), AUTH_AUDIENCE);
}
if (!parameters->contains("client_id")) {
- parameters->insert("client_id", "cROUJag0UVKDaJ6jRAKRzlVjKVFNU39I");
+ parameters->insert("client_id", AUTH_CLIENT_ID);
}
});
@@ -647,12 +737,17 @@ void VirtualStudio::logout()
settings.beginGroup(QStringLiteral("VirtualStudio"));
settings.remove(QStringLiteral("RefreshToken"));
settings.remove(QStringLiteral("UserId"));
+ settings.remove(QStringLiteral("ShowInactive"));
+ settings.remove(QStringLiteral("ShowSelfHosted"));
+ settings.remove(QStringLiteral("ShowDeviceSetup"));
+ settings.remove(QStringLiteral("ShowWarnings"));
settings.endGroup();
m_refreshTimer.stop();
m_heartbeatTimer.stop();
m_refreshToken.clear();
+ m_userMetadata = QJsonObject();
m_userId.clear();
emit hasRefreshTokenChanged();
}
@@ -680,11 +775,16 @@ void VirtualStudio::refreshDevices()
m_outputDevice = QStringLiteral("(default)");
}
- emit inputDeviceChanged();
- emit outputDeviceChanged();
+ emit inputDeviceChanged(m_inputDevice);
+ emit outputDeviceChanged(m_outputDevice);
#endif
}
+void VirtualStudio::playOutputAudio()
+{
+ emit triggerPlayOutputAudio();
+}
+
void VirtualStudio::revertSettings()
{
m_uiScale = m_previousUiScale;
@@ -695,10 +795,10 @@ void VirtualStudio::revertSettings()
m_outputDevice = m_previousOutput;
m_bufferSize = m_previousBuffer;
m_useRtAudio = m_previousUseRtAudio;
- emit inputDeviceChanged();
- emit outputDeviceChanged();
+ emit inputDeviceChanged(m_inputDevice);
+ emit outputDeviceChanged(m_outputDevice);
emit bufferSizeChanged();
- emit audioBackendChanged();
+ emit audioBackendChanged(m_useRtAudio);
#endif
}
@@ -724,8 +824,8 @@ void VirtualStudio::applySettings()
m_previousInput = m_inputDevice;
m_previousOutput = m_outputDevice;
- emit inputDeviceChanged();
- emit outputDeviceChanged();
+ emit inputDeviceChanged(m_inputDevice);
+ emit outputDeviceChanged(m_outputDevice);
#endif
// attempt to join studio if requested
@@ -769,10 +869,10 @@ void VirtualStudio::connectToStudio(int studioIndex)
{QLatin1String("expiresAt"), expiration}};
QJsonDocument request = QJsonDocument(json);
- QNetworkReply* reply = m_authenticator->put(
- QStringLiteral("https://app.jacktrip.org/api/servers/%1")
- .arg(studioInfo->id()),
- request.toJson());
+ QNetworkReply* reply =
+ m_authenticator->put(QStringLiteral("https://%1/api/servers/%2")
+ .arg(m_apiHost, studioInfo->id()),
+ request.toJson());
connect(reply, &QNetworkReply::finished, this, [&, reply]() {
if (reply->error() != QNetworkReply::NoError) {
m_connectionState = QStringLiteral("Unable to Start Studio");
@@ -838,16 +938,51 @@ void VirtualStudio::completeConnection()
&VirtualStudio::receivedConnectionFromPeer,
Qt::QueuedConnection);
+ // Stop VsAudioInterface
+ if (!m_vsAudioInterface.isNull()) {
+ m_vsAudioInterface->closeAudio();
+ }
+
+ // Setup output volume
+ m_outputVolumePlugin = new Volume(jackTrip->getNumOutputChannels());
+ jackTrip->appendProcessPluginFromNetwork(m_outputVolumePlugin);
+ connect(this, &VirtualStudio::updatedOutputVolume, m_outputVolumePlugin,
+ &Volume::volumeUpdated);
+ connect(this, &VirtualStudio::updatedOutputMuted, m_outputVolumePlugin,
+ &Volume::muteUpdated);
+
+ // Setup input volume
+ m_inputVolumePlugin = new Volume(jackTrip->getNumInputChannels());
+ jackTrip->appendProcessPluginToNetwork(m_inputVolumePlugin);
+ connect(this, &VirtualStudio::updatedInputVolume, m_inputVolumePlugin,
+ &Volume::volumeUpdated);
+ connect(this, &VirtualStudio::updatedInputMuted, m_inputVolumePlugin,
+ &Volume::muteUpdated);
+
+ // Setup output meter
Meter* m_outputMeter = new Meter(jackTrip->getNumOutputChannels());
jackTrip->appendProcessPluginFromNetwork(m_outputMeter);
connect(m_outputMeter, &Meter::onComputedVolumeMeasurements, this,
&VirtualStudio::updatedOutputVuMeasurements);
+ // Setup input meter
Meter* m_inputMeter = new Meter(jackTrip->getNumInputChannels());
jackTrip->appendProcessPluginToNetwork(m_inputMeter);
connect(m_inputMeter, &Meter::onComputedVolumeMeasurements, this,
&VirtualStudio::updatedInputVuMeasurements);
+ // Grab previous levels
+ QSettings settings;
+ settings.beginGroup(QStringLiteral("Audio"));
+ m_inMultiplier = settings.value(QStringLiteral("InMultiplier"), 1).toFloat();
+ m_outMultiplier = settings.value(QStringLiteral("OutMultiplier"), 1).toFloat();
+ m_inMuted = settings.value(QStringLiteral("InMuted"), false).toBool();
+ m_outMuted = settings.value(QStringLiteral("OutMuted"), false).toBool();
+ emit updatedInputVolume(m_inMultiplier);
+ emit updatedOutputVolume(m_outMultiplier);
+ emit updatedInputMuted(m_inMuted);
+ emit updatedOutputMuted(m_outMuted);
+
m_connectionState = QStringLiteral("Connecting...");
emit connectionStateChanged();
#ifdef RT_AUDIO
@@ -931,6 +1066,19 @@ void VirtualStudio::disconnect()
m_allowRefresh = true;
m_refreshTimer.start();
}
+
+ // Start VsAudioInterface again
+ if (!m_vsAudioInterface.isNull()) {
+ m_vsAudioInterface->setupAudio();
+ m_vsAudioInterface->setupPlugins();
+
+ m_view.engine()->rootContext()->setContextProperty(
+ QStringLiteral("inputMeterModel"),
+ QVariant::fromValue(
+ QVector<float>(m_vsAudioInterface->getNumInputChannels())));
+
+ m_vsAudioInterface->startProcess();
+ }
}
void VirtualStudio::manageStudio(int studioIndex)
@@ -939,21 +1087,21 @@ void VirtualStudio::manageStudio(int studioIndex)
// We're here from a connected screen. Use our current studio.
studioIndex = m_currentStudio;
}
- QUrl url =
- QUrl(QStringLiteral("https://app.jacktrip.org/studios/%1")
- .arg(static_cast<VsServerInfo*>(m_servers.at(studioIndex))->id()));
+ QUrl url = QUrl(
+ QStringLiteral("https://%1/studios/%2")
+ .arg(m_apiHost, static_cast<VsServerInfo*>(m_servers.at(studioIndex))->id()));
QDesktopServices::openUrl(url);
}
void VirtualStudio::createStudio()
{
- QUrl url = QUrl(QStringLiteral("https://app.jacktrip.org/studios/create"));
+ QUrl url = QUrl(QStringLiteral("https://%1/studios/create").arg(m_apiHost));
QDesktopServices::openUrl(url);
}
void VirtualStudio::editProfile()
{
- QUrl url = QUrl(QStringLiteral("https://app.jacktrip.org/profile"));
+ QUrl url = QUrl(QStringLiteral("https://%1/profile").arg(m_apiHost));
QDesktopServices::openUrl(url);
}
@@ -983,6 +1131,12 @@ void VirtualStudio::exit()
void VirtualStudio::slotAuthSucceded()
{
+ // Determine which API host to use
+ m_apiHost = PROD_API_HOST;
+ if (m_testMode) {
+ m_apiHost = TEST_API_HOST;
+ }
+
m_authenticated = true;
m_refreshToken = m_authenticator->refreshToken();
emit hasRefreshTokenChanged();
@@ -992,9 +1146,46 @@ void VirtualStudio::slotAuthSucceded()
settings.setValue(QStringLiteral("RefreshToken"), m_refreshToken);
settings.endGroup();
- m_device = new VsDevice(m_authenticator.data());
+ m_device = new VsDevice(m_authenticator.data(), m_testMode);
m_device->registerApp();
+ if (m_vsAudioInterface.isNull()) {
+ m_vsAudioInterface.reset(new VsAudioInterface());
+ m_view.engine()->rootContext()->setContextProperty(
+ QStringLiteral("audioInterface"), m_vsAudioInterface.data());
+ }
+#ifdef RT_AUDIO
+ m_vsAudioInterface->setInputDevice(m_inputDevice);
+ m_vsAudioInterface->setOutputDevice(m_outputDevice);
+ m_vsAudioInterface->setAudioInterfaceMode(m_useRtAudio);
+#endif
+ m_vsAudioInterface->setupAudio();
+
+ connect(this, &VirtualStudio::inputDeviceChanged, m_vsAudioInterface.data(),
+ &VsAudioInterface::setInputDevice);
+ connect(this, &VirtualStudio::inputDeviceSelected, m_vsAudioInterface.data(),
+ &VsAudioInterface::setInputDevice);
+ connect(this, &VirtualStudio::outputDeviceChanged, m_vsAudioInterface.data(),
+ &VsAudioInterface::setOutputDevice);
+ connect(this, &VirtualStudio::outputDeviceSelected, m_vsAudioInterface.data(),
+ &VsAudioInterface::setOutputDevice);
+ connect(this, &VirtualStudio::audioBackendChanged, m_vsAudioInterface.data(),
+ &VsAudioInterface::setAudioInterfaceMode);
+ connect(this, &VirtualStudio::triggerPlayOutputAudio, m_vsAudioInterface.data(),
+ &VsAudioInterface::triggerPlayback);
+ connect(m_vsAudioInterface.data(), &VsAudioInterface::newVolumeMeterMeasurements,
+ this, &VirtualStudio::updatedInputVuMeasurements);
+ connect(m_vsAudioInterface.data(), &VsAudioInterface::errorToProcess, this,
+ &VirtualStudio::processError);
+
+ m_vsAudioInterface->setupPlugins();
+
+ m_view.engine()->rootContext()->setContextProperty(
+ QStringLiteral("inputMeterModel"),
+ QVariant::fromValue(QVector<float>(m_vsAudioInterface->getNumInputChannels())));
+
+ m_vsAudioInterface->startProcess();
+
if (m_userId.isEmpty()) {
getUserId();
} else {
@@ -1004,7 +1195,7 @@ void VirtualStudio::slotAuthSucceded()
if (m_regions.isEmpty()) {
getRegions();
}
- if (m_userMetadata.isEmpty()) {
+ if (m_userMetadata.isEmpty() && !m_userId.isEmpty()) {
getUserMetadata();
}
@@ -1018,6 +1209,12 @@ void VirtualStudio::slotAuthSucceded()
}
}
connect(m_device, &VsDevice::updateNetworkStats, this, &VirtualStudio::updatedStats);
+ connect(m_device, &VsDevice::updatedVolumeFromServer, this,
+ &VirtualStudio::setInputVolume);
+ connect(m_device, &VsDevice::updatedMuteFromServer, this,
+ &VirtualStudio::setInputMuted);
+ connect(this, &VirtualStudio::updatedInputVolume, m_device, &VsDevice::updateVolume);
+ connect(this, &VirtualStudio::updatedInputMuted, m_device, &VsDevice::updateMute);
}
void VirtualStudio::slotAuthFailed()
@@ -1058,19 +1255,30 @@ void VirtualStudio::processFinished()
void VirtualStudio::processError(const QString& errorMessage)
{
+ bool shouldSwitchToRtAudio = false;
if (!m_retryPeriod) {
QMessageBox msgBox;
if (errorMessage == QLatin1String("Peer Stopped")) {
// Report the other end quitting as a regular occurance rather than an error.
msgBox.setText("The Studio has been stopped.");
msgBox.setWindowTitle(QStringLiteral("Disconnected"));
+ } else if (errorMessage
+ == QLatin1String("Maybe the JACK server is not running?")) {
+ // Report the other end quitting as a regular occurance rather than an error.
+ msgBox.setText("The JACK server is not running. Switching back to RtAudio.");
+ msgBox.setWindowTitle(QStringLiteral("No JACK server"));
+ shouldSwitchToRtAudio = true;
} else {
msgBox.setText(QStringLiteral("Error: ").append(errorMessage));
msgBox.setWindowTitle(QStringLiteral("Doh!"));
}
msgBox.exec();
}
- processFinished();
+ if (shouldSwitchToRtAudio) {
+ setAudioBackend("RtAudio");
+ } else {
+ processFinished();
+ }
}
void VirtualStudio::receivedConnectionFromPeer()
@@ -1093,7 +1301,7 @@ void VirtualStudio::checkForHostname()
VsServerInfo* studioInfo = static_cast<VsServerInfo*>(m_servers.at(m_currentStudio));
QNetworkReply* reply = m_authenticator->get(
- QStringLiteral("https://app.jacktrip.org/api/servers/%1").arg(studioInfo->id()));
+ QStringLiteral("https://%1/api/servers/%2").arg(m_apiHost, studioInfo->id()));
connect(reply, &QNetworkReply::finished, this, [&, reply, studioInfo]() {
if (reply->error() != QNetworkReply::NoError) {
m_connectionState = QStringLiteral("Unable to Start Studio");
@@ -1153,7 +1361,7 @@ void VirtualStudio::updatedStats(const QJsonObject& stats)
return;
}
-void VirtualStudio::updatedInputVuMeasurements(const QVector<float> valuesInDecibels)
+void VirtualStudio::updatedInputVuMeasurements(const QVector<float>& valuesInDecibels)
{
QJsonArray uiValues;
bool detectedClip = false;
@@ -1185,7 +1393,7 @@ void VirtualStudio::updatedInputVuMeasurements(const QVector<float> valuesInDeci
QVariant::fromValue(uiValues));
}
-void VirtualStudio::updatedOutputVuMeasurements(const QVector<float> valuesInDecibels)
+void VirtualStudio::updatedOutputVuMeasurements(const QVector<float>& valuesInDecibels)
{
QJsonArray uiValues;
bool detectedClip = false;
@@ -1228,14 +1436,11 @@ void VirtualStudio::setupAuthenticator()
&QOAuth2AuthorizationCodeFlow::authorizeWithBrowser, this,
&VirtualStudio::launchBrowser);
- const QUrl authUri(QStringLiteral("https://auth.jacktrip.org/authorize"));
- const QString clientId = QStringLiteral("cROUJag0UVKDaJ6jRAKRzlVjKVFNU39I");
- const QUrl tokenUri(QStringLiteral("https://auth.jacktrip.org/oauth/token"));
const quint16 port = 52424;
- m_authenticator->setAuthorizationUrl(authUri);
- m_authenticator->setClientIdentifier(clientId);
- m_authenticator->setAccessTokenUrl(tokenUri);
+ m_authenticator->setAuthorizationUrl(AUTH_AUTHORIZE_URI);
+ m_authenticator->setClientIdentifier(AUTH_CLIENT_ID);
+ m_authenticator->setAccessTokenUrl(AUTH_TOKEN_URI);
m_authenticator->setModifyParametersFunction([](QAbstractOAuth2::Stage stage,
QVariantMap* parameters) {
@@ -1294,7 +1499,7 @@ void VirtualStudio::getServerList(bool firstLoad, bool signalRefresh, int index)
}
QNetworkReply* reply =
- m_authenticator->get(QStringLiteral("https://app.jacktrip.org/api/servers"));
+ m_authenticator->get(QStringLiteral("https://%1/api/servers").arg(m_apiHost));
connect(
reply, &QNetworkReply::finished, this,
[&, reply, topServerId, firstLoad, signalRefresh]() {
@@ -1484,6 +1689,11 @@ void VirtualStudio::getUserId()
settings.setValue(QStringLiteral("UserId"), m_userId);
settings.endGroup();
getSubscriptions();
+
+ if (m_userMetadata.isEmpty() && !m_userId.isEmpty()) {
+ getUserMetadata();
+ }
+
reply->deleteLater();
});
}
@@ -1491,8 +1701,7 @@ void VirtualStudio::getUserId()
void VirtualStudio::getSubscriptions()
{
QNetworkReply* reply = m_authenticator->get(
- QStringLiteral("https://app.jacktrip.org/api/users/%1/subscriptions")
- .arg(m_userId));
+ QStringLiteral("https://%1/api/users/%2/subscriptions").arg(m_apiHost, m_userId));
connect(reply, &QNetworkReply::finished, this, [&, reply]() {
if (reply->error() != QNetworkReply::NoError) {
std::cout << "Error: " << reply->errorString().toStdString() << std::endl;
@@ -1522,7 +1731,7 @@ void VirtualStudio::getSubscriptions()
void VirtualStudio::getRegions()
{
QNetworkReply* reply = m_authenticator->get(
- QStringLiteral("https://app.jacktrip.org/api/users/%1/regions").arg(m_userId));
+ QStringLiteral("https://%1/api/users/%2/regions").arg(m_apiHost, m_userId));
connect(reply, &QNetworkReply::finished, this, [&, reply]() {
if (reply->error() != QNetworkReply::NoError) {
std::cout << "Error: " << reply->errorString().toStdString() << std::endl;
@@ -1540,7 +1749,7 @@ void VirtualStudio::getRegions()
void VirtualStudio::getUserMetadata()
{
QNetworkReply* reply = m_authenticator->get(
- QStringLiteral("https://app.jacktrip.org/api/users/%1").arg(m_userId));
+ QStringLiteral("https://%1/api/users/%2").arg(m_apiHost, m_userId));
connect(reply, &QNetworkReply::finished, this, [&, reply]() {
if (reply->error() != QNetworkReply::NoError) {
std::cout << "Error: " << reply->errorString().toStdString() << std::endl;
@@ -1588,7 +1797,7 @@ void VirtualStudio::stopStudio()
QJsonDocument request = QJsonDocument(json);
studioInfo->setHost(QLatin1String(""));
QNetworkReply* reply = m_authenticator->put(
- QStringLiteral("https://app.jacktrip.org/api/servers/%1").arg(studioInfo->id()),
+ QStringLiteral("https://%1/api/servers/%2").arg(m_apiHost, studioInfo->id()),
request.toJson());
connect(reply, &QNetworkReply::finished, this, [=]() {
if (m_isExiting && !m_jackTripRunning) {
@@ -1606,6 +1815,7 @@ VirtualStudio::~VirtualStudio()
delete m_inputMeter;
delete m_outputMeter;
+ delete m_inputTestMeter;
QDesktopServices::unsetUrlHandler("jacktrip");
}
diff --git a/src/gui/virtualstudio.h b/src/gui/virtualstudio.h
index 428ffa9..693b911 100644
--- a/src/gui/virtualstudio.h
+++ b/src/gui/virtualstudio.h
@@ -49,6 +49,9 @@
#include "../JackTrip.h"
#include "../Meter.h"
+#include "../Volume.h"
+#include "vsAudioInterface.h"
+#include "vsConstants.h"
#include "vsDevice.h"
#include "vsQuickView.h"
#include "vsServerInfo.h"
@@ -96,6 +99,7 @@ class VirtualStudio : public QObject
Q_PROPERTY(float fontScale READ fontScale CONSTANT)
Q_PROPERTY(float uiScale READ uiScale WRITE setUiScale NOTIFY uiScaleChanged)
Q_PROPERTY(bool darkMode READ darkMode WRITE setDarkMode NOTIFY darkModeChanged)
+ Q_PROPERTY(bool testMode READ testMode WRITE setTestMode NOTIFY testModeChanged)
Q_PROPERTY(bool showDeviceSetup READ showDeviceSetup WRITE setShowDeviceSetup NOTIFY
showDeviceSetupChanged)
Q_PROPERTY(bool showWarnings READ showWarnings WRITE setShowWarnings NOTIFY
@@ -105,6 +109,12 @@ class VirtualStudio : public QObject
Q_PROPERTY(QString failedMessage READ failedMessage NOTIFY failedMessageChanged)
Q_PROPERTY(
bool shouldJoin READ shouldJoin WRITE setShouldJoin NOTIFY shouldJoinChanged)
+ Q_PROPERTY(
+ float inputVolume READ inputVolume WRITE setInputVolume NOTIFY updatedInputVolume)
+ Q_PROPERTY(float outputVolume READ outputVolume WRITE setOutputVolume NOTIFY
+ updatedOutputVolume)
+ Q_PROPERTY(
+ bool inputMuted READ inputMuted WRITE setInputMuted NOTIFY updatedInputMuted)
public:
explicit VirtualStudio(bool firstRun = false, QObject* parent = nullptr);
@@ -149,6 +159,8 @@ class VirtualStudio : public QObject
void setUiScale(float scale);
bool darkMode();
void setDarkMode(bool dark);
+ bool testMode();
+ void setTestMode(bool test);
QUrl studioToJoin();
void setStudioToJoin(const QUrl& url);
bool showDeviceSetup();
@@ -160,6 +172,10 @@ class VirtualStudio : public QObject
QString failedMessage();
bool shouldJoin();
void setShouldJoin(bool join);
+ float inputVolume();
+ float outputVolume();
+ bool inputMuted();
+ bool outputMuted();
public slots:
void toStandard();
@@ -168,6 +184,7 @@ class VirtualStudio : public QObject
void logout();
void refreshStudios(int index, bool signalRefresh = false);
void refreshDevices();
+ void playOutputAudio();
void revertSettings();
void applySettings();
void connectToStudio(int studioIndex);
@@ -177,6 +194,12 @@ class VirtualStudio : public QObject
void createStudio();
void editProfile();
void showAbout();
+ void updatedInputVuMeasurements(const QVector<float>& valuesInDecibels);
+ void updatedOutputVuMeasurements(const QVector<float>& valuesInDecibels);
+ void setInputVolume(float multiplier);
+ void setOutputVolume(float multiplier);
+ void setInputMuted(bool muted);
+ void setOutputMuted(bool muted);
void exit();
signals:
@@ -189,9 +212,12 @@ class VirtualStudio : public QObject
void showFirstRunChanged();
void hasRefreshTokenChanged();
void logoSectionChanged();
- void audioBackendChanged();
- void inputDeviceChanged();
- void outputDeviceChanged();
+ void audioBackendChanged(bool useRtAudio);
+ void inputDeviceChanged(QString device);
+ void outputDeviceChanged(QString device);
+ void inputDeviceSelected(QString device);
+ void outputDeviceSelected(QString device);
+ void triggerPlayOutputAudio();
void bufferSizeChanged();
void bufferStrategyChanged();
void currentStudioChanged();
@@ -208,10 +234,15 @@ class VirtualStudio : public QObject
void uiScaleChanged();
void newScale();
void darkModeChanged();
+ void testModeChanged();
void signalExit();
void periodicRefresh();
void failedMessageChanged();
void shouldJoinChanged();
+ void updatedInputVolume(float multiplier);
+ void updatedOutputVolume(float multiplier);
+ void updatedInputMuted(bool muted);
+ void updatedOutputMuted(bool muted);
private slots:
void slotAuthSucceded();
@@ -224,8 +255,6 @@ class VirtualStudio : public QObject
void launchBrowser(const QUrl& url);
void joinStudio();
void updatedStats(const QJsonObject& stats);
- void updatedInputVuMeasurements(const QVector<float> valuesInDecibels);
- void updatedOutputVuMeasurements(const QVector<float> valuesInDecibels);
private:
void setupAuthenticator();
@@ -281,7 +310,7 @@ class VirtualStudio : public QObject
bool m_onConnectedScreen = false;
bool m_isExiting = false;
- bool m_showInactive = false;
+ bool m_showInactive = true;
bool m_showSelfHosted = false;
bool m_showCreateStudio = false;
bool m_showDeviceSetup = true;
@@ -290,19 +319,31 @@ class VirtualStudio : public QObject
float m_uiScale;
float m_previousUiScale;
int m_bufferStrategy = 0;
+ QString m_apiHost = PROD_API_HOST;
bool m_darkMode = false;
+ bool m_testMode = false;
QString m_failedMessage = "";
QUrl m_studioToJoin;
bool m_authenticated = false;
Meter* m_inputMeter;
Meter* m_outputMeter;
+ Meter* m_inputTestMeter;
+ Volume* m_inputVolumePlugin;
+ Volume* m_outputVolumePlugin;
QTimer m_inputClipTimer;
QTimer m_outputClipTimer;
float m_meterMax = 0.0;
float m_meterMin = -64.0;
+ float m_inMultiplier = 1.0;
+ float m_outMultiplier = 1.0;
+ bool m_inMuted = false;
+ bool m_outMuted = false;
+
+ QSharedPointer<VsAudioInterface> m_vsAudioInterface;
+
#ifdef RT_AUDIO
QStringList m_inputDeviceList;
QStringList m_outputDeviceList;
diff --git a/src/gui/vsAudioInterface.cpp b/src/gui/vsAudioInterface.cpp
new file mode 100644
index 0000000..b21df2d
--- /dev/null
+++ b/src/gui/vsAudioInterface.cpp
@@ -0,0 +1,383 @@
+//*****************************************************************
+/*
+ JackTrip: A System for High-Quality Audio Network Performance
+ over the Internet
+
+ Copyright (c) 2008-2022 Juan-Pablo Caceres, Chris Chafe.
+ SoundWIRE group at CCRMA, Stanford University.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ OTHER DEALINGS IN THE SOFTWARE.
+*/
+//*****************************************************************
+
+/**
+ * \file vsAudioInterface.cpp
+ * \author Matt Horton
+ * \date September 2022
+ */
+
+#include "vsAudioInterface.h"
+
+#include <QDebug>
+#include <QMessageBox>
+#include <QSettings>
+
+#include "../Meter.h"
+#include "../Tone.h"
+
+// Constructor
+VsAudioInterface::VsAudioInterface(int NumChansIn, int NumChansOut,
+ AudioInterface::audioBitResolutionT AudioBitResolution,
+ QObject* parent)
+ : QObject(parent)
+ , m_numAudioChansIn(NumChansIn)
+ , m_numAudioChansOut(NumChansOut)
+ , m_audioBitResolution(AudioBitResolution)
+ , m_sampleRate(gDefaultSampleRate)
+ , m_deviceID(gDefaultDeviceID)
+ , m_inputDeviceName("")
+ , m_outputDeviceName("")
+ , m_audioBufferSize(gDefaultBufferSizeInSamples)
+ , m_audioInterfaceMode(VsAudioInterface::RTAUDIO)
+{
+ QSettings settings;
+ settings.beginGroup(QStringLiteral("Audio"));
+ m_inMultiplier = settings.value(QStringLiteral("InMultiplier"), 1).toFloat();
+ m_outMultiplier = settings.value(QStringLiteral("OutMultiplier"), 1).toFloat();
+ m_inMuted = settings.value(QStringLiteral("InMuted"), false).toBool();
+ m_outMuted = settings.value(QStringLiteral("OutMuted"), false).toBool();
+ m_audioInterfaceMode = (settings.value(QStringLiteral("Backend"), 0).toInt() == 1)
+ ? VsAudioInterface::RTAUDIO
+ : VsAudioInterface::JACK;
+ m_inputDeviceName =
+ settings.value(QStringLiteral("InputDevice"), "").toString().toStdString();
+ m_outputDeviceName =
+ settings.value(QStringLiteral("OutputDevice"), "").toString().toStdString();
+ settings.endGroup();
+
+ connect(this, &VsAudioInterface::settingsUpdated, this,
+ &VsAudioInterface::replaceProcess);
+ connect(this, &VsAudioInterface::modeUpdated, this,
+ &VsAudioInterface::replaceProcess);
+}
+
+VsAudioInterface::~VsAudioInterface()
+{
+ closeAudio();
+}
+
+void VsAudioInterface::setupAudio()
+{
+ try {
+ // Check if m_audioInterface has already been created or not
+ if (!m_audioInterface.isNull()) { // if it has been created, disconnect it from
+ // JACK and delete it
+ std::cout << "WARNING: JackAudio interface was setup already:" << std::endl;
+ std::cout << "It will be erased and setup again." << std::endl;
+ std::cout << gPrintSeparator << std::endl;
+ closeAudio();
+ }
+
+ // Create AudioInterface Client Object
+ if (m_audioInterfaceMode == VsAudioInterface::JACK) {
+#ifndef NO_JACK
+ if (gVerboseFlag)
+ std::cout << " JackTrip:setupAudio before new JackAudioInterface"
+ << std::endl;
+ m_audioInterface.reset(new JackAudioInterface(
+ m_numAudioChansIn, m_numAudioChansOut, m_audioBitResolution));
+
+ m_audioInterface->setClientName(QStringLiteral("JackTrip"));
+
+ if (gVerboseFlag)
+ std::cout << " JackTrip:setupAudio before m_audioInterface->setup"
+ << std::endl;
+ m_audioInterface->setup();
+ if (gVerboseFlag)
+ std::cout
+ << " JackTrip:setupAudio before m_audioInterface->getSampleRate"
+ << std::endl;
+ m_sampleRate = m_audioInterface->getSampleRate();
+ if (gVerboseFlag)
+ std::cout << " JackTrip:setupAudio before m_audioInterface->getDeviceID"
+ << std::endl;
+ m_deviceID = m_audioInterface->getDeviceID();
+ if (gVerboseFlag)
+ std::cout << " JackTrip:setupAudio before "
+ "m_audioInterface->getBufferSizeInSamples"
+ << std::endl;
+ m_audioBufferSize = m_audioInterface->getBufferSizeInSamples();
+#endif //__NON_JACK__
+#ifdef NO_JACK /// \todo FIX THIS REPETITION OF CODE
+#ifdef RT_AUDIO
+ std::cout << "Warning: using non jack version, RtAudio will be used instead"
+ << std::endl;
+ m_audioInterface.reset(new RtAudioInterface(
+ m_numAudioChansIn, m_numAudioChansOut, m_audioBitResolution));
+ m_audioInterface->setSampleRate(m_sampleRate);
+ m_audioInterface->setDeviceID(m_deviceID);
+ m_audioInterface->setInputDevice(m_inputDeviceName);
+ m_audioInterface->setOutputDevice(m_outputDeviceName);
+ m_audioInterface->setBufferSizeInSamples(m_audioBufferSize);
+ m_audioInterface->setup();
+ // Setup might have reduced number of channels
+ m_numAudioChansIn = m_audioInterface->getNumInputChannels();
+ m_numAudioChansOut = m_audioInterface->getNumOutputChannels();
+ // Setup might have changed buffer size
+ m_audioBufferSize = m_audioInterface->getBufferSizeInSamples();
+#endif
+#endif
+ } else if (m_audioInterfaceMode == VsAudioInterface::RTAUDIO) {
+#ifdef RT_AUDIO
+ m_audioInterface.reset(new RtAudioInterface(
+ m_numAudioChansIn, m_numAudioChansOut, m_audioBitResolution));
+ m_audioInterface->setSampleRate(m_sampleRate);
+ m_audioInterface->setDeviceID(m_deviceID);
+ m_audioInterface->setInputDevice(m_inputDeviceName);
+ m_audioInterface->setOutputDevice(m_outputDeviceName);
+ m_audioInterface->setBufferSizeInSamples(m_audioBufferSize);
+ m_audioInterface->setup();
+ // Setup might have reduced number of channels
+ m_numAudioChansIn = m_audioInterface->getNumInputChannels();
+ m_numAudioChansOut = m_audioInterface->getNumOutputChannels();
+ // Setup might have changed buffer size
+ m_audioBufferSize = m_audioInterface->getBufferSizeInSamples();
+#endif
+ }
+
+ std::cout << "The Sampling Rate is: " << m_sampleRate << std::endl;
+ std::cout << gPrintSeparator << std::endl;
+ int AudioBufferSizeInBytes = m_audioBufferSize * sizeof(sample_t);
+ std::cout << "The Audio Buffer Size is: " << m_audioBufferSize << " samples"
+ << std::endl;
+ std::cout << " or: " << AudioBufferSizeInBytes << " bytes"
+ << std::endl;
+ std::cout << gPrintSeparator << std::endl;
+ std::cout << "The Number of Channels is: "
+ << m_audioInterface->getNumInputChannels() << std::endl;
+ std::cout << gPrintSeparator << std::endl;
+ QThread::usleep(100);
+ } catch (const std::exception& e) {
+ emit errorToProcess(QString::fromUtf8(e.what()));
+ }
+}
+
+void VsAudioInterface::closeAudio()
+{
+ if (!m_audioInterface.isNull()) {
+ try {
+ if (m_audioActive) {
+ m_audioInterface->stopProcess();
+ m_audioActive = false;
+ }
+ } catch (const std::exception& e) {
+ emit errorToProcess(QString::fromUtf8(e.what()));
+ }
+ m_audioInterface.clear();
+ m_numAudioChansIn = gDefaultNumInChannels;
+ m_numAudioChansOut = gDefaultNumOutChannels;
+ m_deviceID = gDefaultDeviceID;
+ }
+}
+
+void VsAudioInterface::replaceProcess()
+{
+ if (m_hasBeenActive) {
+ closeAudio();
+ setupAudio();
+ setupPlugins();
+ startProcess();
+ }
+}
+
+void VsAudioInterface::processMeterMeasurements(QVector<float> values)
+{
+ emit newVolumeMeterMeasurements(values);
+}
+
+void VsAudioInterface::addInputPlugin(ProcessPlugin* plugin)
+{
+ m_audioInterface->appendProcessPluginToNetwork(plugin);
+}
+
+void VsAudioInterface::addOutputPlugin(ProcessPlugin* plugin)
+{
+ m_audioInterface->appendProcessPluginFromNetwork(plugin);
+}
+
+void VsAudioInterface::setInputDevice(QString deviceName)
+{
+ m_inputDeviceName = deviceName.toStdString();
+ if (m_inputDeviceName == "(default)") {
+ m_inputDeviceName = "";
+ }
+
+ if (!m_audioInterface.isNull()) {
+ m_audioInterface->setInputDevice(m_inputDeviceName);
+ if (m_audioActive) {
+ emit settingsUpdated();
+ }
+ }
+}
+
+void VsAudioInterface::setOutputDevice(QString deviceName)
+{
+ m_outputDeviceName = deviceName.toStdString();
+ if (m_outputDeviceName == "(default)") {
+ m_outputDeviceName = "";
+ }
+
+ if (!m_audioInterface.isNull()) {
+ m_audioInterface->setOutputDevice(m_outputDeviceName);
+ if (m_audioActive) {
+ emit settingsUpdated();
+ }
+ }
+}
+
+void VsAudioInterface::setAudioInterfaceMode(bool useRtAudio)
+{
+ if (useRtAudio) {
+ m_audioInterfaceMode = VsAudioInterface::RTAUDIO;
+ } else {
+ m_audioInterfaceMode = VsAudioInterface::JACK;
+ }
+ if (!m_audioInterface.isNull() || m_hasBeenActive) {
+ emit modeUpdated();
+ }
+}
+
+int VsAudioInterface::getNumInputChannels()
+{
+ return m_audioInterface->getNumInputChannels();
+}
+
+int VsAudioInterface::getNumOutputChannels()
+{
+ return m_audioInterface->getNumOutputChannels();
+}
+
+void VsAudioInterface::setupPlugins()
+{
+ // Create plugins
+ m_inputMeter = new Meter(getNumInputChannels());
+ m_inputVolumePlugin = new Volume(getNumInputChannels());
+ m_outputVolumePlugin = new Volume(getNumOutputChannels());
+ m_outputTonePlugin = new Tone(getNumOutputChannels());
+
+ // Add plugins to chains
+ addOutputPlugin(m_outputTonePlugin);
+ addInputPlugin(m_inputVolumePlugin);
+ addOutputPlugin(m_outputVolumePlugin);
+ addInputPlugin(m_inputMeter);
+
+ // Connect plugins for communication with UI
+ connect(m_inputMeter, &Meter::onComputedVolumeMeasurements, this,
+ &VsAudioInterface::processMeterMeasurements);
+ connect(this, &VsAudioInterface::updatedInputVolume, m_inputVolumePlugin,
+ &Volume::volumeUpdated);
+ connect(this, &VsAudioInterface::updatedOutputVolume, m_outputVolumePlugin,
+ &Volume::volumeUpdated);
+ connect(this, &VsAudioInterface::updatedInputMuted, m_inputVolumePlugin,
+ &Volume::muteUpdated);
+ connect(this, &VsAudioInterface::updatedOutputMuted, m_outputVolumePlugin,
+ &Volume::muteUpdated);
+ connect(this, &VsAudioInterface::triggerPlayback, m_outputTonePlugin,
+ &Tone::triggerPlayback);
+}
+
+void VsAudioInterface::startProcess()
+{
+ if (!m_audioInterface.isNull() && !m_audioActive) {
+ try {
+ m_audioInterface->initPlugins();
+ m_audioInterface->startProcess();
+ if (m_audioInterfaceMode == VsAudioInterface::JACK) {
+ m_audioInterface->connectDefaultPorts();
+ }
+ } catch (const std::exception& e) {
+ emit errorToProcess(QString::fromUtf8(e.what()));
+ }
+ m_audioActive = true;
+ m_hasBeenActive = true;
+ }
+}
+
+float VsAudioInterface::inputVolume()
+{
+ return m_inMultiplier;
+}
+
+float VsAudioInterface::outputVolume()
+{
+ return m_outMultiplier;
+}
+
+bool VsAudioInterface::inputMuted()
+{
+ return m_inMuted;
+}
+
+bool VsAudioInterface::outputMuted()
+{
+ return m_outMuted;
+}
+
+void VsAudioInterface::setInputVolume(float multiplier)
+{
+ m_inMultiplier = multiplier;
+ QSettings settings;
+ settings.beginGroup(QStringLiteral("Audio"));
+ settings.setValue(QStringLiteral("InMultiplier"), m_inMultiplier);
+ settings.endGroup();
+ emit updatedInputVolume(multiplier);
+}
+
+void VsAudioInterface::setOutputVolume(float multiplier)
+{
+ m_outMultiplier = multiplier;
+ QSettings settings;
+ settings.beginGroup(QStringLiteral("Audio"));
+ settings.setValue(QStringLiteral("OutMultiplier"), m_outMultiplier);
+ settings.endGroup();
+ emit updatedOutputVolume(multiplier);
+}
+
+void VsAudioInterface::setInputMuted(bool muted)
+{
+ m_inMuted = muted;
+ QSettings settings;
+ settings.beginGroup(QStringLiteral("Audio"));
+ settings.setValue(QStringLiteral("InMuted"), m_inMuted ? 1 : 0);
+ settings.endGroup();
+ emit updatedInputMuted(muted);
+}
+
+void VsAudioInterface::setOutputMuted(bool muted)
+{
+ m_outMuted = muted;
+ QSettings settings;
+ settings.beginGroup(QStringLiteral("Audio"));
+ settings.setValue(QStringLiteral("OutMuted"), m_outMuted ? 1 : 0);
+ settings.endGroup();
+ emit updatedOutputMuted(muted);
+}
diff --git a/src/gui/vsAudioInterface.h b/src/gui/vsAudioInterface.h
new file mode 100644
index 0000000..507bd16
--- /dev/null
+++ b/src/gui/vsAudioInterface.h
@@ -0,0 +1,143 @@
+//*****************************************************************
+/*
+ JackTrip: A System for High-Quality Audio Network Performance
+ over the Internet
+
+ Copyright (c) 2008-2022 Juan-Pablo Caceres, Chris Chafe.
+ SoundWIRE group at CCRMA, Stanford University.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ OTHER DEALINGS IN THE SOFTWARE.
+*/
+//*****************************************************************
+
+/**
+ * \file vsAudioInterface.h
+ * \author Matt Horton
+ * \date September 2022
+ */
+
+#ifndef VSDAUDIOINTERFACE_H
+#define VSDAUDIOINTERFACE_H
+
+#include <QDebug>
+#include <QObject>
+#include <QSharedPointer>
+#include <QString>
+
+#ifndef NO_JACK
+#include "../JackAudioInterface.h"
+#endif
+#ifdef RT_AUDIO
+#include "../RtAudioInterface.h"
+#endif
+
+#include "../Meter.h"
+#include "../Tone.h"
+#include "../Volume.h"
+#include "../jacktrip_globals.h"
+
+class VsAudioInterface : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(
+ float inputVolume READ inputVolume WRITE setInputVolume NOTIFY updatedInputVolume)
+ Q_PROPERTY(float outputVolume READ outputVolume WRITE setOutputVolume NOTIFY
+ updatedOutputVolume)
+
+ public:
+ // Constructor
+ explicit VsAudioInterface(
+ int NumChansIn = gDefaultNumInChannels, int NumChansOut = gDefaultNumOutChannels,
+ AudioInterface::audioBitResolutionT AudioBitResolution = AudioInterface::BIT16,
+ QObject* parent = nullptr);
+ ~VsAudioInterface();
+
+ // Public functions
+ void setupAudio();
+ void closeAudio();
+ void startProcess();
+ void addInputPlugin(ProcessPlugin* plugin);
+ void addOutputPlugin(ProcessPlugin* plugin);
+ int getNumInputChannels();
+ int getNumOutputChannels();
+ void setupPlugins();
+ float inputVolume();
+ float outputVolume();
+ bool inputMuted();
+ bool outputMuted();
+
+ enum audiointerfaceModeT {
+ JACK, ///< Jack Mode
+ RTAUDIO ///< RtAudio Mode
+ };
+
+ public slots:
+ void setInputDevice(QString deviceName);
+ void setOutputDevice(QString deviceName);
+ void setAudioInterfaceMode(bool useRtAudio);
+ void setInputVolume(float multiplier);
+ void setOutputVolume(float multiplier);
+ void setInputMuted(bool muted);
+ void setOutputMuted(bool muted);
+
+ signals:
+ void updatedInputVolume(float multiplier);
+ void updatedOutputVolume(float multiplier);
+ void updatedInputMuted(bool muted);
+ void updatedOutputMuted(bool muted);
+ void triggerPlayback();
+ void settingsUpdated();
+ void modeUpdated();
+ void newVolumeMeterMeasurements(QVector<float> values);
+ void errorToProcess(const QString& errorMessage);
+
+ private slots:
+ // void refreshAudioStream();
+ void replaceProcess();
+ void processMeterMeasurements(QVector<float> values);
+
+ private:
+ float m_inMultiplier = 1.0;
+ float m_outMultiplier = 1.0;
+ bool m_inMuted = false;
+ bool m_outMuted = false;
+ bool m_audioActive = false;
+ bool m_hasBeenActive = false;
+
+ // Needed in constructor
+ int m_numAudioChansIn; ///< Number of Audio Input Channels
+ int m_numAudioChansOut; ///< Number of Audio Output Channels
+ AudioInterface::audioBitResolutionT m_audioBitResolution; ///< Audio Bit Resolutions
+
+ QSharedPointer<AudioInterface> m_audioInterface;
+ uint32_t m_sampleRate; ///< Sample Rate
+ uint32_t m_deviceID; ///< RTAudio DeviceID
+ std::string m_inputDeviceName, m_outputDeviceName; ///< RTAudio device names
+ uint32_t m_audioBufferSize; ///< Audio buffer size to process on each callback
+ VsAudioInterface::audiointerfaceModeT m_audioInterfaceMode;
+ Meter* m_inputMeter;
+ Volume* m_inputVolumePlugin;
+ Volume* m_outputVolumePlugin;
+ Tone* m_outputTonePlugin;
+};
+
+#endif // VSDAUDIOINTERFACE_H
diff --git a/src/gui/vsConstants.h b/src/gui/vsConstants.h
new file mode 100644
index 0000000..b700015
--- /dev/null
+++ b/src/gui/vsConstants.h
@@ -0,0 +1,50 @@
+//*****************************************************************
+/*
+ JackTrip: A System for High-Quality Audio Network Performance
+ over the Internet
+
+ Copyright (c) 2008-2022 Juan-Pablo Caceres, Chris Chafe.
+ SoundWIRE group at CCRMA, Stanford University.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ OTHER DEALINGS IN THE SOFTWARE.
+*/
+//*****************************************************************
+
+/**
+ * \file vsConstants.h
+ * \author Nelson Wang
+ * \date Oct 2022
+ */
+
+#ifndef VSCONSTANTS_H
+#define VSCONSTANTS_H
+
+#include <QString>
+
+const QString AUTH_AUTHORIZE_URI = QStringLiteral("https://auth.jacktrip.org/authorize");
+const QString AUTH_TOKEN_URI = QStringLiteral("https://auth.jacktrip.org/oauth/token");
+const QString AUTH_AUDIENCE = QStringLiteral("https://api.jacktrip.org");
+const QString AUTH_CLIENT_ID = QStringLiteral("cROUJag0UVKDaJ6jRAKRzlVjKVFNU39I");
+const QString PROD_API_HOST = QStringLiteral("app.jacktrip.org");
+const QString TEST_API_HOST = QStringLiteral("test.jacktrip.org");
+
+#endif // VSCONSTANTS_H
diff --git a/src/gui/vsDevice.cpp b/src/gui/vsDevice.cpp
index 0f1468f..9b39725 100644
--- a/src/gui/vsDevice.cpp
+++ b/src/gui/vsDevice.cpp
@@ -40,7 +40,8 @@
#include <QDebug>
// Constructor
-VsDevice::VsDevice(QOAuth2AuthorizationCodeFlow* authenticator, QObject* parent)
+VsDevice::VsDevice(QOAuth2AuthorizationCodeFlow* authenticator, bool testMode,
+ QObject* parent)
: QObject(parent), m_authenticator(authenticator)
{
QSettings settings;
@@ -49,6 +50,69 @@ VsDevice::VsDevice(QOAuth2AuthorizationCodeFlow* authenticator, QObject* parent)
m_apiSecret = settings.value(QStringLiteral("ApiSecret"), "").toString();
m_appUUID = settings.value(QStringLiteral("AppUUID"), "").toString();
m_appID = settings.value(QStringLiteral("AppID"), "").toString();
+ settings.endGroup();
+ settings.beginGroup(QStringLiteral("Audio"));
+ m_captureVolume =
+ (float)settings.value(QStringLiteral("InMultiplier"), 1.0).toDouble();
+ m_captureMute = settings.value(QStringLiteral("InMuted"), false).toBool();
+ settings.endGroup();
+
+ m_sendVolumeTimer = new QTimer(this);
+ m_sendVolumeTimer->setSingleShot(true);
+ connect(m_sendVolumeTimer, &QTimer::timeout, this, &VsDevice::sendLevels);
+
+ // Determine which API host to use
+ m_apiHost = PROD_API_HOST;
+ if (testMode) {
+ m_apiHost = TEST_API_HOST;
+ }
+
+ // Set server levels to stored versions
+ QJsonObject json = {
+ {QLatin1String("captureVolume"), m_captureVolume * 100.0},
+ {QLatin1String("captureMute"), m_captureMute},
+ };
+ QJsonDocument request = QJsonDocument(json);
+
+ QNetworkReply* reply = m_authenticator->put(
+ QStringLiteral("https://%1/api/devices/%2").arg(m_apiHost, m_appID),
+ request.toJson());
+ connect(reply, &QNetworkReply::finished, this, [=]() {
+ // Got error
+ if (reply->error() != QNetworkReply::NoError) {
+ QVariant statusCode =
+ reply->attribute(QNetworkRequest::HttpStatusCodeAttribute);
+ if (!statusCode.isValid()) {
+ std::cout << "Error: " << reply->errorString().toStdString() << std::endl;
+ // TODO: Fix me
+ // emit authFailed();
+ reply->deleteLater();
+ return;
+ }
+ } else {
+ QByteArray response = reply->readAll();
+ QJsonDocument deviceState = QJsonDocument::fromJson(response);
+ float deviceCaptureVol =
+ (float)(deviceState.object()[QStringLiteral("captureVolume")].toDouble()
+ / 100.0);
+ float deviceCaptureMute =
+ deviceState.object()[QStringLiteral("captureMute")].toBool();
+
+ m_captureVolume = deviceCaptureVol;
+ emit updatedVolumeFromServer(m_captureVolume);
+
+ m_captureMute = deviceCaptureMute;
+ emit updatedMuteFromServer(m_captureMute);
+ }
+
+ QSettings settings;
+ settings.beginGroup(QStringLiteral("Audio"));
+ settings.setValue(QStringLiteral("InMultiplier"), m_captureVolume);
+ settings.setValue(QStringLiteral("InMuted"), m_captureMute);
+ settings.endGroup();
+
+ reply->deleteLater();
+ });
}
// registerApp idempotently registers an emulated device belonging to the current user
@@ -60,7 +124,7 @@ void VsDevice::registerApp()
// check if device exists
QNetworkReply* reply = m_authenticator->get(
- QStringLiteral("https://app.jacktrip.org/api/devices/%1").arg(m_appID));
+ QStringLiteral("https://%1/api/devices/%2").arg(m_apiHost, m_appID));
connect(reply, &QNetworkReply::finished, this, [=]() {
// Got error
if (reply->error() != QNetworkReply::NoError) {
@@ -116,7 +180,7 @@ void VsDevice::removeApp()
}
QNetworkReply* reply = m_authenticator->deleteResource(
- QStringLiteral("https://app.jacktrip.org/api/devices/%1").arg(m_appID));
+ QStringLiteral("https://%1/api/devices/%2").arg(m_apiHost, m_appID));
connect(reply, &QNetworkReply::finished, this, [=]() {
if (reply->error() != QNetworkReply::NoError) {
std::cout << "Error: " << reply->errorString().toStdString() << std::endl;
@@ -147,10 +211,10 @@ void VsDevice::removeApp()
void VsDevice::sendHeartbeat()
{
if (m_webSocket == nullptr) {
- m_webSocket = new VsWebSocket(
- QUrl(QStringLiteral("wss://app.jacktrip.org/api/devices/%1/heartbeat")
- .arg(m_appID)),
- m_authenticator->token(), m_apiPrefix, m_apiSecret);
+ m_webSocket =
+ new VsWebSocket(QUrl(QStringLiteral("wss://%1/api/devices/%2/heartbeat")
+ .arg(m_apiHost, m_appID)),
+ m_authenticator->token(), m_apiPrefix, m_apiSecret);
connect(m_webSocket, &VsWebSocket::textMessageReceived, this,
&VsDevice::onTextMessageReceived);
}
@@ -211,8 +275,7 @@ void VsDevice::sendHeartbeat()
} else {
// Send heartbeat via POST API
QNetworkReply* reply = m_authenticator->post(
- QStringLiteral("https://app.jacktrip.org/api/devices/%1/heartbeat")
- .arg(m_appID),
+ QStringLiteral("https://%1/api/devices/%2/heartbeat").arg(m_apiHost, m_appID),
request.toJson());
connect(reply, &QNetworkReply::finished, this, [=]() {
if (reply->error() != QNetworkReply::NoError) {
@@ -239,7 +302,30 @@ void VsDevice::setServerId(QString serverId)
};
QJsonDocument request = QJsonDocument(json);
QNetworkReply* reply = m_authenticator->put(
- QStringLiteral("https://app.jacktrip.org/api/devices/%1").arg(m_appID),
+ QStringLiteral("https://%1/api/devices/%2").arg(m_apiHost, m_appID),
+ request.toJson());
+ connect(reply, &QNetworkReply::finished, this, [=]() {
+ if (reply->error() != QNetworkReply::NoError) {
+ std::cout << "Error: " << reply->errorString().toStdString() << std::endl;
+ // TODO: Fix me
+ // emit authFailed();
+ reply->deleteLater();
+ return;
+ }
+ reply->deleteLater();
+ });
+}
+
+void VsDevice::sendLevels()
+{
+ // Add latest volume and mute values to heartbeat body
+ QJsonObject json = {
+ {QLatin1String("captureVolume"), (int)(m_captureVolume * 100)},
+ {QLatin1String("captureMute"), m_captureMute},
+ };
+ QJsonDocument request = QJsonDocument(json);
+ QNetworkReply* reply = m_authenticator->put(
+ QStringLiteral("https://%1/api/devices/%2").arg(m_apiHost, m_appID),
request.toJson());
connect(reply, &QNetworkReply::finished, this, [=]() {
if (reply->error() != QNetworkReply::NoError) {
@@ -279,7 +365,13 @@ JackTrip* VsDevice::initJackTrip([[maybe_unused]] bool useRtAudio,
m_jackTrip->setRemoteClientName(m_appID);
// increment m_bufferStrategy by 1 for array-index mapping
m_jackTrip->setBufferStrategy(bufferStrategy + 1);
- m_jackTrip->setBufferQueueLength(-500);
+ if (bufferStrategy == 2) {
+ // use -q auto3 for loss concealment
+ m_jackTrip->setBufferQueueLength(-3);
+ } else {
+ // use -q auto
+ m_jackTrip->setBufferQueueLength(-500);
+ }
m_jackTrip->setPeerAddress(studioInfo->host());
m_jackTrip->setPeerPorts(studioInfo->port());
m_jackTrip->setPeerHandshakePort(studioInfo->port());
@@ -353,6 +445,32 @@ void VsDevice::stopPinger()
}
}
+// updateVolume sets VsDevice's capture volume to the provided float
+void VsDevice::updateVolume(float multiplier)
+{
+ if (multiplier == m_captureVolume) {
+ return;
+ }
+ m_captureVolume = multiplier;
+
+ if (m_sendVolumeTimer) {
+ m_sendVolumeTimer->start(200);
+ }
+}
+
+// updateMute sets VsDevice's capture mute to the provided boolean
+void VsDevice::updateMute(bool muted)
+{
+ if (muted == m_captureMute) {
+ return;
+ }
+ m_captureMute = muted;
+
+ if (m_sendVolumeTimer) {
+ m_sendVolumeTimer->start(200);
+ }
+}
+
// terminateJackTrip is a slot intended to be triggered on jacktrip process signals
void VsDevice::terminateJackTrip()
{
@@ -375,6 +493,19 @@ void VsDevice::onTextMessageReceived(const QString& message)
m_pinger->start();
}
+ bool newMute = newState["captureMute"].toBool();
+ float newCaptureVolume = (float)(newState["captureVolume"].toDouble() / 100.0);
+
+ if (newCaptureVolume != m_captureVolume) {
+ m_captureVolume = newCaptureVolume;
+ emit updatedVolumeFromServer(m_captureVolume);
+ }
+
+ if (newMute != m_captureMute) {
+ m_captureMute = newMute;
+ emit updatedMuteFromServer(m_captureMute);
+ }
+
reconcileAgentConfig(newState);
}
@@ -440,7 +571,7 @@ void VsDevice::registerJTAsDevice()
QJsonDocument request = QJsonDocument(json);
QNetworkReply* reply = m_authenticator->post(
- QStringLiteral("https://app.jacktrip.org/api/devices"), request.toJson());
+ QStringLiteral("https://%1/api/devices").arg(m_apiHost), request.toJson());
connect(reply, &QNetworkReply::finished, this, [=]() {
if (reply->error() != QNetworkReply::NoError) {
std::cout << "Error: " << reply->errorString().toStdString() << std::endl;
diff --git a/src/gui/vsDevice.h b/src/gui/vsDevice.h
index 59b5341..760756b 100644
--- a/src/gui/vsDevice.h
+++ b/src/gui/vsDevice.h
@@ -40,12 +40,14 @@
#include <QObject>
#include <QString>
+#include <QTimer>
#include <QUuid>
#include <QtNetworkAuth>
#include <QtWebSockets>
#include "../JackTrip.h"
#include "../jacktrip_globals.h"
+#include "vsConstants.h"
#include "vsPinger.h"
#include "vsServerInfo.h"
#include "vsWebSocket.h"
@@ -56,7 +58,7 @@ class VsDevice : public QObject
public:
// Constructor
- explicit VsDevice(QOAuth2AuthorizationCodeFlow* authenticator,
+ explicit VsDevice(QOAuth2AuthorizationCodeFlow* authenticator, bool testMode,
QObject* parent = nullptr);
// Public functions
@@ -75,10 +77,17 @@ class VsDevice : public QObject
signals:
void updateNetworkStats(QJsonObject stats);
+ void updatedVolumeFromServer(float multiplier);
+ void updatedMuteFromServer(bool muted);
+
+ public slots:
+ void updateVolume(float multiplier);
+ void updateMute(bool muted);
private slots:
void terminateJackTrip();
void onTextMessageReceived(const QString& message);
+ void sendLevels();
private:
void registerJTAsDevice();
@@ -92,11 +101,15 @@ class VsDevice : public QObject
QString m_token;
QString m_apiPrefix;
QString m_apiSecret;
+ QString m_apiHost = PROD_API_HOST;
QJsonObject m_deviceAgentConfig;
VsWebSocket* m_webSocket = NULL;
QScopedPointer<JackTrip> m_jackTrip;
QOAuth2AuthorizationCodeFlow* m_authenticator;
QRandomGenerator m_randomizer;
+ float m_captureVolume = 1.0;
+ bool m_captureMute = false;
+ QTimer* m_sendVolumeTimer;
};
#endif // VSDEVICE_H
diff --git a/src/gui/vsWebSocket.cpp b/src/gui/vsWebSocket.cpp
index f099b8f..fa7b5f7 100644
--- a/src/gui/vsWebSocket.cpp
+++ b/src/gui/vsWebSocket.cpp
@@ -98,7 +98,7 @@ void VsWebSocket::onClosed()
m_connected = false;
}
-void VsWebSocket::onError(QAbstractSocket::SocketError error)
+void VsWebSocket::onError(QAbstractSocket::SocketError /*error*/)
{
// qDebug() << error;
m_error = true;
diff --git a/src/jacktrip_globals.h b/src/jacktrip_globals.h
index 03f51c8..64b553a 100644
--- a/src/jacktrip_globals.h
+++ b/src/jacktrip_globals.h
@@ -40,7 +40,7 @@
#include "AudioInterface.h"
-constexpr const char* const gVersion = "1.6.4"; ///< JackTrip version
+constexpr const char* const gVersion = "1.6.6"; ///< JackTrip version
//*******************************************************************************
/// \name Default Values
diff --git a/src/limiterdsp.h b/src/limiterdsp.h
index fc6f39e..6e942cd 100644
--- a/src/limiterdsp.h
+++ b/src/limiterdsp.h
@@ -1,7 +1,8 @@
/* ------------------------------------------------------------
name: "limiterdsp"
-Code generated with Faust 2.28.6 (https://faust.grame.fr)
-Compilation options: -lang cpp -inpl -scal -ftz 0
+Code generated with Faust 2.41.1 (https://faust.grame.fr)
+Compilation options: -a faust2header.cpp -lang cpp -i -inpl -cn limiterdsp -es 1 -mcd 16
+-single -ftz 0
------------------------------------------------------------ */
#ifndef __limiterdsp_H__
@@ -14,23 +15,23 @@ Compilation options: -lang cpp -inpl -scal -ftz 0
// aimed at creating a simple C++ header file (.h) containing a Faust DSP.
// See the Makefile for how to use it.
-/************************** BEGIN dsp.h **************************/
-/************************************************************************
+/************************** BEGIN dsp.h ********************************
FAUST Architecture File
- Copyright (C) 2003-2017 GRAME, Centre National de Creation Musicale
+ Copyright (C) 2003-2022 GRAME, Centre National de Creation Musicale
---------------------------------------------------------------------
- This Architecture section is free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 3 of
- the License, or (at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; If not, see <http://www.gnu.org/licenses/>.
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
EXCEPTION : As a special exception, you may create a larger work
that contains this FAUST architecture section and distribute
@@ -44,29 +45,111 @@ Compilation options: -lang cpp -inpl -scal -ftz 0
#include <string>
#include <vector>
+/************************************************************************
+ ************************************************************************
+ FAUST compiler
+ Copyright (C) 2003-2018 GRAME, Centre National de Creation Musicale
+ ---------------------------------------------------------------------
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ ************************************************************************
+ ************************************************************************/
+
+#ifndef __export__
+#define __export__
+
+#define FAUSTVERSION "2.41.1"
+
+// Use FAUST_API for code that is part of the external API but is also compiled in faust
+// and libfaust Use LIBFAUST_API for code that is compiled in faust and libfaust
+
+#ifdef _WIN32
+#pragma warning(disable : 4251)
+#ifdef FAUST_EXE
+#define FAUST_API
+#define LIBFAUST_API
+#elif FAUST_LIB
+#define FAUST_API __declspec(dllexport)
+#define LIBFAUST_API __declspec(dllexport)
+#else
+#define FAUST_API
+#define LIBFAUST_API
+#endif
+#else
+#ifdef FAUST_EXE
+#define FAUST_API
+#define LIBFAUST_API
+#else
+#define FAUST_API __attribute__((visibility("default")))
+#define LIBFAUST_API __attribute__((visibility("default")))
+#endif
+#endif
+
+#endif
+
#ifndef FAUSTFLOAT
#define FAUSTFLOAT float
#endif
-struct UI;
-struct Meta;
+struct FAUST_API UI;
+struct FAUST_API Meta;
/**
* DSP memory manager.
*/
-struct dsp_memory_manager {
+struct FAUST_API dsp_memory_manager {
virtual ~dsp_memory_manager() {}
+ /**
+ * Inform the Memory Manager with the number of expected memory zones.
+ * @param count - the number of expected memory zones
+ */
+ virtual void begin(size_t /*count*/) {}
+
+ /**
+ * Give the Memory Manager information on a given memory zone.
+ * @param size - the size in bytes of the memory zone
+ * @param reads - the number of Read access to the zone used to compute one frame
+ * @param writes - the number of Write access to the zone used to compute one frame
+ */
+ virtual void info(size_t /*size*/, size_t /*reads*/, size_t /*writes*/) {}
+
+ /**
+ * Inform the Memory Manager that all memory zones have been described,
+ * to possibly start a 'compute the best allocation strategy' step.
+ */
+ virtual void end() {}
+
+ /**
+ * Allocate a memory zone.
+ * @param size - the memory zone size in bytes
+ */
virtual void* allocate(size_t size) = 0;
- virtual void destroy(void* ptr) = 0;
+
+ /**
+ * Destroy a memory zone.
+ * @param ptr - the memory zone pointer to be deallocated
+ */
+ virtual void destroy(void* ptr) = 0;
};
/**
* Signal processor definition.
*/
-class dsp
+class FAUST_API dsp
{
public:
dsp() {}
@@ -86,7 +169,7 @@ class dsp
*/
virtual void buildUserInterface(UI* ui_interface) = 0;
- /* Returns the sample rate currently used by the instance */
+ /* Return the sample rate currently used by the instance */
virtual int getSampleRate() = 0;
/**
@@ -94,28 +177,28 @@ class dsp
* - static class 'classInit': static tables initialization
* - 'instanceInit': constants and instance state initialization
*
- * @param sample_rate - the sampling rate in Hertz
+ * @param sample_rate - the sampling rate in Hz
*/
virtual void init(int sample_rate) = 0;
/**
* Init instance state
*
- * @param sample_rate - the sampling rate in Hertz
+ * @param sample_rate - the sampling rate in Hz
*/
virtual void instanceInit(int sample_rate) = 0;
/**
* Init instance constant state
*
- * @param sample_rate - the sampling rate in Hertz
+ * @param sample_rate - the sampling rate in Hz
*/
virtual void instanceConstants(int sample_rate) = 0;
/* Init default control parameters values */
virtual void instanceResetUserInterface() = 0;
- /* Init instance state (delay lines...) */
+ /* Init instance state (like delay lines...) but keep the control parameter values */
virtual void instanceClear() = 0;
/**
@@ -167,7 +250,7 @@ class dsp
* Generic DSP decorator.
*/
-class decorator_dsp : public dsp
+class FAUST_API decorator_dsp : public dsp
{
protected:
dsp* fDSP;
@@ -206,10 +289,11 @@ class decorator_dsp : public dsp
};
/**
- * DSP factory class.
+ * DSP factory class, used with LLVM and Interpreter backends
+ * to create DSP instances from a compiled DSP program.
*/
-class dsp_factory
+class FAUST_API dsp_factory
{
protected:
// So that to force sub-classes to use deleteDSPFactory(dsp_factory* factory);
@@ -229,75 +313,114 @@ class dsp_factory
virtual dsp_memory_manager* getMemoryManager() = 0;
};
-/**
- * On Intel set FZ (Flush to Zero) and DAZ (Denormals Are Zero)
- * flags to avoid costly denormals.
- */
+// Denormal handling
-#ifdef __SSE__
+#if defined(__SSE__)
#include <xmmintrin.h>
-#ifdef __SSE2__
-#define AVOIDDENORMALS _mm_setcsr(_mm_getcsr() | 0x8040)
+#endif
+
+class FAUST_API ScopedNoDenormals
+{
+ private:
+ intptr_t fpsr;
+
+ void setFpStatusRegister(intptr_t fpsr_aux) noexcept
+ {
+#if defined(__arm64__) || defined(__aarch64__)
+ asm volatile("msr fpcr, %0" : : "ri"(fpsr_aux));
+#elif defined(__SSE__)
+ _mm_setcsr(static_cast<uint32_t>(fpsr_aux));
+#endif
+ }
+
+ void getFpStatusRegister() noexcept
+ {
+#if defined(__arm64__) || defined(__aarch64__)
+ asm volatile("mrs %0, fpcr" : "=r"(fpsr));
+#elif defined(__SSE__)
+ fpsr = static_cast<intptr_t>(_mm_getcsr());
+#endif
+ }
+
+ public:
+ ScopedNoDenormals() noexcept
+ {
+#if defined(__arm64__) || defined(__aarch64__)
+ intptr_t mask = (1 << 24 /* FZ */);
+#else
+#if defined(__SSE__)
+#if defined(__SSE2__)
+ intptr_t mask = 0x8040;
#else
-#define AVOIDDENORMALS _mm_setcsr(_mm_getcsr() | 0x8000)
+ intptr_t mask = 0x8000;
#endif
#else
-#define AVOIDDENORMALS
+ intptr_t mask = 0x0000;
#endif
-
#endif
-/************************** END dsp.h **************************/
+ getFpStatusRegister();
+ setFpStatusRegister(fpsr | mask);
+ }
-/************************** BEGIN APIUI.h **************************/
-/************************************************************************
- FAUST Architecture File
- Copyright (C) 2003-2017 GRAME, Centre National de Creation Musicale
- ---------------------------------------------------------------------
- This Architecture section is free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 3 of
- the License, or (at your option) any later version.
+ ~ScopedNoDenormals() noexcept { setFpStatusRegister(fpsr); }
+};
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+#define AVOIDDENORMALS ScopedNoDenormals();
- You should have received a copy of the GNU General Public License
- along with this program; If not, see <http://www.gnu.org/licenses/>.
+#endif
- EXCEPTION : As a special exception, you may create a larger work
- that contains this FAUST architecture section and distribute
- that work under terms of your choice, so long as this FAUST
- architecture section is not modified.
- ************************************************************************/
+/************************** END dsp.h **************************/
+/************************** BEGIN APIUI.h *****************************
+FAUST Architecture File
+Copyright (C) 2003-2022 GRAME, Centre National de Creation Musicale
+---------------------------------------------------------------------
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+EXCEPTION : As a special exception, you may create a larger work
+that contains this FAUST architecture section and distribute
+that work under terms of your choice, so long as this FAUST
+architecture section is not modified.
+************************************************************************/
#ifndef API_UI_H
#define API_UI_H
-#include <iostream>
+#include <stdio.h>
+
#include <map>
#include <sstream>
#include <string>
#include <vector>
-/************************** BEGIN meta.h **************************/
-/************************************************************************
+/************************** BEGIN meta.h *******************************
FAUST Architecture File
- Copyright (C) 2003-2017 GRAME, Centre National de Creation Musicale
+ Copyright (C) 2003-2022 GRAME, Centre National de Creation Musicale
---------------------------------------------------------------------
- This Architecture section is free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 3 of
- the License, or (at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; If not, see <http://www.gnu.org/licenses/>.
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
EXCEPTION : As a special exception, you may create a larger work
that contains this FAUST architecture section and distribute
@@ -308,36 +431,40 @@ class dsp_factory
#ifndef __meta__
#define __meta__
-struct Meta {
- virtual ~Meta(){};
+/**
+ The base class of Meta handler to be used in dsp::metadata(Meta* m) method to retrieve
+ (key, value) metadata.
+ */
+struct FAUST_API Meta {
+ virtual ~Meta() {}
virtual void declare(const char* key, const char* value) = 0;
};
#endif
/************************** END meta.h **************************/
-/************************** BEGIN UI.h **************************/
-/************************************************************************
+/************************** BEGIN UI.h *****************************
FAUST Architecture File
- Copyright (C) 2003-2020 GRAME, Centre National de Creation Musicale
+ Copyright (C) 2003-2022 GRAME, Centre National de Creation Musicale
---------------------------------------------------------------------
- This Architecture section is free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 3 of
- the License, or (at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; If not, see <http://www.gnu.org/licenses/>.
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
EXCEPTION : As a special exception, you may create a larger work
that contains this FAUST architecture section and distribute
that work under terms of your choice, so long as this FAUST
architecture section is not modified.
- ************************************************************************/
+ ********************************************************************/
#ifndef __UI_H__
#define __UI_H__
@@ -356,7 +483,7 @@ struct Meta {
struct Soundfile;
template<typename REAL>
-struct UIReal {
+struct FAUST_API UIReal {
UIReal() {}
virtual ~UIReal() {}
@@ -387,38 +514,41 @@ struct UIReal {
// -- soundfiles
- virtual void addSoundfile(const char* label, const char* filename,
- Soundfile** sf_zone) = 0;
+ virtual void addSoundfile(const char* /*label*/, const char* /*filename*/,
+ Soundfile** /*sf_zone*/) = 0;
// -- metadata declarations
virtual void declare(REAL* /*zone*/, const char* /*key*/, const char* /*val*/) {}
+
+ // To be used by LLVM client
+ virtual int sizeOfFAUSTFLOAT() { return sizeof(FAUSTFLOAT); }
};
-struct UI : public UIReal<FAUSTFLOAT> {
+struct FAUST_API UI : public UIReal<FAUSTFLOAT> {
UI() {}
virtual ~UI() {}
};
#endif
/************************** END UI.h **************************/
-/************************** BEGIN PathBuilder.h **************************/
-/************************************************************************
+/************************** BEGIN PathBuilder.h **************************
FAUST Architecture File
- Copyright (C) 2003-2017 GRAME, Centre National de Creation Musicale
+ Copyright (C) 2003-2022 GRAME, Centre National de Creation Musicale
---------------------------------------------------------------------
- This Architecture section is free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 3 of
- the License, or (at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; If not, see <http://www.gnu.org/licenses/>.
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
EXCEPTION : As a special exception, you may create a larger work
that contains this FAUST architecture section and distribute
@@ -426,10 +556,13 @@ struct UI : public UIReal<FAUSTFLOAT> {
architecture section is not modified.
************************************************************************/
-#ifndef FAUST_PATHBUILDER_H
-#define FAUST_PATHBUILDER_H
+#ifndef __PathBuilder__
+#define __PathBuilder__
#include <algorithm>
+#include <map>
+#include <regex>
+#include <set>
#include <string>
#include <vector>
@@ -438,113 +571,266 @@ struct UI : public UIReal<FAUSTFLOAT> {
* Helper class to build complete hierarchical path for UI items.
******************************************************************************/
-class PathBuilder
+class FAUST_API PathBuilder
{
protected:
std::vector<std::string> fControlsLevel;
+ std::vector<std::string> fFullPaths;
+ std::map<std::string, std::string> fFull2Short; // filled by computeShortNames()
+
+ /**
+ * @brief check if a character is acceptable for an ID
+ *
+ * @param c
+ * @return true is the character is acceptable for an ID
+ */
+ bool isIDChar(char c) const
+ {
+ return ((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z'))
+ || ((c >= '0') && (c <= '9'));
+ }
+
+ /**
+ * @brief remove all "/0x00" parts
+ *
+ * @param src
+ * @return modified string
+ */
+ std::string remove0x00(const std::string& src) const
+ {
+ return std::regex_replace(src, std::regex("/0x00"), "");
+ }
+
+ /**
+ * @brief replace all non ID char with '_' (one '_' may replace several non ID char)
+ *
+ * @param src
+ * @return modified string
+ */
+ std::string str2ID(const std::string& src) const
+ {
+ std::string dst;
+ bool need_underscore = false;
+ for (char c : src) {
+ if (isIDChar(c) || (c == '/')) {
+ if (need_underscore) {
+ dst.push_back('_');
+ need_underscore = false;
+ }
+ dst.push_back(c);
+ } else {
+ need_underscore = true;
+ }
+ }
+ return dst;
+ }
+
+ /**
+ * @brief Keep only the last n slash-parts
+ *
+ * @param src
+ * @param n : 1 indicates the last slash-part
+ * @return modified string
+ */
+ std::string cut(const std::string& src, int n) const
+ {
+ std::string rdst;
+ for (int i = int(src.length()) - 1; i >= 0; i--) {
+ char c = src[i];
+ if (c != '/') {
+ rdst.push_back(c);
+ } else if (n == 1) {
+ std::string dst;
+ for (int j = int(rdst.length()) - 1; j >= 0; j--) {
+ dst.push_back(rdst[j]);
+ }
+ return dst;
+ } else {
+ n--;
+ rdst.push_back(c);
+ }
+ }
+ return src;
+ }
+
+ void addFullPath(const std::string& label) { fFullPaths.push_back(buildPath(label)); }
+
+ /**
+ * @brief Compute the mapping between full path and short names
+ */
+ void computeShortNames()
+ {
+ std::vector<std::string>
+ uniquePaths; // all full paths transformed but made unique with a prefix
+ std::map<std::string, std::string>
+ unique2full; // all full paths transformed but made unique with a prefix
+ char num_buffer[16];
+ int pnum = 0;
+
+ for (const auto& s : fFullPaths) {
+ sprintf(num_buffer, "%d", pnum++);
+ std::string u = "/P" + std::string(num_buffer) + str2ID(remove0x00(s));
+ uniquePaths.push_back(u);
+ unique2full[u] = s; // remember the full path associated to a unique path
+ }
+
+ std::map<std::string, int> uniquePath2level; // map path to level
+ for (const auto& s : uniquePaths)
+ uniquePath2level[s] = 1; // we init all levels to 1
+ bool have_collisions = true;
+
+ while (have_collisions) {
+ // compute collision list
+ std::set<std::string> collisionSet;
+ std::map<std::string, std::string> short2full;
+ have_collisions = false;
+ for (const auto& it : uniquePath2level) {
+ std::string u = it.first;
+ int n = it.second;
+ std::string shortName = cut(u, n);
+ auto p = short2full.find(shortName);
+ if (p == short2full.end()) {
+ // no collision
+ short2full[shortName] = u;
+ } else {
+ // we have a collision, add the two paths to the collision set
+ have_collisions = true;
+ collisionSet.insert(u);
+ collisionSet.insert(p->second);
+ }
+ }
+ for (const auto& s : collisionSet)
+ uniquePath2level[s]++; // increase level of colliding path
+ }
+
+ for (const auto& it : uniquePath2level) {
+ std::string u = it.first;
+ int n = it.second;
+ std::string shortName = replaceCharList(cut(u, n), {'/'}, '_');
+ fFull2Short[unique2full[u]] = shortName;
+ }
+ }
+
+ std::string replaceCharList(const std::string& str, const std::vector<char>& ch1,
+ char ch2)
+ {
+ auto beg = ch1.begin();
+ auto end = ch1.end();
+ std::string res = str;
+ for (size_t i = 0; i < str.length(); ++i) {
+ if (std::find(beg, end, str[i]) != end)
+ res[i] = ch2;
+ }
+ return res;
+ }
public:
PathBuilder() {}
virtual ~PathBuilder() {}
+ // Return true for the first level of groups
+ bool pushLabel(const std::string& label)
+ {
+ fControlsLevel.push_back(label);
+ return fControlsLevel.size() == 1;
+ }
+
+ // Return true for the last level of groups
+ bool popLabel()
+ {
+ fControlsLevel.pop_back();
+ return fControlsLevel.size() == 0;
+ }
+
std::string buildPath(const std::string& label)
{
std::string res = "/";
for (size_t i = 0; i < fControlsLevel.size(); i++) {
- res += fControlsLevel[i];
- res += "/";
+ res = res + fControlsLevel[i] + "/";
}
res += label;
- std::replace(res.begin(), res.end(), ' ', '_');
- return res;
- }
-
- std::string buildLabel(std::string label)
- {
- std::replace(label.begin(), label.end(), ' ', '_');
- return label;
+ return replaceCharList(
+ res, {' ', '#', '*', ',', '?', '[', ']', '{', '}', '(', ')'}, '_');
}
-
- void pushLabel(const std::string& label) { fControlsLevel.push_back(label); }
- void popLabel() { fControlsLevel.pop_back(); }
};
-#endif // FAUST_PATHBUILDER_H
+#endif // __PathBuilder__
/************************** END PathBuilder.h **************************/
-/************************** BEGIN ValueConverter.h **************************/
-/************************************************************************
+/************************** BEGIN ValueConverter.h ********************
FAUST Architecture File
- Copyright (C) 2003-2017 GRAME, Centre National de Creation Musicale
+ Copyright (C) 2003-2022 GRAME, Centre National de Creation Musicale
---------------------------------------------------------------------
- This Architecture section is free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 3 of
- the License, or (at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; If not, see <http://www.gnu.org/licenses/>.
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
EXCEPTION : As a special exception, you may create a larger work
that contains this FAUST architecture section and distribute
that work under terms of your choice, so long as this FAUST
architecture section is not modified.
- ************************************************************************/
+ ********************************************************************/
#ifndef __ValueConverter__
#define __ValueConverter__
/***************************************************************************************
- ValueConverter.h
- (GRAME, Copyright 2015-2019)
+ ValueConverter.h
+ (GRAME, Copyright 2015-2019)
-Set of conversion objects used to map user interface values (for example a gui slider
-delivering values between 0 and 1) to faust values (for example a vslider between
-20 and 20000) using a log scale.
+ Set of conversion objects used to map user interface values (for example a gui slider
+ delivering values between 0 and 1) to faust values (for example a vslider between
+ 20 and 20000) using a log scale.
--- Utilities
+ -- Utilities
-Range(lo,hi) : clip a value x between lo and hi
-Interpolator(lo,hi,v1,v2) : Maps a value x between lo and hi to a value y between v1 and
+ Range(lo,hi) : clip a value x between lo and hi
+ Interpolator(lo,hi,v1,v2) : Maps a value x between lo and hi to a value y between v1 and
v2 Interpolator3pt(lo,mi,hi,v1,vm,v2) : Map values between lo mid hi to values between v1
vm v2
--- Value Converters
+ -- Value Converters
-ValueConverter::ui2faust(x)
-ValueConverter::faust2ui(x)
+ ValueConverter::ui2faust(x)
+ ValueConverter::faust2ui(x)
--- ValueConverters used for sliders depending of the scale
+ -- ValueConverters used for sliders depending of the scale
-LinearValueConverter(umin, umax, fmin, fmax)
-LinearValueConverter2(lo, mi, hi, v1, vm, v2) using 2 segments
-LogValueConverter(umin, umax, fmin, fmax)
-ExpValueConverter(umin, umax, fmin, fmax)
+ LinearValueConverter(umin, umax, fmin, fmax)
+ LinearValueConverter2(lo, mi, hi, v1, vm, v2) using 2 segments
+ LogValueConverter(umin, umax, fmin, fmax)
+ ExpValueConverter(umin, umax, fmin, fmax)
--- ValueConverters used for accelerometers based on 3 points
+ -- ValueConverters used for accelerometers based on 3 points
-AccUpConverter(amin, amid, amax, fmin, fmid, fmax) -- curve 0
-AccDownConverter(amin, amid, amax, fmin, fmid, fmax) -- curve 1
-AccUpDownConverter(amin, amid, amax, fmin, fmid, fmax) -- curve 2
-AccDownUpConverter(amin, amid, amax, fmin, fmid, fmax) -- curve 3
+ AccUpConverter(amin, amid, amax, fmin, fmid, fmax) -- curve 0
+ AccDownConverter(amin, amid, amax, fmin, fmid, fmax) -- curve 1
+ AccUpDownConverter(amin, amid, amax, fmin, fmid, fmax) -- curve 2
+ AccDownUpConverter(amin, amid, amax, fmin, fmid, fmax) -- curve 3
--- lists of ZoneControl are used to implement accelerometers metadata for each axes
+ -- lists of ZoneControl are used to implement accelerometers metadata for each axes
-ZoneControl(zone, valueConverter) : a zone with an accelerometer data converter
+ ZoneControl(zone, valueConverter) : a zone with an accelerometer data converter
--- ZoneReader are used to implement screencolor metadata
+ -- ZoneReader are used to implement screencolor metadata
-ZoneReader(zone, valueConverter) : a zone with a data converter
+ ZoneReader(zone, valueConverter) : a zone with a data converter
****************************************************************************************/
+#include <assert.h>
+#include <float.h>
+
#include <algorithm> // std::max
-#include <cassert>
-#include <cfloat>
#include <cmath>
#include <vector>
@@ -552,12 +838,12 @@ ZoneReader(zone, valueConverter) : a zone with a data converter
// Interpolator(lo,hi,v1,v2)
// Maps a value x between lo and hi to a value y between v1 and v2
// y = v1 + (x-lo)/(hi-lo)*(v2-v1)
-// y = v1 + (x-lo) * coef with coef = (v2-v1)/(hi-lo)
+// y = v1 + (x-lo) * coef with coef = (v2-v1)/(hi-lo)
// y = v1 + x*coef - lo*coef
// y = v1 - lo*coef + x*coef
-// y = offset + x*coef with offset = v1 - lo*coef
+// y = offset + x*coef with offset = v1 - lo*coef
//--------------------------------------------------------------------------------------
-class Interpolator
+class FAUST_API Interpolator
{
private:
//--------------------------------------------------------------------------------------
@@ -608,7 +894,7 @@ class Interpolator
// Interpolator3pt(lo,mi,hi,v1,vm,v2)
// Map values between lo mid hi to values between v1 vm v2
//--------------------------------------------------------------------------------------
-class Interpolator3pt
+class FAUST_API Interpolator3pt
{
private:
Interpolator fSegment1;
@@ -632,19 +918,19 @@ class Interpolator3pt
//--------------------------------------------------------------------------------------
// Abstract ValueConverter class. Converts values between UI and Faust representations
//--------------------------------------------------------------------------------------
-class ValueConverter
+class FAUST_API ValueConverter
{
public:
virtual ~ValueConverter() {}
- virtual double ui2faust(double x) = 0;
- virtual double faust2ui(double x) = 0;
+ virtual double ui2faust(double x) { return x; };
+ virtual double faust2ui(double x) { return x; };
};
//--------------------------------------------------------------------------------------
// A converter than can be updated
//--------------------------------------------------------------------------------------
-class UpdatableValueConverter : public ValueConverter
+class FAUST_API UpdatableValueConverter : public ValueConverter
{
protected:
bool fActive;
@@ -664,7 +950,7 @@ class UpdatableValueConverter : public ValueConverter
//--------------------------------------------------------------------------------------
// Linear conversion between ui and Faust values
//--------------------------------------------------------------------------------------
-class LinearValueConverter : public ValueConverter
+class FAUST_API LinearValueConverter : public ValueConverter
{
private:
Interpolator fUI2F;
@@ -684,7 +970,7 @@ class LinearValueConverter : public ValueConverter
//--------------------------------------------------------------------------------------
// Two segments linear conversion between ui and Faust values
//--------------------------------------------------------------------------------------
-class LinearValueConverter2 : public UpdatableValueConverter
+class FAUST_API LinearValueConverter2 : public UpdatableValueConverter
{
private:
Interpolator3pt fUI2F;
@@ -720,7 +1006,7 @@ class LinearValueConverter2 : public UpdatableValueConverter
//--------------------------------------------------------------------------------------
// Logarithmic conversion between ui and Faust values
//--------------------------------------------------------------------------------------
-class LogValueConverter : public LinearValueConverter
+class FAUST_API LogValueConverter : public LinearValueConverter
{
public:
LogValueConverter(double umin, double umax, double fmin, double fmax)
@@ -742,7 +1028,7 @@ class LogValueConverter : public LinearValueConverter
//--------------------------------------------------------------------------------------
// Exponential conversion between ui and Faust values
//--------------------------------------------------------------------------------------
-class ExpValueConverter : public LinearValueConverter
+class FAUST_API ExpValueConverter : public LinearValueConverter
{
public:
ExpValueConverter(double umin, double umax, double fmin, double fmax)
@@ -765,7 +1051,7 @@ class ExpValueConverter : public LinearValueConverter
// Convert accelerometer or gyroscope values to Faust values
// Using an Up curve (curve 0)
//--------------------------------------------------------------------------------------
-class AccUpConverter : public UpdatableValueConverter
+class FAUST_API AccUpConverter : public UpdatableValueConverter
{
private:
Interpolator3pt fA2F;
@@ -801,7 +1087,7 @@ class AccUpConverter : public UpdatableValueConverter
// Convert accelerometer or gyroscope values to Faust values
// Using a Down curve (curve 1)
//--------------------------------------------------------------------------------------
-class AccDownConverter : public UpdatableValueConverter
+class FAUST_API AccDownConverter : public UpdatableValueConverter
{
private:
Interpolator3pt fA2F;
@@ -837,7 +1123,7 @@ class AccDownConverter : public UpdatableValueConverter
// Convert accelerometer or gyroscope values to Faust values
// Using an Up-Down curve (curve 2)
//--------------------------------------------------------------------------------------
-class AccUpDownConverter : public UpdatableValueConverter
+class FAUST_API AccUpDownConverter : public UpdatableValueConverter
{
private:
Interpolator3pt fA2F;
@@ -874,7 +1160,7 @@ class AccUpDownConverter : public UpdatableValueConverter
// Convert accelerometer or gyroscope values to Faust values
// Using a Down-Up curve (curve 3)
//--------------------------------------------------------------------------------------
-class AccDownUpConverter : public UpdatableValueConverter
+class FAUST_API AccDownUpConverter : public UpdatableValueConverter
{
private:
Interpolator3pt fA2F;
@@ -910,7 +1196,7 @@ class AccDownUpConverter : public UpdatableValueConverter
//--------------------------------------------------------------------------------------
// Base class for ZoneControl
//--------------------------------------------------------------------------------------
-class ZoneControl
+class FAUST_API ZoneControl
{
protected:
FAUSTFLOAT* fZone;
@@ -939,7 +1225,7 @@ class ZoneControl
//--------------------------------------------------------------------------------------
// Useful to implement accelerometers metadata as a list of ZoneControl for each axes
//--------------------------------------------------------------------------------------
-class ConverterZoneControl : public ZoneControl
+class FAUST_API ConverterZoneControl : public ZoneControl
{
protected:
ValueConverter* fValueConverter;
@@ -954,7 +1240,10 @@ class ConverterZoneControl : public ZoneControl
delete fValueConverter;
} // Assuming fValueConverter is not kept elsewhere...
- virtual void update(double v) const { *fZone = fValueConverter->ui2faust(v); }
+ virtual void update(double v) const
+ {
+ *fZone = FAUSTFLOAT(fValueConverter->ui2faust(v));
+ }
ValueConverter* getConverter() { return fValueConverter; }
};
@@ -963,7 +1252,7 @@ class ConverterZoneControl : public ZoneControl
// Association of a zone and a four value converter, each one for each possible curve.
// Useful to implement accelerometers metadata as a list of ZoneControl for each axes
//--------------------------------------------------------------------------------------
-class CurveZoneControl : public ZoneControl
+class FAUST_API CurveZoneControl : public ZoneControl
{
private:
std::vector<UpdatableValueConverter*> fValueConverters;
@@ -986,15 +1275,14 @@ class CurveZoneControl : public ZoneControl
}
virtual ~CurveZoneControl()
{
- std::vector<UpdatableValueConverter*>::iterator it;
- for (it = fValueConverters.begin(); it != fValueConverters.end(); it++) {
- delete (*it);
+ for (const auto& it : fValueConverters) {
+ delete it;
}
}
void update(double v) const
{
if (fValueConverters[fCurve]->getActive())
- *fZone = fValueConverters[fCurve]->ui2faust(v);
+ *fZone = FAUSTFLOAT(fValueConverters[fCurve]->ui2faust(v));
}
void setMappingValues(int curve, double amin, double amid, double amax, double min,
@@ -1011,16 +1299,15 @@ class CurveZoneControl : public ZoneControl
void setActive(bool on_off)
{
- std::vector<UpdatableValueConverter*>::iterator it;
- for (it = fValueConverters.begin(); it != fValueConverters.end(); it++) {
- (*it)->setActive(on_off);
+ for (const auto& it : fValueConverters) {
+ it->setActive(on_off);
}
}
int getCurve() { return fCurve; }
};
-class ZoneReader
+class FAUST_API ZoneReader
{
private:
FAUSTFLOAT* fZone;
@@ -1040,6 +1327,8 @@ class ZoneReader
#endif
/************************** END ValueConverter.h **************************/
+typedef unsigned int uint;
+
class APIUI
: public PathBuilder
, public Meta
@@ -1055,22 +1344,42 @@ class APIUI
kHBargraph,
kVBargraph
};
+ enum Type { kAcc = 0, kGyr = 1, kNoType };
protected:
- enum { kLin = 0, kLog = 1, kExp = 2 };
-
- int fNumParameters;
- std::vector<std::string> fPaths;
- std::vector<std::string> fLabels;
- std::map<std::string, int> fPathMap;
- std::map<std::string, int> fLabelMap;
- std::vector<ValueConverter*> fConversion;
- std::vector<FAUSTFLOAT*> fZone;
- std::vector<FAUSTFLOAT> fInit;
- std::vector<FAUSTFLOAT> fMin;
- std::vector<FAUSTFLOAT> fMax;
- std::vector<FAUSTFLOAT> fStep;
- std::vector<ItemType> fItemType;
+ enum Mapping { kLin = 0, kLog = 1, kExp = 2 };
+
+ struct Item {
+ std::string fLabel;
+ std::string fShortname;
+ std::string fPath;
+ ValueConverter* fConversion;
+ FAUSTFLOAT* fZone;
+ FAUSTFLOAT fInit;
+ FAUSTFLOAT fMin;
+ FAUSTFLOAT fMax;
+ FAUSTFLOAT fStep;
+ ItemType fItemType;
+
+ Item(const std::string& label, const std::string& short_name,
+ const std::string& path, ValueConverter* conversion, FAUSTFLOAT* zone,
+ FAUSTFLOAT init, FAUSTFLOAT min, FAUSTFLOAT max, FAUSTFLOAT step,
+ ItemType item_type)
+ : fLabel(label)
+ , fShortname(short_name)
+ , fPath(path)
+ , fConversion(conversion)
+ , fZone(zone)
+ , fInit(init)
+ , fMin(min)
+ , fMax(max)
+ , fStep(step)
+ , fItemType(item_type)
+ {
+ }
+ };
+ std::vector<Item> fItems;
+
std::vector<std::map<std::string, std::string> > fMetaData;
std::vector<ZoneControl*> fAcc[3];
std::vector<ZoneControl*> fGyr[3];
@@ -1097,33 +1406,31 @@ class APIUI
ItemType type)
{
std::string path = buildPath(label);
- fPathMap[path] = fLabelMap[label] = fNumParameters++;
- fPaths.push_back(path);
- fLabels.push_back(label);
- fZone.push_back(zone);
- fInit.push_back(init);
- fMin.push_back(min);
- fMax.push_back(max);
- fStep.push_back(step);
- fItemType.push_back(type);
+ fFullPaths.push_back(path);
// handle scale metadata
+ ValueConverter* converter = nullptr;
switch (fCurrentScale) {
case kLin:
- fConversion.push_back(new LinearValueConverter(0, 1, min, max));
+ converter = new LinearValueConverter(0, 1, min, max);
break;
case kLog:
- fConversion.push_back(new LogValueConverter(0, 1, min, max));
+ converter = new LogValueConverter(0, 1, min, max);
break;
case kExp:
- fConversion.push_back(new ExpValueConverter(0, 1, min, max));
+ converter = new ExpValueConverter(0, 1, min, max);
break;
}
fCurrentScale = kLin;
+ fItems.push_back(
+ Item(label, "", path, converter, zone, init, min, max, step, type));
+
if (fCurrentAcc.size() > 0 && fCurrentGyr.size() > 0) {
- std::cerr << "warning : 'acc' and 'gyr' metadata used for the same " << label
- << " parameter !!\n";
+ fprintf(
+ stderr,
+ "warning : 'acc' and 'gyr' metadata used for the same %s parameter !!\n",
+ label);
}
// handle acc metadata "...[acc : <axe> <curve> <amin> <amid> <amax>]..."
@@ -1138,7 +1445,7 @@ class APIUI
fAcc[axe].push_back(
new CurveZoneControl(zone, curve, amin, amid, amax, min, init, max));
} else {
- std::cerr << "incorrect acc metadata : " << fCurrentAcc << std::endl;
+ fprintf(stderr, "incorrect acc metadata : %s \n", fCurrentAcc.c_str());
}
fCurrentAcc = "";
}
@@ -1155,31 +1462,31 @@ class APIUI
fGyr[axe].push_back(
new CurveZoneControl(zone, curve, amin, amid, amax, min, init, max));
} else {
- std::cerr << "incorrect gyr metadata : " << fCurrentGyr << std::endl;
+ fprintf(stderr, "incorrect gyr metadata : %s \n", fCurrentGyr.c_str());
}
fCurrentGyr = "";
}
// handle screencolor metadata "...[screencolor:red|green|blue|white]..."
if (fCurrentColor.size() > 0) {
- if ((fCurrentColor == "red") && (fRedReader == 0)) {
+ if ((fCurrentColor == "red") && (fRedReader == nullptr)) {
fRedReader = new ZoneReader(zone, min, max);
fHasScreenControl = true;
- } else if ((fCurrentColor == "green") && (fGreenReader == 0)) {
+ } else if ((fCurrentColor == "green") && (fGreenReader == nullptr)) {
fGreenReader = new ZoneReader(zone, min, max);
fHasScreenControl = true;
- } else if ((fCurrentColor == "blue") && (fBlueReader == 0)) {
+ } else if ((fCurrentColor == "blue") && (fBlueReader == nullptr)) {
fBlueReader = new ZoneReader(zone, min, max);
fHasScreenControl = true;
- } else if ((fCurrentColor == "white") && (fRedReader == 0)
- && (fGreenReader == 0) && (fBlueReader == 0)) {
+ } else if ((fCurrentColor == "white") && (fRedReader == nullptr)
+ && (fGreenReader == nullptr) && (fBlueReader == nullptr)) {
fRedReader = new ZoneReader(zone, min, max);
fGreenReader = new ZoneReader(zone, min, max);
fBlueReader = new ZoneReader(zone, min, max);
fHasScreenControl = true;
} else {
- std::cerr << "incorrect screencolor metadata : " << fCurrentColor
- << std::endl;
+ fprintf(stderr, "incorrect screencolor metadata : %s \n",
+ fCurrentColor.c_str());
}
}
fCurrentColor = "";
@@ -1190,7 +1497,7 @@ class APIUI
int getZoneIndex(std::vector<ZoneControl*>* table, int p, int val)
{
- FAUSTFLOAT* zone = fZone[p];
+ FAUSTFLOAT* zone = fItems[uint(p)].fZone;
for (size_t i = 0; i < table[val].size(); i++) {
if (zone == table[val][i]->getZone())
return int(i);
@@ -1207,11 +1514,11 @@ class APIUI
// Deactivates everywhere..
if (id1 != -1)
- table[0][id1]->setActive(false);
+ table[0][uint(id1)]->setActive(false);
if (id2 != -1)
- table[1][id2]->setActive(false);
+ table[1][uint(id2)]->setActive(false);
if (id3 != -1)
- table[2][id3]->setActive(false);
+ table[2][uint(id3)]->setActive(false);
if (val == -1) { // Means: no more mapping...
// So stay all deactivated...
@@ -1219,14 +1526,16 @@ class APIUI
int id4 = getZoneIndex(table, p, val);
if (id4 != -1) {
// Reactivate the one we edit...
- table[val][id4]->setMappingValues(curve, amin, amid, amax, fMin[p],
- fInit[p], fMax[p]);
- table[val][id4]->setActive(true);
+ table[val][uint(id4)]->setMappingValues(
+ curve, amin, amid, amax, fItems[uint(p)].fMin, fItems[uint(p)].fInit,
+ fItems[uint(p)].fMax);
+ table[val][uint(id4)]->setActive(true);
} else {
// Allocate a new CurveZoneControl which is 'active' by default
- FAUSTFLOAT* zone = fZone[p];
- table[val].push_back(new CurveZoneControl(zone, curve, amin, amid, amax,
- fMin[p], fInit[p], fMax[p]));
+ FAUSTFLOAT* zone = fItems[uint(p)].fZone;
+ table[val].push_back(new CurveZoneControl(
+ zone, curve, amin, amid, amax, fItems[uint(p)].fMin,
+ fItems[uint(p)].fInit, fItems[uint(p)].fMax));
}
}
}
@@ -1240,16 +1549,16 @@ class APIUI
if (id1 != -1) {
val = 0;
- curve = table[val][id1]->getCurve();
- table[val][id1]->getMappingValues(amin, amid, amax);
+ curve = table[val][uint(id1)]->getCurve();
+ table[val][uint(id1)]->getMappingValues(amin, amid, amax);
} else if (id2 != -1) {
val = 1;
- curve = table[val][id2]->getCurve();
- table[val][id2]->getMappingValues(amin, amid, amax);
+ curve = table[val][uint(id2)]->getCurve();
+ table[val][uint(id2)]->getMappingValues(amin, amid, amax);
} else if (id3 != -1) {
val = 2;
- curve = table[val][id3]->getCurve();
- table[val][id3]->getMappingValues(amin, amid, amax);
+ curve = table[val][uint(id3)]->getCurve();
+ table[val][uint(id3)]->getMappingValues(amin, amid, amax);
} else {
val = -1; // No mapping
curve = 0;
@@ -1260,26 +1569,23 @@ class APIUI
}
public:
- enum Type { kAcc = 0, kGyr = 1, kNoType };
-
APIUI()
- : fNumParameters(0)
- , fHasScreenControl(false)
- , fRedReader(0)
- , fGreenReader(0)
- , fBlueReader(0)
+ : fHasScreenControl(false)
+ , fRedReader(nullptr)
+ , fGreenReader(nullptr)
+ , fBlueReader(nullptr)
, fCurrentScale(kLin)
{
}
virtual ~APIUI()
{
- for (auto& it : fConversion)
- delete it;
+ for (const auto& it : fItems)
+ delete it.fConversion;
for (int i = 0; i < 3; i++) {
- for (auto& it : fAcc[i])
+ for (const auto& it : fAcc[i])
delete it;
- for (auto& it : fGyr[i])
+ for (const auto& it : fGyr[i])
delete it;
}
delete fRedReader;
@@ -1292,7 +1598,18 @@ class APIUI
virtual void openTabBox(const char* label) { pushLabel(label); }
virtual void openHorizontalBox(const char* label) { pushLabel(label); }
virtual void openVerticalBox(const char* label) { pushLabel(label); }
- virtual void closeBox() { popLabel(); }
+ virtual void closeBox()
+ {
+ if (popLabel()) {
+ // Shortnames can be computed when all fullnames are known
+ computeShortNames();
+ // Fill 'shortname' field for each item
+ for (const auto& it : fFull2Short) {
+ int index = getParamIndex(it.first.c_str());
+ fItems[index].fShortname = it.second;
+ }
+ }
+ }
// -- active widgets
@@ -1329,13 +1646,13 @@ class APIUI
virtual void addHorizontalBargraph(const char* label, FAUSTFLOAT* zone,
FAUSTFLOAT min, FAUSTFLOAT max)
{
- addParameter(label, zone, min, min, max, (max - min) / 1000.0, kHBargraph);
+ addParameter(label, zone, min, min, max, (max - min) / 1000.0f, kHBargraph);
}
virtual void addVerticalBargraph(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT min,
FAUSTFLOAT max)
{
- addParameter(label, zone, min, min, max, (max - min) / 1000.0, kVBargraph);
+ addParameter(label, zone, min, min, max, (max - min) / 1000.0f, kVBargraph);
}
// -- soundfiles
@@ -1378,23 +1695,25 @@ class APIUI
//-------------------------------------------------------------------------------
// Simple API part
//-------------------------------------------------------------------------------
- int getParamsCount() { return fNumParameters; }
- int getParamIndex(const char* path)
+ int getParamsCount() { return int(fItems.size()); }
+
+ int getParamIndex(const char* path_aux)
{
- if (fPathMap.find(path) != fPathMap.end()) {
- return fPathMap[path];
- } else if (fLabelMap.find(path) != fLabelMap.end()) {
- return fLabelMap[path];
- } else {
- return -1;
- }
+ std::string path = std::string(path_aux);
+ auto it = find_if(fItems.begin(), fItems.end(), [=](const Item& it) {
+ return (it.fLabel == path) || (it.fShortname == path) || (it.fPath == path);
+ });
+ return (it != fItems.end()) ? int(it - fItems.begin()) : -1;
}
- const char* getParamAddress(int p) { return fPaths[p].c_str(); }
- const char* getParamLabel(int p) { return fLabels[p].c_str(); }
+
+ const char* getParamLabel(int p) { return fItems[uint(p)].fLabel.c_str(); }
+ const char* getParamShortname(int p) { return fItems[uint(p)].fShortname.c_str(); }
+ const char* getParamAddress(int p) { return fItems[uint(p)].fPath.c_str(); }
+
std::map<const char*, const char*> getMetadata(int p)
{
std::map<const char*, const char*> res;
- std::map<std::string, std::string> metadata = fMetaData[p];
+ std::map<std::string, std::string> metadata = fMetaData[uint(p)];
for (const auto& it : metadata) {
res[it.first.c_str()] = it.second.c_str();
}
@@ -1403,26 +1722,62 @@ class APIUI
const char* getMetadata(int p, const char* key)
{
- return (fMetaData[p].find(key) != fMetaData[p].end()) ? fMetaData[p][key].c_str()
- : "";
+ return (fMetaData[uint(p)].find(key) != fMetaData[uint(p)].end())
+ ? fMetaData[uint(p)][key].c_str()
+ : "";
}
- FAUSTFLOAT getParamMin(int p) { return fMin[p]; }
- FAUSTFLOAT getParamMax(int p) { return fMax[p]; }
- FAUSTFLOAT getParamStep(int p) { return fStep[p]; }
- FAUSTFLOAT getParamInit(int p) { return fInit[p]; }
+ FAUSTFLOAT getParamMin(int p) { return fItems[uint(p)].fMin; }
+ FAUSTFLOAT getParamMax(int p) { return fItems[uint(p)].fMax; }
+ FAUSTFLOAT getParamStep(int p) { return fItems[uint(p)].fStep; }
+ FAUSTFLOAT getParamInit(int p) { return fItems[uint(p)].fInit; }
+
+ FAUSTFLOAT* getParamZone(int p) { return fItems[uint(p)].fZone; }
- FAUSTFLOAT* getParamZone(int p) { return fZone[p]; }
- FAUSTFLOAT getParamValue(int p) { return *fZone[p]; }
- void setParamValue(int p, FAUSTFLOAT v) { *fZone[p] = v; }
+ FAUSTFLOAT getParamValue(int p) { return *fItems[uint(p)].fZone; }
+ FAUSTFLOAT getParamValue(const char* path)
+ {
+ int index = getParamIndex(path);
+ if (index >= 0) {
+ return getParamValue(index);
+ } else {
+ fprintf(stderr, "getParamValue : '%s' not found\n",
+ (path == nullptr ? "NULL" : path));
+ return FAUSTFLOAT(0);
+ }
+ }
- double getParamRatio(int p) { return fConversion[p]->faust2ui(*fZone[p]); }
- void setParamRatio(int p, double r) { *fZone[p] = fConversion[p]->ui2faust(r); }
+ void setParamValue(int p, FAUSTFLOAT v) { *fItems[uint(p)].fZone = v; }
+ void setParamValue(const char* path, FAUSTFLOAT v)
+ {
+ int index = getParamIndex(path);
+ if (index >= 0) {
+ setParamValue(index, v);
+ } else {
+ fprintf(stderr, "setParamValue : '%s' not found\n",
+ (path == nullptr ? "NULL" : path));
+ }
+ }
- double value2ratio(int p, double r) { return fConversion[p]->faust2ui(r); }
- double ratio2value(int p, double r) { return fConversion[p]->ui2faust(r); }
+ double getParamRatio(int p)
+ {
+ return fItems[uint(p)].fConversion->faust2ui(*fItems[uint(p)].fZone);
+ }
+ void setParamRatio(int p, double r)
+ {
+ *fItems[uint(p)].fZone = FAUSTFLOAT(fItems[uint(p)].fConversion->ui2faust(r));
+ }
+
+ double value2ratio(int p, double r)
+ {
+ return fItems[uint(p)].fConversion->faust2ui(r);
+ }
+ double ratio2value(int p, double r)
+ {
+ return fItems[uint(p)].fConversion->ui2faust(r);
+ }
/**
- * Return the control type (kAcc, kGyr, or -1) for a given parameter
+ * Return the control type (kAcc, kGyr, or -1) for a given parameter.
*
* @param p - the UI parameter index
*
@@ -1444,13 +1799,13 @@ class APIUI
/**
* Return the Item type (kButton = 0, kCheckButton, kVSlider, kHSlider, kNumEntry,
- * kHBargraph, kVBargraph) for a given parameter
+ * kHBargraph, kVBargraph) for a given parameter.
*
* @param p - the UI parameter index
*
* @return the Item type
*/
- ItemType getParamItemType(int p) { return fItemType[p]; }
+ ItemType getParamItemType(int p) { return fItems[uint(p)].fItemType; }
/**
* Set a new value coming from an accelerometer, propagate it to all relevant
@@ -1490,7 +1845,7 @@ class APIUI
* given UI parameter.
*
* @param p - the UI parameter index
- * @param acc - 0 for X gyroscope, 1 for Y gyroscope, 2 for Z gyroscope (-1 means "no
+ * @param gyr - 0 for X gyroscope, 1 for Y gyroscope, 2 for Z gyroscope (-1 means "no
* mapping")
* @param curve - between 0 and 3
* @param amin - mapping 'min' point
@@ -1555,7 +1910,7 @@ class APIUI
}
/**
- * Get the number of FAUSTFLOAT* zones controlled with the accelerometer
+ * Get the number of FAUSTFLOAT* zones controlled with the accelerometer.
*
* @param acc - 0 for X accelerometer, 1 for Y accelerometer, 2 for Z accelerometer
* @return the number of zones
@@ -1564,7 +1919,7 @@ class APIUI
int getAccCount(int acc) { return (acc >= 0 && acc < 3) ? int(fAcc[acc].size()) : 0; }
/**
- * Get the number of FAUSTFLOAT* zones controlled with the gyroscope
+ * Get the number of FAUSTFLOAT* zones controlled with the gyroscope.
*
* @param gyr - 0 for X gyroscope, 1 for Y gyroscope, 2 for Z gyroscope
* @param the number of zones
@@ -1601,8 +1956,11 @@ class APIUI
#define FAUSTFLOAT float
#endif
+#include <math.h>
+
#include <algorithm>
#include <cmath>
+#include <cstdint>
#ifndef FAUSTCLASS
#define FAUSTCLASS limiterdsp
@@ -1613,20 +1971,24 @@ class APIUI
#define exp10 __exp10
#endif
+#if defined(_WIN32)
+#define RESTRICT __restrict
+#else
+#define RESTRICT __restrict__
+#endif
+
class limiterdsp : public dsp
{
private:
int fSampleRate;
- float fConst0;
float fConst1;
float fConst2;
- float fConst3;
- int iRec5[2];
FAUSTFLOAT fHslider0;
- int IOTA;
+ int IOTA0;
float fVec0[32];
- float fRec4[2];
+ float fConst3;
int iRec2[2];
+ float fRec3[2];
float fRec1[2];
float fConst4;
float fConst5;
@@ -1637,9 +1999,16 @@ class limiterdsp : public dsp
void metadata(Meta* m)
{
m->declare("analyzers.lib/name", "Faust Analyzer Library");
- m->declare("analyzers.lib/version", "0.1");
+ m->declare("analyzers.lib/version", "0.2");
m->declare("basics.lib/name", "Faust Basic Element Library");
- m->declare("basics.lib/version", "0.1");
+ m->declare("basics.lib/peakholder:author", "Dario Sanfilippo");
+ m->declare("basics.lib/peakholder:copyright",
+ "Copyright (C) 2022 Dario Sanfilippo <sanfilippo.dario@gmail.com>");
+ m->declare("basics.lib/peakholder:license", "MIT-style STK-4.3 license");
+ m->declare("basics.lib/version", "0.8");
+ m->declare("compile_options",
+ "-a faust2header.cpp -lang cpp -i -inpl -cn limiterdsp -es 1 -mcd 16 "
+ "-single -ftz 0");
m->declare("compressors.lib/limiter_lad_N:author", "Dario Sanfilippo");
m->declare(
"compressors.lib/limiter_lad_N:copyright",
@@ -1651,91 +2020,59 @@ class limiterdsp : public dsp
"Copyright (C) 2020 Dario Sanfilippo <sanfilippo.dario@gmail.com>");
m->declare("compressors.lib/limiter_lad_mono:license", "GPLv3 license");
m->declare("compressors.lib/name", "Faust Compressor Effect Library");
- m->declare("compressors.lib/version", "0.0");
+ m->declare("compressors.lib/version", "0.2");
m->declare("filename", "limiterdsp.dsp");
m->declare("maths.lib/author", "GRAME");
m->declare("maths.lib/copyright", "GRAME");
m->declare("maths.lib/license", "LGPL with exception");
m->declare("maths.lib/name", "Faust Math Library");
- m->declare("maths.lib/version", "2.3");
+ m->declare("maths.lib/version", "2.5");
m->declare("name", "limiterdsp");
m->declare("platform.lib/name", "Generic Platform Library");
- m->declare("platform.lib/version", "0.1");
+ m->declare("platform.lib/version", "0.2");
m->declare("routes.lib/name", "Faust Signal Routing Library");
m->declare("routes.lib/version", "0.2");
m->declare("signals.lib/name", "Faust Signal Routing Library");
- m->declare("signals.lib/version", "0.0");
+ m->declare("signals.lib/version", "0.3");
}
virtual int getNumInputs() { return 1; }
virtual int getNumOutputs() { return 1; }
- virtual int getInputRate(int channel)
- {
- int rate;
- switch ((channel)) {
- case 0: {
- rate = 1;
- break;
- }
- default: {
- rate = -1;
- break;
- }
- }
- return rate;
- }
- virtual int getOutputRate(int channel)
- {
- int rate;
- switch ((channel)) {
- case 0: {
- rate = 1;
- break;
- }
- default: {
- rate = -1;
- break;
- }
- }
- return rate;
- }
static void classInit(int /*sample_rate*/) {}
virtual void instanceConstants(int sample_rate)
{
fSampleRate = sample_rate;
- fConst0 = std::min<float>(192000.0f, std::max<float>(1.0f, float(fSampleRate)));
- fConst1 = std::exp((0.0f - (100000.0f / fConst0)));
- fConst2 = (1.0f - fConst1);
- fConst3 = (0.100000001f * fConst0);
- fConst4 = std::exp((0.0f - (4.0f / fConst0)));
- fConst5 = (1.0f - fConst4);
- iConst6 = int((9.99999975e-05f * fConst0));
+ float fConst0 =
+ std::min<float>(192000.0f, std::max<float>(1.0f, float(fSampleRate)));
+ fConst1 = std::exp(0.0f - 100000.0f / fConst0);
+ fConst2 = 1.0f - fConst1;
+ fConst3 = 0.100000001f * fConst0;
+ fConst4 = std::exp(0.0f - 4.0f / fConst0);
+ fConst5 = 1.0f - fConst4;
+ iConst6 = int(9.99999975e-05f * fConst0);
}
virtual void instanceResetUserInterface() { fHslider0 = FAUSTFLOAT(2.0f); }
virtual void instanceClear()
{
- for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) {
- iRec5[l0] = 0;
- }
- IOTA = 0;
- for (int l1 = 0; (l1 < 32); l1 = (l1 + 1)) {
- fVec0[l1] = 0.0f;
+ IOTA0 = 0;
+ for (int l0 = 0; l0 < 32; l0 = l0 + 1) {
+ fVec0[l0] = 0.0f;
}
- for (int l2 = 0; (l2 < 2); l2 = (l2 + 1)) {
- fRec4[l2] = 0.0f;
+ for (int l1 = 0; l1 < 2; l1 = l1 + 1) {
+ iRec2[l1] = 0;
}
- for (int l3 = 0; (l3 < 2); l3 = (l3 + 1)) {
- iRec2[l3] = 0;
+ for (int l2 = 0; l2 < 2; l2 = l2 + 1) {
+ fRec3[l2] = 0.0f;
}
- for (int l4 = 0; (l4 < 2); l4 = (l4 + 1)) {
- fRec1[l4] = 0.0f;
+ for (int l3 = 0; l3 < 2; l3 = l3 + 1) {
+ fRec1[l3] = 0.0f;
}
- for (int l5 = 0; (l5 < 2); l5 = (l5 + 1)) {
- fRec0[l5] = 0.0f;
+ for (int l4 = 0; l4 < 2; l4 = l4 + 1) {
+ fRec0[l4] = 0.0f;
}
}
@@ -1759,8 +2096,9 @@ class limiterdsp : public dsp
{
ui_interface->openVerticalBox("limiterdsp");
ui_interface->declare(&fHslider0, "0", "");
- ui_interface->addHorizontalSlider("NumClientsAssumed", &fHslider0, 2.0f, 1.0f,
- 64.0f, 1.0f);
+ ui_interface->addHorizontalSlider("NumClientsAssumed", &fHslider0,
+ FAUSTFLOAT(2.0f), FAUSTFLOAT(1.0f),
+ FAUSTFLOAT(64.0f), FAUSTFLOAT(1.0f));
ui_interface->closeBox();
}
@@ -1768,28 +2106,25 @@ class limiterdsp : public dsp
{
FAUSTFLOAT* input0 = inputs[0];
FAUSTFLOAT* output0 = outputs[0];
- float fSlow0 = (1.0f / std::sqrt(float(fHslider0)));
- for (int i = 0; (i < count); i = (i + 1)) {
- float fTemp0 = float(input0[i]);
- iRec5[0] = ((iRec5[1] + 1)
- % int(std::max<float>(1.0f, (fConst3 * float(iRec2[1])))));
- float fTemp1 = (fSlow0 * fTemp0);
- fVec0[(IOTA & 31)] = fTemp1;
- float fTemp2 = std::fabs(fTemp1);
- fRec4[0] = std::max<float>((float((iRec5[0] > 0)) * fRec4[1]), fTemp2);
- iRec2[0] = (fRec4[0] >= fTemp2);
- float fRec3 = fRec4[0];
- fRec1[0] = ((fConst1 * fRec1[1]) + (fConst2 * fRec3));
- float fTemp3 = std::fabs(fRec1[0]);
- fRec0[0] =
- std::max<float>(fTemp3, ((fConst4 * fRec0[1]) + (fConst5 * fTemp3)));
- output0[i] = FAUSTFLOAT(
- (std::min<float>(1.0f, (0.5f / std::max<float>(fRec0[0], 1.1920929e-07f)))
- * fVec0[((IOTA - iConst6) & 31)]));
- iRec5[1] = iRec5[0];
- IOTA = (IOTA + 1);
- fRec4[1] = fRec4[0];
+ float fSlow0 = 1.0f / std::sqrt(float(fHslider0));
+ for (int i0 = 0; i0 < count; i0 = i0 + 1) {
+ float fTemp0 = float(input0[i0]);
+ float fTemp1 = fSlow0 * fTemp0;
+ fVec0[IOTA0 & 31] = fTemp1;
+ float fTemp2 = std::fabs(std::fabs(fTemp1));
+ int iTemp3 = (fTemp2 >= fRec3[1]) | (float(iRec2[1]) >= fConst3);
+ int iThen0 = iRec2[1] + 1;
+ iRec2[0] = ((iTemp3) ? 0 : iThen0);
+ fRec3[0] = ((iTemp3) ? fTemp2 : fRec3[1]);
+ fRec1[0] = fConst2 * fRec3[0] + fConst1 * fRec1[1];
+ float fTemp4 = std::fabs(fRec1[0]);
+ fRec0[0] = std::max<float>(fTemp4, fConst4 * fRec0[1] + fConst5 * fTemp4);
+ output0[i0] = FAUSTFLOAT(
+ std::min<float>(1.0f, 0.5f / std::max<float>(fRec0[0], 1.1920929e-07f))
+ * fVec0[(IOTA0 - iConst6) & 31]);
+ IOTA0 = IOTA0 + 1;
iRec2[1] = iRec2[0];
+ fRec3[1] = fRec3[0];
fRec1[1] = fRec1[0];
fRec0[1] = fRec0[0];
}
diff --git a/src/main.cpp b/src/main.cpp
index 80554d4..9bf27f5 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -139,7 +139,9 @@ QCoreApplication* createApplication(int& argc, char* argv[])
#endif
#if defined(Q_OS_MACOS) && !defined(NO_VS)
// Turn on high DPI support.
+#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
JTApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
+#endif
// Fix for display scaling like 125% or 150% on Windows
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
QGuiApplication::setHighDpiScaleFactorRoundingPolicy(
@@ -148,11 +150,18 @@ QCoreApplication* createApplication(int& argc, char* argv[])
return new JTApplication(argc, argv);
#else
// Turn on high DPI support.
+#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
+#endif
// Fix for display scaling like 125% or 150% on Windows
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
+#if defined(NO_VS) && defined(_WIN32)
+ QGuiApplication::setHighDpiScaleFactorRoundingPolicy(
+ Qt::HighDpiScaleFactorRoundingPolicy::RoundPreferFloor);
+#else
QGuiApplication::setHighDpiScaleFactorRoundingPolicy(
Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
+#endif // NO_VS
#endif // QT_VERSION
return new QApplication(argc, argv);
#endif // Q_OS_MACOS
@@ -327,11 +336,6 @@ int main(int argc, char* argv[])
// Check if we need to show our first run window.
QSettings settings;
int uiMode = settings.value(QStringLiteral("UiMode"), QJackTrip::UNSET).toInt();
-#ifndef __unix__
- QString updateChannel = settings.value(QStringLiteral("UpdateChannel"), "stable")
- .toString()
- .toLower();
-#endif
#ifdef _WIN32
// Set url scheme in registry
QString path = QDir::toNativeSeparators(qApp->applicationFilePath());
@@ -486,20 +490,29 @@ int main(int argc, char* argv[])
window->show();
#endif // NO_VS
-#ifndef NO_UPDATER
- // Setup auto-update feed
- dblsqd::Feed* feed = 0;
+#if !defined(NO_UPDATER) && !defined(__unix__)
+#ifndef PSI
+#if defined(NO_VS)
+ // This wasn't set up earlier in NO_VS builds. Create it here.
+ QSettings settings;
+#endif
+ QString updateChannel = settings.value(QStringLiteral("UpdateChannel"), "stable")
+ .toString()
+ .toLower();
QString baseUrl =
- "https://raw.githubusercontent.com/jacktrip/jacktrip/dev/releases";
+ QStringLiteral(
+ "https://raw.githubusercontent.com/jacktrip/jacktrip/dev/releases/%1")
+ .arg(updateChannel);
+#else
+ QString baseUrl = QStringLiteral("https://nuages.psi-borg.org/jacktrip");
+#endif // PSI
+ // Setup auto-update feed
+ dblsqd::Feed* feed = new dblsqd::Feed();
#ifdef Q_OS_WIN
- feed = new dblsqd::Feed();
- feed->setUrl(
- QUrl(QString("%1/%2/%3-manifests.json").arg(baseUrl, updateChannel, "win")));
+ feed->setUrl(QUrl(QString("%1/%2-manifests.json").arg(baseUrl, "win")));
#endif
#ifdef Q_OS_MACOS
- feed = new dblsqd::Feed();
- feed->setUrl(
- QUrl(QString("%1/%2/%3-manifests.json").arg(baseUrl, updateChannel, "mac")));
+ feed->setUrl(QUrl(QString("%1/%2-manifests.json").arg(baseUrl, "mac")));
#endif
if (feed) {
dblsqd::UpdateDialog* updateDialog = new dblsqd::UpdateDialog(feed);
diff --git a/src/meterdsp.h b/src/meterdsp.h
index eb2faff..24dff34 100644
--- a/src/meterdsp.h
+++ b/src/meterdsp.h
@@ -3,13 +3,13 @@ author: "Dominick Hing"
license: "MIT Style STK-4.2"
name: "meter"
version: "1.0"
-Code generated with Faust 2.40.0 (https://faust.grame.fr)
+Code generated with Faust 2.41.1 (https://faust.grame.fr)
Compilation options: -a faust2header.cpp -lang cpp -i -inpl -cn meterdsp -es 1 -mcd 16
-single -ftz 0
------------------------------------------------------------ */
-#ifndef __METERDSP_H__
-#define __METERDSP_H__
+#ifndef __meterdsp_H__
+#define __meterdsp_H__
// NOTE: ANY INCLUDE-GUARD HERE MUST BE DERIVED FROM THE CLASS NAME
//
@@ -48,18 +48,71 @@ Compilation options: -a faust2header.cpp -lang cpp -i -inpl -cn meterdsp -es 1 -
#include <string>
#include <vector>
+/************************************************************************
+ ************************************************************************
+ FAUST compiler
+ Copyright (C) 2003-2018 GRAME, Centre National de Creation Musicale
+ ---------------------------------------------------------------------
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ ************************************************************************
+ ************************************************************************/
+
+#ifndef __export__
+#define __export__
+
+#define FAUSTVERSION "2.41.1"
+
+// Use FAUST_API for code that is part of the external API but is also compiled in faust
+// and libfaust Use LIBFAUST_API for code that is compiled in faust and libfaust
+
+#ifdef _WIN32
+#pragma warning(disable : 4251)
+#ifdef FAUST_EXE
+#define FAUST_API
+#define LIBFAUST_API
+#elif FAUST_LIB
+#define FAUST_API __declspec(dllexport)
+#define LIBFAUST_API __declspec(dllexport)
+#else
+#define FAUST_API
+#define LIBFAUST_API
+#endif
+#else
+#ifdef FAUST_EXE
+#define FAUST_API
+#define LIBFAUST_API
+#else
+#define FAUST_API __attribute__((visibility("default")))
+#define LIBFAUST_API __attribute__((visibility("default")))
+#endif
+#endif
+
+#endif
+
#ifndef FAUSTFLOAT
#define FAUSTFLOAT float
#endif
-struct UI;
-struct Meta;
+struct FAUST_API UI;
+struct FAUST_API Meta;
/**
* DSP memory manager.
*/
-struct dsp_memory_manager {
+struct FAUST_API dsp_memory_manager {
virtual ~dsp_memory_manager() {}
/**
@@ -99,7 +152,7 @@ struct dsp_memory_manager {
* Signal processor definition.
*/
-class dsp
+class FAUST_API dsp
{
public:
dsp() {}
@@ -200,7 +253,7 @@ class dsp
* Generic DSP decorator.
*/
-class decorator_dsp : public dsp
+class FAUST_API decorator_dsp : public dsp
{
protected:
dsp* fDSP;
@@ -243,7 +296,7 @@ class decorator_dsp : public dsp
* to create DSP instances from a compiled DSP program.
*/
-class dsp_factory
+class FAUST_API dsp_factory
{
protected:
// So that to force sub-classes to use deleteDSPFactory(dsp_factory* factory);
@@ -269,7 +322,7 @@ class dsp_factory
#include <xmmintrin.h>
#endif
-class ScopedNoDenormals
+class FAUST_API ScopedNoDenormals
{
private:
intptr_t fpsr;
@@ -385,7 +438,7 @@ architecture section is not modified.
The base class of Meta handler to be used in dsp::metadata(Meta* m) method to retrieve
(key, value) metadata.
*/
-struct Meta {
+struct FAUST_API Meta {
virtual ~Meta() {}
virtual void declare(const char* key, const char* value) = 0;
};
@@ -433,7 +486,7 @@ struct Meta {
struct Soundfile;
template<typename REAL>
-struct UIReal {
+struct FAUST_API UIReal {
UIReal() {}
virtual ~UIReal() {}
@@ -464,8 +517,8 @@ struct UIReal {
// -- soundfiles
- virtual void addSoundfile(const char* label, const char* filename,
- Soundfile** sf_zone) = 0;
+ virtual void addSoundfile(const char* /*label*/, const char* /*filename*/,
+ Soundfile** /*sf_zone*/) = 0;
// -- metadata declarations
@@ -475,7 +528,7 @@ struct UIReal {
virtual int sizeOfFAUSTFLOAT() { return sizeof(FAUSTFLOAT); }
};
-struct UI : public UIReal<FAUSTFLOAT> {
+struct FAUST_API UI : public UIReal<FAUSTFLOAT> {
UI() {}
virtual ~UI() {}
};
@@ -506,10 +559,13 @@ struct UI : public UIReal<FAUSTFLOAT> {
architecture section is not modified.
************************************************************************/
-#ifndef FAUST_PATHBUILDER_H
-#define FAUST_PATHBUILDER_H
+#ifndef __PathBuilder__
+#define __PathBuilder__
#include <algorithm>
+#include <map>
+#include <regex>
+#include <set>
#include <string>
#include <vector>
@@ -518,46 +574,190 @@ struct UI : public UIReal<FAUSTFLOAT> {
* Helper class to build complete hierarchical path for UI items.
******************************************************************************/
-class PathBuilder
+class FAUST_API PathBuilder
{
protected:
std::vector<std::string> fControlsLevel;
+ std::vector<std::string> fFullPaths;
+ std::map<std::string, std::string> fFull2Short; // filled by computeShortNames()
+
+ /**
+ * @brief check if a character is acceptable for an ID
+ *
+ * @param c
+ * @return true is the character is acceptable for an ID
+ */
+ bool isIDChar(char c) const
+ {
+ return ((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z'))
+ || ((c >= '0') && (c <= '9'));
+ }
+
+ /**
+ * @brief remove all "/0x00" parts
+ *
+ * @param src
+ * @return modified string
+ */
+ std::string remove0x00(const std::string& src) const
+ {
+ return std::regex_replace(src, std::regex("/0x00"), "");
+ }
+
+ /**
+ * @brief replace all non ID char with '_' (one '_' may replace several non ID char)
+ *
+ * @param src
+ * @return modified string
+ */
+ std::string str2ID(const std::string& src) const
+ {
+ std::string dst;
+ bool need_underscore = false;
+ for (char c : src) {
+ if (isIDChar(c) || (c == '/')) {
+ if (need_underscore) {
+ dst.push_back('_');
+ need_underscore = false;
+ }
+ dst.push_back(c);
+ } else {
+ need_underscore = true;
+ }
+ }
+ return dst;
+ }
+
+ /**
+ * @brief Keep only the last n slash-parts
+ *
+ * @param src
+ * @param n : 1 indicates the last slash-part
+ * @return modified string
+ */
+ std::string cut(const std::string& src, int n) const
+ {
+ std::string rdst;
+ for (int i = int(src.length()) - 1; i >= 0; i--) {
+ char c = src[i];
+ if (c != '/') {
+ rdst.push_back(c);
+ } else if (n == 1) {
+ std::string dst;
+ for (int j = int(rdst.length()) - 1; j >= 0; j--) {
+ dst.push_back(rdst[j]);
+ }
+ return dst;
+ } else {
+ n--;
+ rdst.push_back(c);
+ }
+ }
+ return src;
+ }
+
+ void addFullPath(const std::string& label) { fFullPaths.push_back(buildPath(label)); }
+
+ /**
+ * @brief Compute the mapping between full path and short names
+ */
+ void computeShortNames()
+ {
+ std::vector<std::string>
+ uniquePaths; // all full paths transformed but made unique with a prefix
+ std::map<std::string, std::string>
+ unique2full; // all full paths transformed but made unique with a prefix
+ char num_buffer[16];
+ int pnum = 0;
+
+ for (const auto& s : fFullPaths) {
+ sprintf(num_buffer, "%d", pnum++);
+ std::string u = "/P" + std::string(num_buffer) + str2ID(remove0x00(s));
+ uniquePaths.push_back(u);
+ unique2full[u] = s; // remember the full path associated to a unique path
+ }
+
+ std::map<std::string, int> uniquePath2level; // map path to level
+ for (const auto& s : uniquePaths)
+ uniquePath2level[s] = 1; // we init all levels to 1
+ bool have_collisions = true;
+
+ while (have_collisions) {
+ // compute collision list
+ std::set<std::string> collisionSet;
+ std::map<std::string, std::string> short2full;
+ have_collisions = false;
+ for (const auto& it : uniquePath2level) {
+ std::string u = it.first;
+ int n = it.second;
+ std::string shortName = cut(u, n);
+ auto p = short2full.find(shortName);
+ if (p == short2full.end()) {
+ // no collision
+ short2full[shortName] = u;
+ } else {
+ // we have a collision, add the two paths to the collision set
+ have_collisions = true;
+ collisionSet.insert(u);
+ collisionSet.insert(p->second);
+ }
+ }
+ for (const auto& s : collisionSet)
+ uniquePath2level[s]++; // increase level of colliding path
+ }
+
+ for (const auto& it : uniquePath2level) {
+ std::string u = it.first;
+ int n = it.second;
+ std::string shortName = replaceCharList(cut(u, n), {'/'}, '_');
+ fFull2Short[unique2full[u]] = shortName;
+ }
+ }
+
+ std::string replaceCharList(const std::string& str, const std::vector<char>& ch1,
+ char ch2)
+ {
+ auto beg = ch1.begin();
+ auto end = ch1.end();
+ std::string res = str;
+ for (size_t i = 0; i < str.length(); ++i) {
+ if (std::find(beg, end, str[i]) != end)
+ res[i] = ch2;
+ }
+ return res;
+ }
public:
PathBuilder() {}
virtual ~PathBuilder() {}
- std::string replaceCharList(std::string str, const std::vector<char>& ch1, char ch2)
+ // Return true for the first level of groups
+ bool pushLabel(const std::string& label)
{
- std::vector<char>::const_iterator beg = ch1.begin();
- std::vector<char>::const_iterator end = ch1.end();
- for (size_t i = 0; i < str.length(); ++i) {
- if (std::find(beg, end, str[i]) != end) {
- str[i] = ch2;
- }
- }
- return str;
+ fControlsLevel.push_back(label);
+ return fControlsLevel.size() == 1;
+ }
+
+ // Return true for the last level of groups
+ bool popLabel()
+ {
+ fControlsLevel.pop_back();
+ return fControlsLevel.size() == 0;
}
std::string buildPath(const std::string& label)
{
std::string res = "/";
for (size_t i = 0; i < fControlsLevel.size(); i++) {
- res += fControlsLevel[i];
- res += "/";
+ res = res + fControlsLevel[i] + "/";
}
res += label;
- std::vector<char> rep = {' ', '#', '*', ',', '/', '?',
- '[', ']', '{', '}', '(', ')'};
- replaceCharList(res, rep, '_');
- return res;
+ return replaceCharList(
+ res, {' ', '#', '*', ',', '?', '[', ']', '{', '}', '(', ')'}, '_');
}
-
- void pushLabel(const std::string& label) { fControlsLevel.push_back(label); }
- void popLabel() { fControlsLevel.pop_back(); }
};
-#endif // FAUST_PATHBUILDER_H
+#endif // __PathBuilder__
/************************** END PathBuilder.h **************************/
/************************** BEGIN ValueConverter.h ********************
FAUST Architecture File
@@ -646,7 +846,7 @@ vm v2
// y = v1 - lo*coef + x*coef
// y = offset + x*coef with offset = v1 - lo*coef
//--------------------------------------------------------------------------------------
-class Interpolator
+class FAUST_API Interpolator
{
private:
//--------------------------------------------------------------------------------------
@@ -697,7 +897,7 @@ class Interpolator
// Interpolator3pt(lo,mi,hi,v1,vm,v2)
// Map values between lo mid hi to values between v1 vm v2
//--------------------------------------------------------------------------------------
-class Interpolator3pt
+class FAUST_API Interpolator3pt
{
private:
Interpolator fSegment1;
@@ -721,7 +921,7 @@ class Interpolator3pt
//--------------------------------------------------------------------------------------
// Abstract ValueConverter class. Converts values between UI and Faust representations
//--------------------------------------------------------------------------------------
-class ValueConverter // Identity by default
+class FAUST_API ValueConverter
{
public:
virtual ~ValueConverter() {}
@@ -733,7 +933,7 @@ class ValueConverter // Identity by default
// A converter than can be updated
//--------------------------------------------------------------------------------------
-class UpdatableValueConverter : public ValueConverter
+class FAUST_API UpdatableValueConverter : public ValueConverter
{
protected:
bool fActive;
@@ -753,7 +953,7 @@ class UpdatableValueConverter : public ValueConverter
//--------------------------------------------------------------------------------------
// Linear conversion between ui and Faust values
//--------------------------------------------------------------------------------------
-class LinearValueConverter : public ValueConverter
+class FAUST_API LinearValueConverter : public ValueConverter
{
private:
Interpolator fUI2F;
@@ -773,7 +973,7 @@ class LinearValueConverter : public ValueConverter
//--------------------------------------------------------------------------------------
// Two segments linear conversion between ui and Faust values
//--------------------------------------------------------------------------------------
-class LinearValueConverter2 : public UpdatableValueConverter
+class FAUST_API LinearValueConverter2 : public UpdatableValueConverter
{
private:
Interpolator3pt fUI2F;
@@ -809,7 +1009,7 @@ class LinearValueConverter2 : public UpdatableValueConverter
//--------------------------------------------------------------------------------------
// Logarithmic conversion between ui and Faust values
//--------------------------------------------------------------------------------------
-class LogValueConverter : public LinearValueConverter
+class FAUST_API LogValueConverter : public LinearValueConverter
{
public:
LogValueConverter(double umin, double umax, double fmin, double fmax)
@@ -831,7 +1031,7 @@ class LogValueConverter : public LinearValueConverter
//--------------------------------------------------------------------------------------
// Exponential conversion between ui and Faust values
//--------------------------------------------------------------------------------------
-class ExpValueConverter : public LinearValueConverter
+class FAUST_API ExpValueConverter : public LinearValueConverter
{
public:
ExpValueConverter(double umin, double umax, double fmin, double fmax)
@@ -854,7 +1054,7 @@ class ExpValueConverter : public LinearValueConverter
// Convert accelerometer or gyroscope values to Faust values
// Using an Up curve (curve 0)
//--------------------------------------------------------------------------------------
-class AccUpConverter : public UpdatableValueConverter
+class FAUST_API AccUpConverter : public UpdatableValueConverter
{
private:
Interpolator3pt fA2F;
@@ -890,7 +1090,7 @@ class AccUpConverter : public UpdatableValueConverter
// Convert accelerometer or gyroscope values to Faust values
// Using a Down curve (curve 1)
//--------------------------------------------------------------------------------------
-class AccDownConverter : public UpdatableValueConverter
+class FAUST_API AccDownConverter : public UpdatableValueConverter
{
private:
Interpolator3pt fA2F;
@@ -926,15 +1126,15 @@ class AccDownConverter : public UpdatableValueConverter
// Convert accelerometer or gyroscope values to Faust values
// Using an Up-Down curve (curve 2)
//--------------------------------------------------------------------------------------
-class AccUpDownConverter : public UpdatableValueConverter
+class FAUST_API AccUpDownConverter : public UpdatableValueConverter
{
private:
Interpolator3pt fA2F;
Interpolator fF2A;
public:
- AccUpDownConverter(double amin, double amid, double amax, double fmin,
- double /*fmid*/, double fmax)
+ AccUpDownConverter(double amin, double amid, double amax, double fmin, double /*fmid*/,
+ double fmax)
: fA2F(amin, amid, amax, fmin, fmax, fmin)
, fF2A(fmin, fmax, amin,
amax) // Special, pseudo inverse of a non monotonic function
@@ -963,15 +1163,15 @@ class AccUpDownConverter : public UpdatableValueConverter
// Convert accelerometer or gyroscope values to Faust values
// Using a Down-Up curve (curve 3)
//--------------------------------------------------------------------------------------
-class AccDownUpConverter : public UpdatableValueConverter
+class FAUST_API AccDownUpConverter : public UpdatableValueConverter
{
private:
Interpolator3pt fA2F;
Interpolator fF2A;
public:
- AccDownUpConverter(double amin, double amid, double amax, double fmin,
- double /*fmid*/, double fmax)
+ AccDownUpConverter(double amin, double amid, double amax, double fmin, double /*fmid*/,
+ double fmax)
: fA2F(amin, amid, amax, fmax, fmin, fmax)
, fF2A(fmin, fmax, amin,
amax) // Special, pseudo inverse of a non monotonic function
@@ -999,7 +1199,7 @@ class AccDownUpConverter : public UpdatableValueConverter
//--------------------------------------------------------------------------------------
// Base class for ZoneControl
//--------------------------------------------------------------------------------------
-class ZoneControl
+class FAUST_API ZoneControl
{
protected:
FAUSTFLOAT* fZone;
@@ -1010,9 +1210,8 @@ class ZoneControl
virtual void update(double /*v*/) const {}
- virtual void setMappingValues(int /*curve*/, double /*amin*/, double /*amid*/,
- double /*amax*/, double /*min*/, double /*init*/,
- double /*max*/)
+ virtual void setMappingValues(int /*curve*/, double /*amin*/, double /*amid*/, double /*amax*/,
+ double /*min*/, double /*init*/, double /*max*/)
{
}
virtual void getMappingValues(double& /*amin*/, double& /*amid*/, double& /*amax*/) {}
@@ -1028,7 +1227,7 @@ class ZoneControl
//--------------------------------------------------------------------------------------
// Useful to implement accelerometers metadata as a list of ZoneControl for each axes
//--------------------------------------------------------------------------------------
-class ConverterZoneControl : public ZoneControl
+class FAUST_API ConverterZoneControl : public ZoneControl
{
protected:
ValueConverter* fValueConverter;
@@ -1055,7 +1254,7 @@ class ConverterZoneControl : public ZoneControl
// Association of a zone and a four value converter, each one for each possible curve.
// Useful to implement accelerometers metadata as a list of ZoneControl for each axes
//--------------------------------------------------------------------------------------
-class CurveZoneControl : public ZoneControl
+class FAUST_API CurveZoneControl : public ZoneControl
{
private:
std::vector<UpdatableValueConverter*> fValueConverters;
@@ -1110,7 +1309,7 @@ class CurveZoneControl : public ZoneControl
int getCurve() { return fCurve; }
};
-class ZoneReader
+class FAUST_API ZoneReader
{
private:
FAUSTFLOAT* fZone;
@@ -1153,8 +1352,9 @@ class APIUI
enum Mapping { kLin = 0, kLog = 1, kExp = 2 };
struct Item {
- std::string fPath;
std::string fLabel;
+ std::string fShortname;
+ std::string fPath;
ValueConverter* fConversion;
FAUSTFLOAT* fZone;
FAUSTFLOAT fInit;
@@ -1162,6 +1362,23 @@ class APIUI
FAUSTFLOAT fMax;
FAUSTFLOAT fStep;
ItemType fItemType;
+
+ Item(const std::string& label, const std::string& short_name,
+ const std::string& path, ValueConverter* conversion, FAUSTFLOAT* zone,
+ FAUSTFLOAT init, FAUSTFLOAT min, FAUSTFLOAT max, FAUSTFLOAT step,
+ ItemType item_type)
+ : fLabel(label)
+ , fShortname(short_name)
+ , fPath(path)
+ , fConversion(conversion)
+ , fZone(zone)
+ , fInit(init)
+ , fMin(min)
+ , fMax(max)
+ , fStep(step)
+ , fItemType(item_type)
+ {
+ }
};
std::vector<Item> fItems;
@@ -1191,6 +1408,7 @@ class APIUI
ItemType type)
{
std::string path = buildPath(label);
+ fFullPaths.push_back(path);
// handle scale metadata
ValueConverter* converter = nullptr;
@@ -1207,7 +1425,8 @@ class APIUI
}
fCurrentScale = kLin;
- fItems.push_back({path, label, converter, zone, init, min, max, step, type});
+ fItems.push_back(
+ Item(label, "", path, converter, zone, init, min, max, step, type));
if (fCurrentAcc.size() > 0 && fCurrentGyr.size() > 0) {
fprintf(
@@ -1381,7 +1600,18 @@ class APIUI
virtual void openTabBox(const char* label) { pushLabel(label); }
virtual void openHorizontalBox(const char* label) { pushLabel(label); }
virtual void openVerticalBox(const char* label) { pushLabel(label); }
- virtual void closeBox() { popLabel(); }
+ virtual void closeBox()
+ {
+ if (popLabel()) {
+ // Shortnames can be computed when all fullnames are known
+ computeShortNames();
+ // Fill 'shortname' field for each item
+ for (const auto& it : fFull2Short) {
+ int index = getParamIndex(it.first.c_str());
+ fItems[index].fShortname = it.second;
+ }
+ }
+ }
// -- active widgets
@@ -1469,26 +1699,19 @@ class APIUI
//-------------------------------------------------------------------------------
int getParamsCount() { return int(fItems.size()); }
- int getParamIndex(const char* path)
+ int getParamIndex(const char* path_aux)
{
- auto it1 = find_if(fItems.begin(), fItems.end(), [=](const Item& it) {
- return it.fPath == std::string(path);
- });
- if (it1 != fItems.end()) {
- return int(it1 - fItems.begin());
- }
-
- auto it2 = find_if(fItems.begin(), fItems.end(), [=](const Item& it) {
- return it.fLabel == std::string(path);
- });
- if (it2 != fItems.end()) {
- return int(it2 - fItems.begin());
- }
-
- return -1;
+ std::string path = std::string(path_aux);
+ auto it = find_if(fItems.begin(), fItems.end(), [=](const Item& it) {
+ return (it.fLabel == path) || (it.fShortname == path) || (it.fPath == path);
+ });
+ return (it != fItems.end()) ? int(it - fItems.begin()) : -1;
}
- const char* getParamAddress(int p) { return fItems[uint(p)].fPath.c_str(); }
+
const char* getParamLabel(int p) { return fItems[uint(p)].fLabel.c_str(); }
+ const char* getParamShortname(int p) { return fItems[uint(p)].fShortname.c_str(); }
+ const char* getParamAddress(int p) { return fItems[uint(p)].fPath.c_str(); }
+
std::map<const char*, const char*> getMetadata(int p)
{
std::map<const char*, const char*> res;
@@ -1516,7 +1739,13 @@ class APIUI
FAUSTFLOAT getParamValue(const char* path)
{
int index = getParamIndex(path);
- return (index >= 0) ? getParamValue(index) : FAUSTFLOAT(0);
+ if (index >= 0) {
+ return getParamValue(index);
+ } else {
+ fprintf(stderr, "getParamValue : '%s' not found\n",
+ (path == nullptr ? "NULL" : path));
+ return FAUSTFLOAT(0);
+ }
}
void setParamValue(int p, FAUSTFLOAT v) { *fItems[uint(p)].fZone = v; }
@@ -1618,7 +1847,7 @@ class APIUI
* given UI parameter.
*
* @param p - the UI parameter index
- * @param acc - 0 for X gyroscope, 1 for Y gyroscope, 2 for Z gyroscope (-1 means "no
+ * @param gyr - 0 for X gyroscope, 1 for Y gyroscope, 2 for Z gyroscope (-1 means "no
* mapping")
* @param curve - between 0 and 3
* @param amin - mapping 'min' point
@@ -1761,7 +1990,7 @@ class meterdsp : public dsp
{
m->declare("author", "Dominick Hing");
m->declare("basics.lib/name", "Faust Basic Element Library");
- m->declare("basics.lib/version", "0.5");
+ m->declare("basics.lib/version", "0.8");
m->declare("compile_options",
"-a faust2header.cpp -lang cpp -i -inpl -cn meterdsp -es 1 -mcd 16 "
"-single -ftz 0");
diff --git a/src/tonedsp.h b/src/tonedsp.h
new file mode 100644
index 0000000..e999299
--- /dev/null
+++ b/src/tonedsp.h
@@ -0,0 +1,2237 @@
+/* ------------------------------------------------------------
+name: "tonedsp"
+Code generated with Faust 2.50.6 (https://faust.grame.fr)
+Compilation options: -a faust2header.cpp -lang cpp -i -inpl -cn tonedsp -es 1 -mcd 16 -single -ftz 0
+------------------------------------------------------------ */
+
+#ifndef __tonedsp_H__
+#define __tonedsp_H__
+
+// NOTE: ANY INCLUDE-GUARD HERE MUST BE DERIVED FROM THE CLASS NAME
+//
+// faust2header.cpp - FAUST Architecture File
+// This is a simple variation of matlabplot.cpp in the Faust distribution
+// aimed at creating a simple C++ header file (.h) containing a Faust DSP.
+// See the Makefile for how to use it.
+
+/************************** BEGIN dsp.h ********************************
+ FAUST Architecture File
+ Copyright (C) 2003-2022 GRAME, Centre National de Creation Musicale
+ ---------------------------------------------------------------------
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ EXCEPTION : As a special exception, you may create a larger work
+ that contains this FAUST architecture section and distribute
+ that work under terms of your choice, so long as this FAUST
+ architecture section is not modified.
+ ************************************************************************/
+
+#ifndef __dsp__
+#define __dsp__
+
+#include <string>
+#include <vector>
+
+/************************************************************************
+ ************************************************************************
+ FAUST compiler
+ Copyright (C) 2003-2018 GRAME, Centre National de Creation Musicale
+ ---------------------------------------------------------------------
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ ************************************************************************
+ ************************************************************************/
+
+#ifndef __export__
+#define __export__
+
+#define FAUSTVERSION "2.50.6"
+
+// Use FAUST_API for code that is part of the external API but is also compiled in faust and libfaust
+// Use LIBFAUST_API for code that is compiled in faust and libfaust
+
+#ifdef _WIN32
+ #pragma warning (disable: 4251)
+ #ifdef FAUST_EXE
+ #define FAUST_API
+ #define LIBFAUST_API
+ #elif FAUST_LIB
+ #define FAUST_API __declspec(dllexport)
+ #define LIBFAUST_API __declspec(dllexport)
+ #else
+ #define FAUST_API
+ #define LIBFAUST_API
+ #endif
+#else
+ #ifdef FAUST_EXE
+ #define FAUST_API
+ #define LIBFAUST_API
+ #else
+ #define FAUST_API __attribute__((visibility("default")))
+ #define LIBFAUST_API __attribute__((visibility("default")))
+ #endif
+#endif
+
+#endif
+
+#ifndef FAUSTFLOAT
+#define FAUSTFLOAT float
+#endif
+
+struct FAUST_API UI;
+struct FAUST_API Meta;
+
+/**
+ * DSP memory manager.
+ */
+
+struct FAUST_API dsp_memory_manager {
+
+ virtual ~dsp_memory_manager() {}
+
+ /**
+ * Inform the Memory Manager with the number of expected memory zones.
+ * @param count - the number of expected memory zones
+ */
+ virtual void begin(size_t /*count*/) {}
+
+ /**
+ * Give the Memory Manager information on a given memory zone.
+ * @param size - the size in bytes of the memory zone
+ * @param reads - the number of Read access to the zone used to compute one frame
+ * @param writes - the number of Write access to the zone used to compute one frame
+ */
+ virtual void info(size_t /*size*/, size_t /*reads*/, size_t /*writes*/) {}
+
+ /**
+ * Inform the Memory Manager that all memory zones have been described,
+ * to possibly start a 'compute the best allocation strategy' step.
+ */
+ virtual void end() {}
+
+ /**
+ * Allocate a memory zone.
+ * @param size - the memory zone size in bytes
+ */
+ virtual void* allocate(size_t size) = 0;
+
+ /**
+ * Destroy a memory zone.
+ * @param ptr - the memory zone pointer to be deallocated
+ */
+ virtual void destroy(void* ptr) = 0;
+
+};
+
+/**
+* Signal processor definition.
+*/
+
+class FAUST_API dsp {
+
+ public:
+
+ dsp() {}
+ virtual ~dsp() {}
+
+ /* Return instance number of audio inputs */
+ virtual int getNumInputs() = 0;
+
+ /* Return instance number of audio outputs */
+ virtual int getNumOutputs() = 0;
+
+ /**
+ * Trigger the ui_interface parameter with instance specific calls
+ * to 'openTabBox', 'addButton', 'addVerticalSlider'... in order to build the UI.
+ *
+ * @param ui_interface - the user interface builder
+ */
+ virtual void buildUserInterface(UI* ui_interface) = 0;
+
+ /* Return the sample rate currently used by the instance */
+ virtual int getSampleRate() = 0;
+
+ /**
+ * Global init, calls the following methods:
+ * - static class 'classInit': static tables initialization
+ * - 'instanceInit': constants and instance state initialization
+ *
+ * @param sample_rate - the sampling rate in Hz
+ */
+ virtual void init(int sample_rate) = 0;
+
+ /**
+ * Init instance state
+ *
+ * @param sample_rate - the sampling rate in Hz
+ */
+ virtual void instanceInit(int sample_rate) = 0;
+
+ /**
+ * Init instance constant state
+ *
+ * @param sample_rate - the sampling rate in Hz
+ */
+ virtual void instanceConstants(int sample_rate) = 0;
+
+ /* Init default control parameters values */
+ virtual void instanceResetUserInterface() = 0;
+
+ /* Init instance state (like delay lines...) but keep the control parameter values */
+ virtual void instanceClear() = 0;
+
+ /**
+ * Return a clone of the instance.
+ *
+ * @return a copy of the instance on success, otherwise a null pointer.
+ */
+ virtual dsp* clone() = 0;
+
+ /**
+ * Trigger the Meta* parameter with instance specific calls to 'declare' (key, value) metadata.
+ *
+ * @param m - the Meta* meta user
+ */
+ virtual void metadata(Meta* m) = 0;
+
+ /**
+ * DSP instance computation, to be called with successive in/out audio buffers.
+ *
+ * @param count - the number of frames to compute
+ * @param inputs - the input audio buffers as an array of non-interleaved FAUSTFLOAT samples (eiher float, double or quad)
+ * @param outputs - the output audio buffers as an array of non-interleaved FAUSTFLOAT samples (eiher float, double or quad)
+ *
+ */
+ virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) = 0;
+
+ /**
+ * DSP instance computation: alternative method to be used by subclasses.
+ *
+ * @param date_usec - the timestamp in microsec given by audio driver.
+ * @param count - the number of frames to compute
+ * @param inputs - the input audio buffers as an array of non-interleaved FAUSTFLOAT samples (either float, double or quad)
+ * @param outputs - the output audio buffers as an array of non-interleaved FAUSTFLOAT samples (either float, double or quad)
+ *
+ */
+ virtual void compute(double /*date_usec*/, int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) { compute(count, inputs, outputs); }
+
+};
+
+/**
+ * Generic DSP decorator.
+ */
+
+class FAUST_API decorator_dsp : public dsp {
+
+ protected:
+
+ dsp* fDSP;
+
+ public:
+
+ decorator_dsp(dsp* dsp = nullptr):fDSP(dsp) {}
+ virtual ~decorator_dsp() { delete fDSP; }
+
+ virtual int getNumInputs() { return fDSP->getNumInputs(); }
+ virtual int getNumOutputs() { return fDSP->getNumOutputs(); }
+ virtual void buildUserInterface(UI* ui_interface) { fDSP->buildUserInterface(ui_interface); }
+ virtual int getSampleRate() { return fDSP->getSampleRate(); }
+ virtual void init(int sample_rate) { fDSP->init(sample_rate); }
+ virtual void instanceInit(int sample_rate) { fDSP->instanceInit(sample_rate); }
+ virtual void instanceConstants(int sample_rate) { fDSP->instanceConstants(sample_rate); }
+ virtual void instanceResetUserInterface() { fDSP->instanceResetUserInterface(); }
+ virtual void instanceClear() { fDSP->instanceClear(); }
+ virtual decorator_dsp* clone() { return new decorator_dsp(fDSP->clone()); }
+ virtual void metadata(Meta* m) { fDSP->metadata(m); }
+ // Beware: subclasses usually have to overload the two 'compute' methods
+ virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) { fDSP->compute(count, inputs, outputs); }
+ virtual void compute(double date_usec, int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) { fDSP->compute(date_usec, count, inputs, outputs); }
+
+};
+
+/**
+ * DSP factory class, used with LLVM and Interpreter backends
+ * to create DSP instances from a compiled DSP program.
+ */
+
+class FAUST_API dsp_factory {
+
+ protected:
+
+ // So that to force sub-classes to use deleteDSPFactory(dsp_factory* factory);
+ virtual ~dsp_factory() {}
+
+ public:
+
+ virtual std::string getName() = 0;
+ virtual std::string getSHAKey() = 0;
+ virtual std::string getDSPCode() = 0;
+ virtual std::string getCompileOptions() = 0;
+ virtual std::vector<std::string> getLibraryList() = 0;
+ virtual std::vector<std::string> getIncludePathnames() = 0;
+
+ virtual dsp* createDSPInstance() = 0;
+
+ virtual void setMemoryManager(dsp_memory_manager* manager) = 0;
+ virtual dsp_memory_manager* getMemoryManager() = 0;
+
+};
+
+// Denormal handling
+
+#if defined (__SSE__)
+#include <xmmintrin.h>
+#endif
+
+class FAUST_API ScopedNoDenormals {
+
+ private:
+
+ intptr_t fpsr = 0;
+
+ void setFpStatusRegister(intptr_t fpsr_aux) noexcept
+ {
+ #if defined (__arm64__) || defined (__aarch64__)
+ asm volatile("msr fpcr, %0" : : "ri" (fpsr_aux));
+ #elif defined (__SSE__)
+ // The volatile keyword here is needed to workaround a bug in AppleClang 13.0
+ // which aggressively optimises away the variable otherwise
+ volatile uint32_t fpsr_w = static_cast<uint32_t>(fpsr_aux);
+ _mm_setcsr(fpsr_w);
+ #endif
+ }
+
+ void getFpStatusRegister() noexcept
+ {
+ #if defined (__arm64__) || defined (__aarch64__)
+ asm volatile("mrs %0, fpcr" : "=r" (fpsr));
+ #elif defined (__SSE__)
+ fpsr = static_cast<intptr_t>(_mm_getcsr());
+ #endif
+ }
+
+ public:
+
+ ScopedNoDenormals() noexcept
+ {
+ #if defined (__arm64__) || defined (__aarch64__)
+ intptr_t mask = (1 << 24 /* FZ */);
+ #elif defined (__SSE__)
+ #if defined (__SSE2__)
+ intptr_t mask = 0x8040;
+ #else
+ intptr_t mask = 0x8000;
+ #endif
+ #else
+ intptr_t mask = 0x0000;
+ #endif
+ getFpStatusRegister();
+ setFpStatusRegister(fpsr | mask);
+ }
+
+ ~ScopedNoDenormals() noexcept
+ {
+ setFpStatusRegister(fpsr);
+ }
+
+};
+
+#define AVOIDDENORMALS ScopedNoDenormals ftz_scope;
+
+#endif
+
+/************************** END dsp.h **************************/
+/************************** BEGIN APIUI.h *****************************
+FAUST Architecture File
+Copyright (C) 2003-2022 GRAME, Centre National de Creation Musicale
+---------------------------------------------------------------------
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+EXCEPTION : As a special exception, you may create a larger work
+that contains this FAUST architecture section and distribute
+that work under terms of your choice, so long as this FAUST
+architecture section is not modified.
+************************************************************************/
+
+#ifndef API_UI_H
+#define API_UI_H
+
+#include <sstream>
+#include <string>
+#include <vector>
+#include <stdio.h>
+#include <map>
+
+/************************** BEGIN meta.h *******************************
+ FAUST Architecture File
+ Copyright (C) 2003-2022 GRAME, Centre National de Creation Musicale
+ ---------------------------------------------------------------------
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ EXCEPTION : As a special exception, you may create a larger work
+ that contains this FAUST architecture section and distribute
+ that work under terms of your choice, so long as this FAUST
+ architecture section is not modified.
+ ************************************************************************/
+
+#ifndef __meta__
+#define __meta__
+
+
+/**
+ The base class of Meta handler to be used in dsp::metadata(Meta* m) method to retrieve (key, value) metadata.
+ */
+struct FAUST_API Meta {
+ virtual ~Meta() {}
+ virtual void declare(const char* key, const char* value) = 0;
+};
+
+#endif
+/************************** END meta.h **************************/
+/************************** BEGIN UI.h *****************************
+ FAUST Architecture File
+ Copyright (C) 2003-2022 GRAME, Centre National de Creation Musicale
+ ---------------------------------------------------------------------
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ EXCEPTION : As a special exception, you may create a larger work
+ that contains this FAUST architecture section and distribute
+ that work under terms of your choice, so long as this FAUST
+ architecture section is not modified.
+ ********************************************************************/
+
+#ifndef __UI_H__
+#define __UI_H__
+
+
+#ifndef FAUSTFLOAT
+#define FAUSTFLOAT float
+#endif
+
+/*******************************************************************************
+ * UI : Faust DSP User Interface
+ * User Interface as expected by the buildUserInterface() method of a DSP.
+ * This abstract class contains only the method that the Faust compiler can
+ * generate to describe a DSP user interface.
+ ******************************************************************************/
+
+struct Soundfile;
+
+template <typename REAL>
+struct FAUST_API UIReal {
+
+ UIReal() {}
+ virtual ~UIReal() {}
+
+ // -- widget's layouts
+
+ virtual void openTabBox(const char* label) = 0;
+ virtual void openHorizontalBox(const char* label) = 0;
+ virtual void openVerticalBox(const char* label) = 0;
+ virtual void closeBox() = 0;
+
+ // -- active widgets
+
+ virtual void addButton(const char* label, REAL* zone) = 0;
+ virtual void addCheckButton(const char* label, REAL* zone) = 0;
+ virtual void addVerticalSlider(const char* label, REAL* zone, REAL init, REAL min, REAL max, REAL step) = 0;
+ virtual void addHorizontalSlider(const char* label, REAL* zone, REAL init, REAL min, REAL max, REAL step) = 0;
+ virtual void addNumEntry(const char* label, REAL* zone, REAL init, REAL min, REAL max, REAL step) = 0;
+
+ // -- passive widgets
+
+ virtual void addHorizontalBargraph(const char* label, REAL* zone, REAL min, REAL max) = 0;
+ virtual void addVerticalBargraph(const char* label, REAL* zone, REAL min, REAL max) = 0;
+
+ // -- soundfiles
+
+ virtual void addSoundfile(const char* label, const char* filename, Soundfile** sf_zone) = 0;
+
+ // -- metadata declarations
+
+ virtual void declare(REAL* /*zone*/, const char* /*key*/, const char* /*val*/) {}
+
+ // To be used by LLVM client
+ virtual int sizeOfFAUSTFLOAT() { return sizeof(FAUSTFLOAT); }
+};
+
+struct FAUST_API UI : public UIReal<FAUSTFLOAT> {
+ UI() {}
+ virtual ~UI() {}
+};
+
+#endif
+/************************** END UI.h **************************/
+/************************** BEGIN PathBuilder.h **************************
+ FAUST Architecture File
+ Copyright (C) 2003-2022 GRAME, Centre National de Creation Musicale
+ ---------------------------------------------------------------------
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ EXCEPTION : As a special exception, you may create a larger work
+ that contains this FAUST architecture section and distribute
+ that work under terms of your choice, so long as this FAUST
+ architecture section is not modified.
+ ************************************************************************/
+
+#ifndef __PathBuilder__
+#define __PathBuilder__
+
+#include <vector>
+#include <set>
+#include <map>
+#include <string>
+#include <algorithm>
+#include <regex>
+
+
+/*******************************************************************************
+ * PathBuilder : Faust User Interface
+ * Helper class to build complete hierarchical path for UI items.
+ ******************************************************************************/
+
+class FAUST_API PathBuilder {
+
+ protected:
+
+ std::vector<std::string> fControlsLevel;
+ std::vector<std::string> fFullPaths;
+ std::map<std::string, std::string> fFull2Short; // filled by computeShortNames()
+
+ /**
+ * @brief check if a character is acceptable for an ID
+ *
+ * @param c
+ * @return true is the character is acceptable for an ID
+ */
+ bool isIDChar(char c) const
+ {
+ return ((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z')) || ((c >= '0') && (c <= '9'));
+ }
+
+ /**
+ * @brief remove all "/0x00" parts
+ *
+ * @param src
+ * @return modified string
+ */
+ std::string remove0x00(const std::string& src) const
+ {
+ return std::regex_replace(src, std::regex("/0x00"), "");
+ }
+
+ /**
+ * @brief replace all non ID char with '_' (one '_' may replace several non ID char)
+ *
+ * @param src
+ * @return modified string
+ */
+ std::string str2ID(const std::string& src) const
+ {
+ std::string dst;
+ bool need_underscore = false;
+ for (char c : src) {
+ if (isIDChar(c) || (c == '/')) {
+ if (need_underscore) {
+ dst.push_back('_');
+ need_underscore = false;
+ }
+ dst.push_back(c);
+ } else {
+ need_underscore = true;
+ }
+ }
+ return dst;
+ }
+
+ /**
+ * @brief Keep only the last n slash-parts
+ *
+ * @param src
+ * @param n : 1 indicates the last slash-part
+ * @return modified string
+ */
+ std::string cut(const std::string& src, int n) const
+ {
+ std::string rdst;
+ for (int i = int(src.length())-1; i >= 0; i--) {
+ char c = src[i];
+ if (c != '/') {
+ rdst.push_back(c);
+ } else if (n == 1) {
+ std::string dst;
+ for (int j = int(rdst.length())-1; j >= 0; j--) {
+ dst.push_back(rdst[j]);
+ }
+ return dst;
+ } else {
+ n--;
+ rdst.push_back(c);
+ }
+ }
+ return src;
+ }
+
+ void addFullPath(const std::string& label) { fFullPaths.push_back(buildPath(label)); }
+
+ /**
+ * @brief Compute the mapping between full path and short names
+ */
+ void computeShortNames()
+ {
+ std::vector<std::string> uniquePaths; // all full paths transformed but made unique with a prefix
+ std::map<std::string, std::string> unique2full; // all full paths transformed but made unique with a prefix
+ char num_buffer[16];
+ int pnum = 0;
+
+ for (const auto& s : fFullPaths) {
+ sprintf(num_buffer, "%d", pnum++);
+ std::string u = "/P" + std::string(num_buffer) + str2ID(remove0x00(s));
+ uniquePaths.push_back(u);
+ unique2full[u] = s; // remember the full path associated to a unique path
+ }
+
+ std::map<std::string, int> uniquePath2level; // map path to level
+ for (const auto& s : uniquePaths) uniquePath2level[s] = 1; // we init all levels to 1
+ bool have_collisions = true;
+
+ while (have_collisions) {
+ // compute collision list
+ std::set<std::string> collisionSet;
+ std::map<std::string, std::string> short2full;
+ have_collisions = false;
+ for (const auto& it : uniquePath2level) {
+ std::string u = it.first;
+ int n = it.second;
+ std::string shortName = cut(u, n);
+ auto p = short2full.find(shortName);
+ if (p == short2full.end()) {
+ // no collision
+ short2full[shortName] = u;
+ } else {
+ // we have a collision, add the two paths to the collision set
+ have_collisions = true;
+ collisionSet.insert(u);
+ collisionSet.insert(p->second);
+ }
+ }
+ for (const auto& s : collisionSet) uniquePath2level[s]++; // increase level of colliding path
+ }
+
+ for (const auto& it : uniquePath2level) {
+ std::string u = it.first;
+ int n = it.second;
+ std::string shortName = replaceCharList(cut(u, n), {'/'}, '_');
+ fFull2Short[unique2full[u]] = shortName;
+ }
+ }
+
+ std::string replaceCharList(const std::string& str, const std::vector<char>& ch1, char ch2)
+ {
+ auto beg = ch1.begin();
+ auto end = ch1.end();
+ std::string res = str;
+ for (size_t i = 0; i < str.length(); ++i) {
+ if (std::find(beg, end, str[i]) != end) res[i] = ch2;
+ }
+ return res;
+ }
+
+ public:
+
+ PathBuilder() {}
+ virtual ~PathBuilder() {}
+
+ // Return true for the first level of groups
+ bool pushLabel(const std::string& label) { fControlsLevel.push_back(label); return fControlsLevel.size() == 1;}
+
+ // Return true for the last level of groups
+ bool popLabel() { fControlsLevel.pop_back(); return fControlsLevel.size() == 0; }
+
+ std::string buildPath(const std::string& label)
+ {
+ std::string res = "/";
+ for (size_t i = 0; i < fControlsLevel.size(); i++) {
+ res = res + fControlsLevel[i] + "/";
+ }
+ res += label;
+ return replaceCharList(res, {' ', '#', '*', ',', '?', '[', ']', '{', '}', '(', ')'}, '_');
+ }
+
+};
+
+#endif // __PathBuilder__
+/************************** END PathBuilder.h **************************/
+/************************** BEGIN ValueConverter.h ********************
+ FAUST Architecture File
+ Copyright (C) 2003-2022 GRAME, Centre National de Creation Musicale
+ ---------------------------------------------------------------------
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ EXCEPTION : As a special exception, you may create a larger work
+ that contains this FAUST architecture section and distribute
+ that work under terms of your choice, so long as this FAUST
+ architecture section is not modified.
+ ********************************************************************/
+
+#ifndef __ValueConverter__
+#define __ValueConverter__
+
+/***************************************************************************************
+ ValueConverter.h
+ (GRAME, Copyright 2015-2019)
+
+ Set of conversion objects used to map user interface values (for example a gui slider
+ delivering values between 0 and 1) to faust values (for example a vslider between
+ 20 and 20000) using a log scale.
+
+ -- Utilities
+
+ Range(lo,hi) : clip a value x between lo and hi
+ Interpolator(lo,hi,v1,v2) : Maps a value x between lo and hi to a value y between v1 and v2
+ Interpolator3pt(lo,mi,hi,v1,vm,v2) : Map values between lo mid hi to values between v1 vm v2
+
+ -- Value Converters
+
+ ValueConverter::ui2faust(x)
+ ValueConverter::faust2ui(x)
+
+ -- ValueConverters used for sliders depending of the scale
+
+ LinearValueConverter(umin, umax, fmin, fmax)
+ LinearValueConverter2(lo, mi, hi, v1, vm, v2) using 2 segments
+ LogValueConverter(umin, umax, fmin, fmax)
+ ExpValueConverter(umin, umax, fmin, fmax)
+
+ -- ValueConverters used for accelerometers based on 3 points
+
+ AccUpConverter(amin, amid, amax, fmin, fmid, fmax) -- curve 0
+ AccDownConverter(amin, amid, amax, fmin, fmid, fmax) -- curve 1
+ AccUpDownConverter(amin, amid, amax, fmin, fmid, fmax) -- curve 2
+ AccDownUpConverter(amin, amid, amax, fmin, fmid, fmax) -- curve 3
+
+ -- lists of ZoneControl are used to implement accelerometers metadata for each axes
+
+ ZoneControl(zone, valueConverter) : a zone with an accelerometer data converter
+
+ -- ZoneReader are used to implement screencolor metadata
+
+ ZoneReader(zone, valueConverter) : a zone with a data converter
+
+****************************************************************************************/
+
+#include <float.h>
+#include <algorithm> // std::max
+#include <cmath>
+#include <vector>
+#include <assert.h>
+
+
+//--------------------------------------------------------------------------------------
+// Interpolator(lo,hi,v1,v2)
+// Maps a value x between lo and hi to a value y between v1 and v2
+// y = v1 + (x-lo)/(hi-lo)*(v2-v1)
+// y = v1 + (x-lo) * coef with coef = (v2-v1)/(hi-lo)
+// y = v1 + x*coef - lo*coef
+// y = v1 - lo*coef + x*coef
+// y = offset + x*coef with offset = v1 - lo*coef
+//--------------------------------------------------------------------------------------
+class FAUST_API Interpolator {
+
+ private:
+
+ //--------------------------------------------------------------------------------------
+ // Range(lo,hi) clip a value between lo and hi
+ //--------------------------------------------------------------------------------------
+ struct Range
+ {
+ double fLo;
+ double fHi;
+
+ Range(double x, double y) : fLo(std::min<double>(x,y)), fHi(std::max<double>(x,y)) {}
+ double operator()(double x) { return (x<fLo) ? fLo : (x>fHi) ? fHi : x; }
+ };
+
+
+ Range fRange;
+ double fCoef;
+ double fOffset;
+
+ public:
+
+ Interpolator(double lo, double hi, double v1, double v2) : fRange(lo,hi)
+ {
+ if (hi != lo) {
+ // regular case
+ fCoef = (v2-v1)/(hi-lo);
+ fOffset = v1 - lo*fCoef;
+ } else {
+ // degenerate case, avoids division by zero
+ fCoef = 0;
+ fOffset = (v1+v2)/2;
+ }
+ }
+ double operator()(double v)
+ {
+ double x = fRange(v);
+ return fOffset + x*fCoef;
+ }
+
+ void getLowHigh(double& amin, double& amax)
+ {
+ amin = fRange.fLo;
+ amax = fRange.fHi;
+ }
+};
+
+//--------------------------------------------------------------------------------------
+// Interpolator3pt(lo,mi,hi,v1,vm,v2)
+// Map values between lo mid hi to values between v1 vm v2
+//--------------------------------------------------------------------------------------
+class FAUST_API Interpolator3pt {
+
+ private:
+
+ Interpolator fSegment1;
+ Interpolator fSegment2;
+ double fMid;
+
+ public:
+
+ Interpolator3pt(double lo, double mi, double hi, double v1, double vm, double v2) :
+ fSegment1(lo, mi, v1, vm),
+ fSegment2(mi, hi, vm, v2),
+ fMid(mi) {}
+ double operator()(double x) { return (x < fMid) ? fSegment1(x) : fSegment2(x); }
+
+ void getMappingValues(double& amin, double& amid, double& amax)
+ {
+ fSegment1.getLowHigh(amin, amid);
+ fSegment2.getLowHigh(amid, amax);
+ }
+};
+
+//--------------------------------------------------------------------------------------
+// Abstract ValueConverter class. Converts values between UI and Faust representations
+//--------------------------------------------------------------------------------------
+class FAUST_API ValueConverter {
+
+ public:
+
+ virtual ~ValueConverter() {}
+ virtual double ui2faust(double x) { return x; };
+ virtual double faust2ui(double x) { return x; };
+};
+
+//--------------------------------------------------------------------------------------
+// A converter than can be updated
+//--------------------------------------------------------------------------------------
+
+class FAUST_API UpdatableValueConverter : public ValueConverter {
+
+ protected:
+
+ bool fActive;
+
+ public:
+
+ UpdatableValueConverter():fActive(true)
+ {}
+ virtual ~UpdatableValueConverter()
+ {}
+
+ virtual void setMappingValues(double amin, double amid, double amax, double min, double init, double max) = 0;
+ virtual void getMappingValues(double& amin, double& amid, double& amax) = 0;
+
+ void setActive(bool on_off) { fActive = on_off; }
+ bool getActive() { return fActive; }
+
+};
+
+//--------------------------------------------------------------------------------------
+// Linear conversion between ui and Faust values
+//--------------------------------------------------------------------------------------
+class FAUST_API LinearValueConverter : public ValueConverter {
+
+ private:
+
+ Interpolator fUI2F;
+ Interpolator fF2UI;
+
+ public:
+
+ LinearValueConverter(double umin, double umax, double fmin, double fmax) :
+ fUI2F(umin,umax,fmin,fmax), fF2UI(fmin,fmax,umin,umax)
+ {}
+
+ LinearValueConverter() : fUI2F(0.,0.,0.,0.), fF2UI(0.,0.,0.,0.)
+ {}
+ virtual double ui2faust(double x) { return fUI2F(x); }
+ virtual double faust2ui(double x) { return fF2UI(x); }
+
+};
+
+//--------------------------------------------------------------------------------------
+// Two segments linear conversion between ui and Faust values
+//--------------------------------------------------------------------------------------
+class FAUST_API LinearValueConverter2 : public UpdatableValueConverter {
+
+ private:
+
+ Interpolator3pt fUI2F;
+ Interpolator3pt fF2UI;
+
+ public:
+
+ LinearValueConverter2(double amin, double amid, double amax, double min, double init, double max) :
+ fUI2F(amin, amid, amax, min, init, max), fF2UI(min, init, max, amin, amid, amax)
+ {}
+
+ LinearValueConverter2() : fUI2F(0.,0.,0.,0.,0.,0.), fF2UI(0.,0.,0.,0.,0.,0.)
+ {}
+
+ virtual double ui2faust(double x) { return fUI2F(x); }
+ virtual double faust2ui(double x) { return fF2UI(x); }
+
+ virtual void setMappingValues(double amin, double amid, double amax, double min, double init, double max)
+ {
+ fUI2F = Interpolator3pt(amin, amid, amax, min, init, max);
+ fF2UI = Interpolator3pt(min, init, max, amin, amid, amax);
+ }
+
+ virtual void getMappingValues(double& amin, double& amid, double& amax)
+ {
+ fUI2F.getMappingValues(amin, amid, amax);
+ }
+
+};
+
+//--------------------------------------------------------------------------------------
+// Logarithmic conversion between ui and Faust values
+//--------------------------------------------------------------------------------------
+class FAUST_API LogValueConverter : public LinearValueConverter {
+
+ public:
+
+ LogValueConverter(double umin, double umax, double fmin, double fmax) :
+ LinearValueConverter(umin, umax, std::log(std::max<double>(DBL_MIN, fmin)), std::log(std::max<double>(DBL_MIN, fmax)))
+ {}
+
+ virtual double ui2faust(double x) { return std::exp(LinearValueConverter::ui2faust(x)); }
+ virtual double faust2ui(double x) { return LinearValueConverter::faust2ui(std::log(std::max<double>(x, DBL_MIN))); }
+
+};
+
+//--------------------------------------------------------------------------------------
+// Exponential conversion between ui and Faust values
+//--------------------------------------------------------------------------------------
+class FAUST_API ExpValueConverter : public LinearValueConverter {
+
+ public:
+
+ ExpValueConverter(double umin, double umax, double fmin, double fmax) :
+ LinearValueConverter(umin, umax, std::min<double>(DBL_MAX, std::exp(fmin)), std::min<double>(DBL_MAX, std::exp(fmax)))
+ {}
+
+ virtual double ui2faust(double x) { return std::log(LinearValueConverter::ui2faust(x)); }
+ virtual double faust2ui(double x) { return LinearValueConverter::faust2ui(std::min<double>(DBL_MAX, std::exp(x))); }
+
+};
+
+//--------------------------------------------------------------------------------------
+// Convert accelerometer or gyroscope values to Faust values
+// Using an Up curve (curve 0)
+//--------------------------------------------------------------------------------------
+class FAUST_API AccUpConverter : public UpdatableValueConverter {
+
+ private:
+
+ Interpolator3pt fA2F;
+ Interpolator3pt fF2A;
+
+ public:
+
+ AccUpConverter(double amin, double amid, double amax, double fmin, double fmid, double fmax) :
+ fA2F(amin,amid,amax,fmin,fmid,fmax),
+ fF2A(fmin,fmid,fmax,amin,amid,amax)
+ {}
+
+ virtual double ui2faust(double x) { return fA2F(x); }
+ virtual double faust2ui(double x) { return fF2A(x); }
+
+ virtual void setMappingValues(double amin, double amid, double amax, double fmin, double fmid, double fmax)
+ {
+ //__android_log_print(ANDROID_LOG_ERROR, "Faust", "AccUpConverter update %f %f %f %f %f %f", amin,amid,amax,fmin,fmid,fmax);
+ fA2F = Interpolator3pt(amin, amid, amax, fmin, fmid, fmax);
+ fF2A = Interpolator3pt(fmin, fmid, fmax, amin, amid, amax);
+ }
+
+ virtual void getMappingValues(double& amin, double& amid, double& amax)
+ {
+ fA2F.getMappingValues(amin, amid, amax);
+ }
+
+};
+
+//--------------------------------------------------------------------------------------
+// Convert accelerometer or gyroscope values to Faust values
+// Using a Down curve (curve 1)
+//--------------------------------------------------------------------------------------
+class FAUST_API AccDownConverter : public UpdatableValueConverter {
+
+ private:
+
+ Interpolator3pt fA2F;
+ Interpolator3pt fF2A;
+
+ public:
+
+ AccDownConverter(double amin, double amid, double amax, double fmin, double fmid, double fmax) :
+ fA2F(amin,amid,amax,fmax,fmid,fmin),
+ fF2A(fmin,fmid,fmax,amax,amid,amin)
+ {}
+
+ virtual double ui2faust(double x) { return fA2F(x); }
+ virtual double faust2ui(double x) { return fF2A(x); }
+
+ virtual void setMappingValues(double amin, double amid, double amax, double fmin, double fmid, double fmax)
+ {
+ //__android_log_print(ANDROID_LOG_ERROR, "Faust", "AccDownConverter update %f %f %f %f %f %f", amin,amid,amax,fmin,fmid,fmax);
+ fA2F = Interpolator3pt(amin, amid, amax, fmax, fmid, fmin);
+ fF2A = Interpolator3pt(fmin, fmid, fmax, amax, amid, amin);
+ }
+
+ virtual void getMappingValues(double& amin, double& amid, double& amax)
+ {
+ fA2F.getMappingValues(amin, amid, amax);
+ }
+};
+
+//--------------------------------------------------------------------------------------
+// Convert accelerometer or gyroscope values to Faust values
+// Using an Up-Down curve (curve 2)
+//--------------------------------------------------------------------------------------
+class FAUST_API AccUpDownConverter : public UpdatableValueConverter {
+
+ private:
+
+ Interpolator3pt fA2F;
+ Interpolator fF2A;
+
+ public:
+
+ AccUpDownConverter(double amin, double amid, double amax, double fmin, double /*fmid*/, double fmax) :
+ fA2F(amin,amid,amax,fmin,fmax,fmin),
+ fF2A(fmin,fmax,amin,amax) // Special, pseudo inverse of a non monotonic function
+ {}
+
+ virtual double ui2faust(double x) { return fA2F(x); }
+ virtual double faust2ui(double x) { return fF2A(x); }
+
+ virtual void setMappingValues(double amin, double amid, double amax, double fmin, double /*fmid*/, double fmax)
+ {
+ //__android_log_print(ANDROID_LOG_ERROR, "Faust", "AccUpDownConverter update %f %f %f %f %f %f", amin,amid,amax,fmin,fmid,fmax);
+ fA2F = Interpolator3pt(amin, amid, amax, fmin, fmax, fmin);
+ fF2A = Interpolator(fmin, fmax, amin, amax);
+ }
+
+ virtual void getMappingValues(double& amin, double& amid, double& amax)
+ {
+ fA2F.getMappingValues(amin, amid, amax);
+ }
+};
+
+//--------------------------------------------------------------------------------------
+// Convert accelerometer or gyroscope values to Faust values
+// Using a Down-Up curve (curve 3)
+//--------------------------------------------------------------------------------------
+class FAUST_API AccDownUpConverter : public UpdatableValueConverter {
+
+ private:
+
+ Interpolator3pt fA2F;
+ Interpolator fF2A;
+
+ public:
+
+ AccDownUpConverter(double amin, double amid, double amax, double fmin, double /*fmid*/, double fmax) :
+ fA2F(amin,amid,amax,fmax,fmin,fmax),
+ fF2A(fmin,fmax,amin,amax) // Special, pseudo inverse of a non monotonic function
+ {}
+
+ virtual double ui2faust(double x) { return fA2F(x); }
+ virtual double faust2ui(double x) { return fF2A(x); }
+
+ virtual void setMappingValues(double amin, double amid, double amax, double fmin, double /*fmid*/, double fmax)
+ {
+ //__android_log_print(ANDROID_LOG_ERROR, "Faust", "AccDownUpConverter update %f %f %f %f %f %f", amin,amid,amax,fmin,fmid,fmax);
+ fA2F = Interpolator3pt(amin, amid, amax, fmax, fmin, fmax);
+ fF2A = Interpolator(fmin, fmax, amin, amax);
+ }
+
+ virtual void getMappingValues(double& amin, double& amid, double& amax)
+ {
+ fA2F.getMappingValues(amin, amid, amax);
+ }
+};
+
+//--------------------------------------------------------------------------------------
+// Base class for ZoneControl
+//--------------------------------------------------------------------------------------
+class FAUST_API ZoneControl {
+
+ protected:
+
+ FAUSTFLOAT* fZone;
+
+ public:
+
+ ZoneControl(FAUSTFLOAT* zone) : fZone(zone) {}
+ virtual ~ZoneControl() {}
+
+ virtual void update(double /*v*/) const {}
+
+ virtual void setMappingValues(int /*curve*/, double /*amin*/, double /*amid*/, double /*amax*/, double /*min*/, double /*init*/, double /*max*/) {}
+ virtual void getMappingValues(double& /*amin*/, double& /*amid*/, double& /*amax*/) {}
+
+ FAUSTFLOAT* getZone() { return fZone; }
+
+ virtual void setActive(bool /*on_off*/) {}
+ virtual bool getActive() { return false; }
+
+ virtual int getCurve() { return -1; }
+
+};
+
+//--------------------------------------------------------------------------------------
+// Useful to implement accelerometers metadata as a list of ZoneControl for each axes
+//--------------------------------------------------------------------------------------
+class FAUST_API ConverterZoneControl : public ZoneControl {
+
+ protected:
+
+ ValueConverter* fValueConverter;
+
+ public:
+
+ ConverterZoneControl(FAUSTFLOAT* zone, ValueConverter* converter) : ZoneControl(zone), fValueConverter(converter) {}
+ virtual ~ConverterZoneControl() { delete fValueConverter; } // Assuming fValueConverter is not kept elsewhere...
+
+ virtual void update(double v) const { *fZone = FAUSTFLOAT(fValueConverter->ui2faust(v)); }
+
+ ValueConverter* getConverter() { return fValueConverter; }
+
+};
+
+//--------------------------------------------------------------------------------------
+// Association of a zone and a four value converter, each one for each possible curve.
+// Useful to implement accelerometers metadata as a list of ZoneControl for each axes
+//--------------------------------------------------------------------------------------
+class FAUST_API CurveZoneControl : public ZoneControl {
+
+ private:
+
+ std::vector<UpdatableValueConverter*> fValueConverters;
+ int fCurve;
+
+ public:
+
+ CurveZoneControl(FAUSTFLOAT* zone, int curve, double amin, double amid, double amax, double min, double init, double max) : ZoneControl(zone), fCurve(0)
+ {
+ assert(curve >= 0 && curve <= 3);
+ fValueConverters.push_back(new AccUpConverter(amin, amid, amax, min, init, max));
+ fValueConverters.push_back(new AccDownConverter(amin, amid, amax, min, init, max));
+ fValueConverters.push_back(new AccUpDownConverter(amin, amid, amax, min, init, max));
+ fValueConverters.push_back(new AccDownUpConverter(amin, amid, amax, min, init, max));
+ fCurve = curve;
+ }
+ virtual ~CurveZoneControl()
+ {
+ for (const auto& it : fValueConverters) { delete it; }
+ }
+ void update(double v) const { if (fValueConverters[fCurve]->getActive()) *fZone = FAUSTFLOAT(fValueConverters[fCurve]->ui2faust(v)); }
+
+ void setMappingValues(int curve, double amin, double amid, double amax, double min, double init, double max)
+ {
+ fValueConverters[curve]->setMappingValues(amin, amid, amax, min, init, max);
+ fCurve = curve;
+ }
+
+ void getMappingValues(double& amin, double& amid, double& amax)
+ {
+ fValueConverters[fCurve]->getMappingValues(amin, amid, amax);
+ }
+
+ void setActive(bool on_off)
+ {
+ for (const auto& it : fValueConverters) { it->setActive(on_off); }
+ }
+
+ int getCurve() { return fCurve; }
+};
+
+class FAUST_API ZoneReader {
+
+ private:
+
+ FAUSTFLOAT* fZone;
+ Interpolator fInterpolator;
+
+ public:
+
+ ZoneReader(FAUSTFLOAT* zone, double lo, double hi) : fZone(zone), fInterpolator(lo, hi, 0, 255) {}
+
+ virtual ~ZoneReader() {}
+
+ int getValue()
+ {
+ return (fZone != nullptr) ? int(fInterpolator(*fZone)) : 127;
+ }
+
+};
+
+#endif
+/************************** END ValueConverter.h **************************/
+
+typedef unsigned int uint;
+
+class APIUI : public PathBuilder, public Meta, public UI
+{
+ public:
+ enum ItemType { kButton = 0, kCheckButton, kVSlider, kHSlider, kNumEntry, kHBargraph, kVBargraph };
+ enum Type { kAcc = 0, kGyr = 1, kNoType };
+
+ protected:
+
+ enum Mapping { kLin = 0, kLog = 1, kExp = 2 };
+
+ struct Item {
+ std::string fLabel;
+ std::string fShortname;
+ std::string fPath;
+ ValueConverter* fConversion;
+ FAUSTFLOAT* fZone;
+ FAUSTFLOAT fInit;
+ FAUSTFLOAT fMin;
+ FAUSTFLOAT fMax;
+ FAUSTFLOAT fStep;
+ ItemType fItemType;
+
+ Item(const std::string& label,
+ const std::string& short_name,
+ const std::string& path,
+ ValueConverter* conversion,
+ FAUSTFLOAT* zone,
+ FAUSTFLOAT init,
+ FAUSTFLOAT min,
+ FAUSTFLOAT max,
+ FAUSTFLOAT step,
+ ItemType item_type)
+ :fLabel(label), fShortname(short_name), fPath(path), fConversion(conversion),
+ fZone(zone), fInit(init), fMin(min), fMax(max), fStep(step), fItemType(item_type)
+ {}
+ };
+ std::vector<Item> fItems;
+
+ std::vector<std::map<std::string, std::string> > fMetaData;
+ std::vector<ZoneControl*> fAcc[3];
+ std::vector<ZoneControl*> fGyr[3];
+
+ // Screen color control
+ // "...[screencolor:red]..." etc.
+ bool fHasScreenControl; // true if control screen color metadata
+ ZoneReader* fRedReader;
+ ZoneReader* fGreenReader;
+ ZoneReader* fBlueReader;
+
+ // Current values controlled by metadata
+ std::string fCurrentUnit;
+ int fCurrentScale;
+ std::string fCurrentAcc;
+ std::string fCurrentGyr;
+ std::string fCurrentColor;
+ std::string fCurrentTooltip;
+ std::map<std::string, std::string> fCurrentMetadata;
+
+ // Add a generic parameter
+ virtual void addParameter(const char* label,
+ FAUSTFLOAT* zone,
+ FAUSTFLOAT init,
+ FAUSTFLOAT min,
+ FAUSTFLOAT max,
+ FAUSTFLOAT step,
+ ItemType type)
+ {
+ std::string path = buildPath(label);
+ fFullPaths.push_back(path);
+
+ // handle scale metadata
+ ValueConverter* converter = nullptr;
+ switch (fCurrentScale) {
+ case kLin:
+ converter = new LinearValueConverter(0, 1, min, max);
+ break;
+ case kLog:
+ converter = new LogValueConverter(0, 1, min, max);
+ break;
+ case kExp:
+ converter = new ExpValueConverter(0, 1, min, max);
+ break;
+ }
+ fCurrentScale = kLin;
+
+ fItems.push_back(Item(label, "", path, converter, zone, init, min, max, step, type));
+
+ if (fCurrentAcc.size() > 0 && fCurrentGyr.size() > 0) {
+ fprintf(stderr, "warning : 'acc' and 'gyr' metadata used for the same %s parameter !!\n", label);
+ }
+
+ // handle acc metadata "...[acc : <axe> <curve> <amin> <amid> <amax>]..."
+ if (fCurrentAcc.size() > 0) {
+ std::istringstream iss(fCurrentAcc);
+ int axe, curve;
+ double amin, amid, amax;
+ iss >> axe >> curve >> amin >> amid >> amax;
+
+ if ((0 <= axe) && (axe < 3) &&
+ (0 <= curve) && (curve < 4) &&
+ (amin < amax) && (amin <= amid) && (amid <= amax))
+ {
+ fAcc[axe].push_back(new CurveZoneControl(zone, curve, amin, amid, amax, min, init, max));
+ } else {
+ fprintf(stderr, "incorrect acc metadata : %s \n", fCurrentAcc.c_str());
+ }
+ fCurrentAcc = "";
+ }
+
+ // handle gyr metadata "...[gyr : <axe> <curve> <amin> <amid> <amax>]..."
+ if (fCurrentGyr.size() > 0) {
+ std::istringstream iss(fCurrentGyr);
+ int axe, curve;
+ double amin, amid, amax;
+ iss >> axe >> curve >> amin >> amid >> amax;
+
+ if ((0 <= axe) && (axe < 3) &&
+ (0 <= curve) && (curve < 4) &&
+ (amin < amax) && (amin <= amid) && (amid <= amax))
+ {
+ fGyr[axe].push_back(new CurveZoneControl(zone, curve, amin, amid, amax, min, init, max));
+ } else {
+ fprintf(stderr, "incorrect gyr metadata : %s \n", fCurrentGyr.c_str());
+ }
+ fCurrentGyr = "";
+ }
+
+ // handle screencolor metadata "...[screencolor:red|green|blue|white]..."
+ if (fCurrentColor.size() > 0) {
+ if ((fCurrentColor == "red") && (fRedReader == nullptr)) {
+ fRedReader = new ZoneReader(zone, min, max);
+ fHasScreenControl = true;
+ } else if ((fCurrentColor == "green") && (fGreenReader == nullptr)) {
+ fGreenReader = new ZoneReader(zone, min, max);
+ fHasScreenControl = true;
+ } else if ((fCurrentColor == "blue") && (fBlueReader == nullptr)) {
+ fBlueReader = new ZoneReader(zone, min, max);
+ fHasScreenControl = true;
+ } else if ((fCurrentColor == "white") && (fRedReader == nullptr) && (fGreenReader == nullptr) && (fBlueReader == nullptr)) {
+ fRedReader = new ZoneReader(zone, min, max);
+ fGreenReader = new ZoneReader(zone, min, max);
+ fBlueReader = new ZoneReader(zone, min, max);
+ fHasScreenControl = true;
+ } else {
+ fprintf(stderr, "incorrect screencolor metadata : %s \n", fCurrentColor.c_str());
+ }
+ }
+ fCurrentColor = "";
+
+ fMetaData.push_back(fCurrentMetadata);
+ fCurrentMetadata.clear();
+ }
+
+ int getZoneIndex(std::vector<ZoneControl*>* table, int p, int val)
+ {
+ FAUSTFLOAT* zone = fItems[uint(p)].fZone;
+ for (size_t i = 0; i < table[val].size(); i++) {
+ if (zone == table[val][i]->getZone()) return int(i);
+ }
+ return -1;
+ }
+
+ void setConverter(std::vector<ZoneControl*>* table, int p, int val, int curve, double amin, double amid, double amax)
+ {
+ int id1 = getZoneIndex(table, p, 0);
+ int id2 = getZoneIndex(table, p, 1);
+ int id3 = getZoneIndex(table, p, 2);
+
+ // Deactivates everywhere..
+ if (id1 != -1) table[0][uint(id1)]->setActive(false);
+ if (id2 != -1) table[1][uint(id2)]->setActive(false);
+ if (id3 != -1) table[2][uint(id3)]->setActive(false);
+
+ if (val == -1) { // Means: no more mapping...
+ // So stay all deactivated...
+ } else {
+ int id4 = getZoneIndex(table, p, val);
+ if (id4 != -1) {
+ // Reactivate the one we edit...
+ table[val][uint(id4)]->setMappingValues(curve, amin, amid, amax, fItems[uint(p)].fMin, fItems[uint(p)].fInit, fItems[uint(p)].fMax);
+ table[val][uint(id4)]->setActive(true);
+ } else {
+ // Allocate a new CurveZoneControl which is 'active' by default
+ FAUSTFLOAT* zone = fItems[uint(p)].fZone;
+ table[val].push_back(new CurveZoneControl(zone, curve, amin, amid, amax, fItems[uint(p)].fMin, fItems[uint(p)].fInit, fItems[uint(p)].fMax));
+ }
+ }
+ }
+
+ void getConverter(std::vector<ZoneControl*>* table, int p, int& val, int& curve, double& amin, double& amid, double& amax)
+ {
+ int id1 = getZoneIndex(table, p, 0);
+ int id2 = getZoneIndex(table, p, 1);
+ int id3 = getZoneIndex(table, p, 2);
+
+ if (id1 != -1) {
+ val = 0;
+ curve = table[val][uint(id1)]->getCurve();
+ table[val][uint(id1)]->getMappingValues(amin, amid, amax);
+ } else if (id2 != -1) {
+ val = 1;
+ curve = table[val][uint(id2)]->getCurve();
+ table[val][uint(id2)]->getMappingValues(amin, amid, amax);
+ } else if (id3 != -1) {
+ val = 2;
+ curve = table[val][uint(id3)]->getCurve();
+ table[val][uint(id3)]->getMappingValues(amin, amid, amax);
+ } else {
+ val = -1; // No mapping
+ curve = 0;
+ amin = -100.;
+ amid = 0.;
+ amax = 100.;
+ }
+ }
+
+ public:
+
+ APIUI() : fHasScreenControl(false), fRedReader(nullptr), fGreenReader(nullptr), fBlueReader(nullptr), fCurrentScale(kLin)
+ {}
+
+ virtual ~APIUI()
+ {
+ for (const auto& it : fItems) delete it.fConversion;
+ for (int i = 0; i < 3; i++) {
+ for (const auto& it : fAcc[i]) delete it;
+ for (const auto& it : fGyr[i]) delete it;
+ }
+ delete fRedReader;
+ delete fGreenReader;
+ delete fBlueReader;
+ }
+
+ // -- widget's layouts
+
+ virtual void openTabBox(const char* label) { pushLabel(label); }
+ virtual void openHorizontalBox(const char* label) { pushLabel(label); }
+ virtual void openVerticalBox(const char* label) { pushLabel(label); }
+ virtual void closeBox()
+ {
+ if (popLabel()) {
+ // Shortnames can be computed when all fullnames are known
+ computeShortNames();
+ // Fill 'shortname' field for each item
+ for (const auto& it : fFull2Short) {
+ int index = getParamIndex(it.first.c_str());
+ fItems[index].fShortname = it.second;
+ }
+ }
+ }
+
+ // -- active widgets
+
+ virtual void addButton(const char* label, FAUSTFLOAT* zone)
+ {
+ addParameter(label, zone, 0, 0, 1, 1, kButton);
+ }
+
+ virtual void addCheckButton(const char* label, FAUSTFLOAT* zone)
+ {
+ addParameter(label, zone, 0, 0, 1, 1, kCheckButton);
+ }
+
+ virtual void addVerticalSlider(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT init, FAUSTFLOAT min, FAUSTFLOAT max, FAUSTFLOAT step)
+ {
+ addParameter(label, zone, init, min, max, step, kVSlider);
+ }
+
+ virtual void addHorizontalSlider(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT init, FAUSTFLOAT min, FAUSTFLOAT max, FAUSTFLOAT step)
+ {
+ addParameter(label, zone, init, min, max, step, kHSlider);
+ }
+
+ virtual void addNumEntry(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT init, FAUSTFLOAT min, FAUSTFLOAT max, FAUSTFLOAT step)
+ {
+ addParameter(label, zone, init, min, max, step, kNumEntry);
+ }
+
+ // -- passive widgets
+
+ virtual void addHorizontalBargraph(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT min, FAUSTFLOAT max)
+ {
+ addParameter(label, zone, min, min, max, (max-min)/1000.0f, kHBargraph);
+ }
+
+ virtual void addVerticalBargraph(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT min, FAUSTFLOAT max)
+ {
+ addParameter(label, zone, min, min, max, (max-min)/1000.0f, kVBargraph);
+ }
+
+ // -- soundfiles
+
+ virtual void addSoundfile(const char* /*label*/, const char* /*filename*/, Soundfile** /*sf_zone*/) {}
+
+ // -- metadata declarations
+
+ virtual void declare(FAUSTFLOAT* /*zone*/, const char* key, const char* val)
+ {
+ // Keep metadata
+ fCurrentMetadata[key] = val;
+
+ if (strcmp(key, "scale") == 0) {
+ if (strcmp(val, "log") == 0) {
+ fCurrentScale = kLog;
+ } else if (strcmp(val, "exp") == 0) {
+ fCurrentScale = kExp;
+ } else {
+ fCurrentScale = kLin;
+ }
+ } else if (strcmp(key, "unit") == 0) {
+ fCurrentUnit = val;
+ } else if (strcmp(key, "acc") == 0) {
+ fCurrentAcc = val;
+ } else if (strcmp(key, "gyr") == 0) {
+ fCurrentGyr = val;
+ } else if (strcmp(key, "screencolor") == 0) {
+ fCurrentColor = val; // val = "red", "green", "blue" or "white"
+ } else if (strcmp(key, "tooltip") == 0) {
+ fCurrentTooltip = val;
+ }
+ }
+
+ virtual void declare(const char* /*key*/, const char* /*val*/)
+ {}
+
+ //-------------------------------------------------------------------------------
+ // Simple API part
+ //-------------------------------------------------------------------------------
+
+ /**
+ * Return the number of parameters in the UI.
+ *
+ * @return the number of parameters
+ */
+ int getParamsCount() { return int(fItems.size()); }
+
+ /**
+ * Return the param index.
+ *
+ * @param str - the UI parameter label/shortname/path
+ *
+ * @return the param index
+ */
+ int getParamIndex(const char* str)
+ {
+ std::string path = std::string(str);
+ auto it = find_if(fItems.begin(), fItems.end(),
+ [=](const Item& it) { return (it.fLabel == path) || (it.fShortname == path) || (it.fPath == path); });
+ return (it != fItems.end()) ? int(it - fItems.begin()) : -1;
+ }
+
+ /**
+ * Return the param label.
+ *
+ * @param p - the UI parameter index
+ *
+ * @return the param label
+ */
+ const char* getParamLabel(int p) { return fItems[uint(p)].fLabel.c_str(); }
+
+ /**
+ * Return the param shortname.
+ *
+ * @param p - the UI parameter index
+ *
+ * @return the param shortname
+ */
+ const char* getParamShortname(int p) { return fItems[uint(p)].fShortname.c_str(); }
+
+ /**
+ * Return the param path.
+ *
+ * @param p - the UI parameter index
+ *
+ * @return the param path
+ */
+ const char* getParamAddress(int p) { return fItems[uint(p)].fPath.c_str(); }
+
+ /**
+ * Return the param metadata.
+ *
+ * @param p - the UI parameter index
+ *
+ * @return the param metadata as a map<key, value>
+ */
+ std::map<const char*, const char*> getMetadata(int p)
+ {
+ std::map<const char*, const char*> res;
+ std::map<std::string, std::string> metadata = fMetaData[uint(p)];
+ for (const auto& it : metadata) {
+ res[it.first.c_str()] = it.second.c_str();
+ }
+ return res;
+ }
+
+ /**
+ * Return the param metadata value.
+ *
+ * @param p - the UI parameter index
+ * @param key - the UI parameter index
+ *
+ * @return the param metadata value associate to the key
+ */
+ const char* getMetadata(int p, const char* key)
+ {
+ return (fMetaData[uint(p)].find(key) != fMetaData[uint(p)].end()) ? fMetaData[uint(p)][key].c_str() : "";
+ }
+
+ /**
+ * Return the param minimum value.
+ *
+ * @param p - the UI parameter index
+ *
+ * @return the param minimum value
+ */
+ FAUSTFLOAT getParamMin(int p) { return fItems[uint(p)].fMin; }
+
+ /**
+ * Return the param maximum value.
+ *
+ * @param p - the UI parameter index
+ *
+ * @return the param maximum value
+ */
+ FAUSTFLOAT getParamMax(int p) { return fItems[uint(p)].fMax; }
+
+ /**
+ * Return the param step value.
+ *
+ * @param p - the UI parameter index
+ *
+ * @return the param step value
+ */
+ FAUSTFLOAT getParamStep(int p) { return fItems[uint(p)].fStep; }
+
+ /**
+ * Return the param init value.
+ *
+ * @param p - the UI parameter index
+ *
+ * @return the param init value
+ */
+ FAUSTFLOAT getParamInit(int p) { return fItems[uint(p)].fInit; }
+
+ /**
+ * Return the param memory zone.
+ *
+ * @param p - the UI parameter index
+ *
+ * @return the param memory zone.
+ */
+ FAUSTFLOAT* getParamZone(int p) { return fItems[uint(p)].fZone; }
+
+ /**
+ * Return the param value.
+ *
+ * @param p - the UI parameter index
+ *
+ * @return the param value.
+ */
+ FAUSTFLOAT getParamValue(int p) { return *fItems[uint(p)].fZone; }
+
+ /**
+ * Return the param value.
+ *
+ * @param str - the UI parameter label/shortname/path
+ *
+ * @return the param value.
+ */
+ FAUSTFLOAT getParamValue(const char* str)
+ {
+ int index = getParamIndex(str);
+ if (index >= 0) {
+ return getParamValue(index);
+ } else {
+ fprintf(stderr, "getParamValue : '%s' not found\n", (str == nullptr ? "NULL" : str));
+ return FAUSTFLOAT(0);
+ }
+ }
+
+ /**
+ * Set the param value.
+ *
+ * @param p - the UI parameter index
+ * @param v - the UI parameter value
+ *
+ */
+ void setParamValue(int p, FAUSTFLOAT v) { *fItems[uint(p)].fZone = v; }
+
+ /**
+ * Set the param value.
+ *
+ * @param p - the UI parameter label/shortname/path
+ * @param v - the UI parameter value
+ *
+ */
+ void setParamValue(const char* path, FAUSTFLOAT v)
+ {
+ int index = getParamIndex(path);
+ if (index >= 0) {
+ setParamValue(index, v);
+ } else {
+ fprintf(stderr, "setParamValue : '%s' not found\n", (path == nullptr ? "NULL" : path));
+ }
+ }
+
+ double getParamRatio(int p) { return fItems[uint(p)].fConversion->faust2ui(*fItems[uint(p)].fZone); }
+ void setParamRatio(int p, double r) { *fItems[uint(p)].fZone = FAUSTFLOAT(fItems[uint(p)].fConversion->ui2faust(r)); }
+
+ double value2ratio(int p, double r) { return fItems[uint(p)].fConversion->faust2ui(r); }
+ double ratio2value(int p, double r) { return fItems[uint(p)].fConversion->ui2faust(r); }
+
+ /**
+ * Return the control type (kAcc, kGyr, or -1) for a given parameter.
+ *
+ * @param p - the UI parameter index
+ *
+ * @return the type
+ */
+ Type getParamType(int p)
+ {
+ if (p >= 0) {
+ if (getZoneIndex(fAcc, p, 0) != -1
+ || getZoneIndex(fAcc, p, 1) != -1
+ || getZoneIndex(fAcc, p, 2) != -1) {
+ return kAcc;
+ } else if (getZoneIndex(fGyr, p, 0) != -1
+ || getZoneIndex(fGyr, p, 1) != -1
+ || getZoneIndex(fGyr, p, 2) != -1) {
+ return kGyr;
+ }
+ }
+ return kNoType;
+ }
+
+ /**
+ * Return the Item type (kButton = 0, kCheckButton, kVSlider, kHSlider, kNumEntry, kHBargraph, kVBargraph) for a given parameter.
+ *
+ * @param p - the UI parameter index
+ *
+ * @return the Item type
+ */
+ ItemType getParamItemType(int p)
+ {
+ return fItems[uint(p)].fItemType;
+ }
+
+ /**
+ * Set a new value coming from an accelerometer, propagate it to all relevant FAUSTFLOAT* zones.
+ *
+ * @param acc - 0 for X accelerometer, 1 for Y accelerometer, 2 for Z accelerometer
+ * @param value - the new value
+ *
+ */
+ void propagateAcc(int acc, double value)
+ {
+ for (size_t i = 0; i < fAcc[acc].size(); i++) {
+ fAcc[acc][i]->update(value);
+ }
+ }
+
+ /**
+ * Used to edit accelerometer curves and mapping. Set curve and related mapping for a given UI parameter.
+ *
+ * @param p - the UI parameter index
+ * @param acc - 0 for X accelerometer, 1 for Y accelerometer, 2 for Z accelerometer (-1 means "no mapping")
+ * @param curve - between 0 and 3 (0: up, 1: down, 2: up and down, 2: down and up)
+ * @param amin - mapping 'min' point
+ * @param amid - mapping 'middle' point
+ * @param amax - mapping 'max' point
+ *
+ */
+ void setAccConverter(int p, int acc, int curve, double amin, double amid, double amax)
+ {
+ setConverter(fAcc, p, acc, curve, amin, amid, amax);
+ }
+
+ /**
+ * Used to edit gyroscope curves and mapping. Set curve and related mapping for a given UI parameter.
+ *
+ * @param p - the UI parameter index
+ * @param gyr - 0 for X gyroscope, 1 for Y gyroscope, 2 for Z gyroscope (-1 means "no mapping")
+ * @param curve - between 0 and 3 (0: up, 1: down, 2: up and down, 2: down and up)
+ * @param amin - mapping 'min' point
+ * @param amid - mapping 'middle' point
+ * @param amax - mapping 'max' point
+ *
+ */
+ void setGyrConverter(int p, int gyr, int curve, double amin, double amid, double amax)
+ {
+ setConverter(fGyr, p, gyr, curve, amin, amid, amax);
+ }
+
+ /**
+ * Used to edit accelerometer curves and mapping. Get curve and related mapping for a given UI parameter.
+ *
+ * @param p - the UI parameter index
+ * @param acc - the acc value to be retrieved (-1 means "no mapping")
+ * @param curve - the curve value to be retrieved (between 0 and 3)
+ * @param amin - the amin value to be retrieved
+ * @param amid - the amid value to be retrieved
+ * @param amax - the amax value to be retrieved
+ *
+ */
+ void getAccConverter(int p, int& acc, int& curve, double& amin, double& amid, double& amax)
+ {
+ getConverter(fAcc, p, acc, curve, amin, amid, amax);
+ }
+
+ /**
+ * Used to edit gyroscope curves and mapping. Get curve and related mapping for a given UI parameter.
+ *
+ * @param p - the UI parameter index
+ * @param gyr - the gyr value to be retrieved (-1 means "no mapping")
+ * @param curve - the curve value to be retrieved (between 0 and 3)
+ * @param amin - the amin value to be retrieved
+ * @param amid - the amid value to be retrieved
+ * @param amax - the amax value to be retrieved
+ *
+ */
+ void getGyrConverter(int p, int& gyr, int& curve, double& amin, double& amid, double& amax)
+ {
+ getConverter(fGyr, p, gyr, curve, amin, amid, amax);
+ }
+
+ /**
+ * Set a new value coming from an gyroscope, propagate it to all relevant FAUSTFLOAT* zones.
+ *
+ * @param gyr - 0 for X gyroscope, 1 for Y gyroscope, 2 for Z gyroscope
+ * @param value - the new value
+ *
+ */
+ void propagateGyr(int gyr, double value)
+ {
+ for (size_t i = 0; i < fGyr[gyr].size(); i++) {
+ fGyr[gyr][i]->update(value);
+ }
+ }
+
+ /**
+ * Get the number of FAUSTFLOAT* zones controlled with the accelerometer.
+ *
+ * @param acc - 0 for X accelerometer, 1 for Y accelerometer, 2 for Z accelerometer
+ * @return the number of zones
+ *
+ */
+ int getAccCount(int acc)
+ {
+ return (acc >= 0 && acc < 3) ? int(fAcc[acc].size()) : 0;
+ }
+
+ /**
+ * Get the number of FAUSTFLOAT* zones controlled with the gyroscope.
+ *
+ * @param gyr - 0 for X gyroscope, 1 for Y gyroscope, 2 for Z gyroscope
+ * @param the number of zones
+ *
+ */
+ int getGyrCount(int gyr)
+ {
+ return (gyr >= 0 && gyr < 3) ? int(fGyr[gyr].size()) : 0;
+ }
+
+ /**
+ * Get the requested screen color.
+ *
+ * -1 means no screen color control (no screencolor metadata found)
+ * otherwise return 0x00RRGGBB a ready to use color
+ *
+ */
+ int getScreenColor()
+ {
+ if (fHasScreenControl) {
+ int r = (fRedReader) ? fRedReader->getValue() : 0;
+ int g = (fGreenReader) ? fGreenReader->getValue() : 0;
+ int b = (fBlueReader) ? fBlueReader->getValue() : 0;
+ return (r<<16) | (g<<8) | b;
+ } else {
+ return -1;
+ }
+ }
+
+};
+
+#endif
+/************************** END APIUI.h **************************/
+
+// NOTE: "faust -scn name" changes the last line above to
+// #include <faust/name/name.h>
+
+//----------------------------------------------------------------------------
+// FAUST Generated Code
+//----------------------------------------------------------------------------
+
+
+#ifndef FAUSTFLOAT
+#define FAUSTFLOAT float
+#endif
+
+#include <algorithm>
+#include <cmath>
+#include <cstdint>
+#include <math.h>
+
+#ifndef FAUSTCLASS
+#define FAUSTCLASS tonedsp
+#endif
+
+#ifdef __APPLE__
+#define exp10f __exp10f
+#define exp10 __exp10
+#endif
+
+#if defined(_WIN32)
+#define RESTRICT __restrict
+#else
+#define RESTRICT __restrict__
+#endif
+
+class tonedspSIG0 {
+
+ private:
+
+ int iVec0[2];
+ int iRec0[2];
+
+ public:
+
+ int getNumInputstonedspSIG0() {
+ return 0;
+ }
+ int getNumOutputstonedspSIG0() {
+ return 1;
+ }
+
+ void instanceInittonedspSIG0(int /*sample_rate*/) {
+ for (int l0 = 0; l0 < 2; l0 = l0 + 1) {
+ iVec0[l0] = 0;
+ }
+ for (int l1 = 0; l1 < 2; l1 = l1 + 1) {
+ iRec0[l1] = 0;
+ }
+ }
+
+ void filltonedspSIG0(int count, float* table) {
+ for (int i1 = 0; i1 < count; i1 = i1 + 1) {
+ iVec0[0] = 1;
+ iRec0[0] = (iVec0[1] + iRec0[1]) % 65536;
+ table[i1] = std::sin(9.58738e-05f * float(iRec0[0]));
+ iVec0[1] = iVec0[0];
+ iRec0[1] = iRec0[0];
+ }
+ }
+
+};
+
+static tonedspSIG0* newtonedspSIG0() { return (tonedspSIG0*)new tonedspSIG0(); }
+static void deletetonedspSIG0(tonedspSIG0* dsp) { delete dsp; }
+
+static float ftbl0tonedspSIG0[65536];
+
+class tonedsp : public dsp {
+
+ private:
+
+ int fSampleRate;
+ float fConst0;
+ float fConst1;
+ FAUSTFLOAT fHslider0;
+ FAUSTFLOAT fHslider1;
+ float fRec1[2];
+ float fConst2;
+ float fConst3;
+ FAUSTFLOAT fButton0;
+ float fVec1[2];
+ int iRec2[2];
+ float fConst4;
+ FAUSTFLOAT fHslider2;
+ float fConst5;
+ float fRec3[2];
+ float fRec4[2];
+ float fConst6;
+ float fRec5[2];
+ float fConst7;
+ float fRec6[2];
+ float fConst8;
+ float fRec7[2];
+ float fConst9;
+ float fRec8[2];
+ float fConst10;
+
+ public:
+
+ void metadata(Meta* m) {
+ m->declare("basics.lib/name", "Faust Basic Element Library");
+ m->declare("basics.lib/version", "0.8");
+ m->declare("compile_options", "-a faust2header.cpp -lang cpp -i -inpl -cn tonedsp -es 1 -mcd 16 -single -ftz 0");
+ m->declare("envelopes.lib/ar:author", "Yann Orlarey, Stéphane Letz");
+ m->declare("envelopes.lib/author", "GRAME");
+ m->declare("envelopes.lib/copyright", "GRAME");
+ m->declare("envelopes.lib/license", "LGPL with exception");
+ m->declare("envelopes.lib/name", "Faust Envelope Library");
+ m->declare("envelopes.lib/version", "0.2");
+ m->declare("filename", "tonedsp.dsp");
+ m->declare("maths.lib/author", "GRAME");
+ m->declare("maths.lib/copyright", "GRAME");
+ m->declare("maths.lib/license", "LGPL with exception");
+ m->declare("maths.lib/name", "Faust Math Library");
+ m->declare("maths.lib/version", "2.5");
+ m->declare("name", "tonedsp");
+ m->declare("oscillators.lib/name", "Faust Oscillator Library");
+ m->declare("oscillators.lib/version", "0.3");
+ m->declare("platform.lib/name", "Generic Platform Library");
+ m->declare("platform.lib/version", "0.2");
+ m->declare("signals.lib/name", "Faust Signal Routing Library");
+ m->declare("signals.lib/version", "0.3");
+ m->declare("synths.lib/additiveDrum:author", "Romain Michon");
+ m->declare("synths.lib/name", "Faust Synthesizer Library");
+ m->declare("synths.lib/version", "0.1");
+ }
+
+ virtual int getNumInputs() {
+ return 0;
+ }
+ virtual int getNumOutputs() {
+ return 1;
+ }
+
+ static void classInit(int sample_rate) {
+ tonedspSIG0* sig0 = newtonedspSIG0();
+ sig0->instanceInittonedspSIG0(sample_rate);
+ sig0->filltonedspSIG0(65536, ftbl0tonedspSIG0);
+ deletetonedspSIG0(sig0);
+ }
+
+ virtual void instanceConstants(int sample_rate) {
+ fSampleRate = sample_rate;
+ fConst0 = std::min<float>(1.92e+05f, std::max<float>(1.0f, float(fSampleRate)));
+ fConst1 = 1.0f / fConst0;
+ fConst2 = std::max<float>(1.0f, 0.001f * fConst0);
+ fConst3 = 1.0f / fConst2;
+ fConst4 = 44.1f / fConst0;
+ fConst5 = 1.0f - fConst4;
+ fConst6 = 0.8666667f * fConst0;
+ fConst7 = 0.73333335f * fConst0;
+ fConst8 = 0.6f * fConst0;
+ fConst9 = 0.46666667f * fConst0;
+ fConst10 = 0.33333334f * fConst0;
+ }
+
+ virtual void instanceResetUserInterface() {
+ fHslider0 = FAUSTFLOAT(4e+02f);
+ fHslider1 = FAUSTFLOAT(0.0f);
+ fButton0 = FAUSTFLOAT(0.0f);
+ fHslider2 = FAUSTFLOAT(2.5f);
+ }
+
+ virtual void instanceClear() {
+ for (int l2 = 0; l2 < 2; l2 = l2 + 1) {
+ fRec1[l2] = 0.0f;
+ }
+ for (int l3 = 0; l3 < 2; l3 = l3 + 1) {
+ fVec1[l3] = 0.0f;
+ }
+ for (int l4 = 0; l4 < 2; l4 = l4 + 1) {
+ iRec2[l4] = 0;
+ }
+ for (int l5 = 0; l5 < 2; l5 = l5 + 1) {
+ fRec3[l5] = 0.0f;
+ }
+ for (int l6 = 0; l6 < 2; l6 = l6 + 1) {
+ fRec4[l6] = 0.0f;
+ }
+ for (int l7 = 0; l7 < 2; l7 = l7 + 1) {
+ fRec5[l7] = 0.0f;
+ }
+ for (int l8 = 0; l8 < 2; l8 = l8 + 1) {
+ fRec6[l8] = 0.0f;
+ }
+ for (int l9 = 0; l9 < 2; l9 = l9 + 1) {
+ fRec7[l9] = 0.0f;
+ }
+ for (int l10 = 0; l10 < 2; l10 = l10 + 1) {
+ fRec8[l10] = 0.0f;
+ }
+ }
+
+ virtual void init(int sample_rate) {
+ classInit(sample_rate);
+ instanceInit(sample_rate);
+ }
+ virtual void instanceInit(int sample_rate) {
+ instanceConstants(sample_rate);
+ instanceResetUserInterface();
+ instanceClear();
+ }
+
+ virtual tonedsp* clone() {
+ return new tonedsp();
+ }
+
+ virtual int getSampleRate() {
+ return fSampleRate;
+ }
+
+ virtual void buildUserInterface(UI* ui_interface) {
+ ui_interface->openVerticalBox("tonedsp");
+ ui_interface->addHorizontalSlider("freq", &fHslider0, FAUSTFLOAT(4e+02f), FAUSTFLOAT(5e+01f), FAUSTFLOAT(2e+03f), FAUSTFLOAT(0.01f));
+ ui_interface->addButton("gate", &fButton0);
+ ui_interface->declare(&fHslider2, "acc", "0 0 -10 0 10");
+ ui_interface->addHorizontalSlider("res", &fHslider2, FAUSTFLOAT(2.5f), FAUSTFLOAT(0.01f), FAUSTFLOAT(5.0f), FAUSTFLOAT(0.01f));
+ ui_interface->addHorizontalSlider("y", &fHslider1, FAUSTFLOAT(0.0f), FAUSTFLOAT(0.0f), FAUSTFLOAT(1.0f), FAUSTFLOAT(0.01f));
+ ui_interface->closeBox();
+ }
+
+ virtual void compute(int count, FAUSTFLOAT** /*inputs*/, FAUSTFLOAT** outputs) {
+ FAUSTFLOAT* output0 = outputs[0];
+ float fSlow0 = float(fHslider0);
+ float fSlow1 = float(fHslider1);
+ float fSlow2 = fConst1 * fSlow0 * (0.8333333f * fSlow1 + 1.0f);
+ float fSlow3 = float(fButton0);
+ float fSlow4 = fConst4 * float(fHslider2);
+ float fSlow5 = fConst1 * fSlow0 * (1.6666666f * fSlow1 + 1.0f);
+ float fSlow6 = fConst1 * fSlow0 * (2.5f * fSlow1 + 1.0f);
+ float fSlow7 = fConst1 * fSlow0 * (3.3333333f * fSlow1 + 1.0f);
+ float fSlow8 = fConst1 * fSlow0 * (4.1666665f * fSlow1 + 1.0f);
+ float fSlow9 = fConst1 * fSlow0 * (5.0f * fSlow1 + 1.0f);
+ for (int i0 = 0; i0 < count; i0 = i0 + 1) {
+ fRec1[0] = fSlow2 + (fRec1[1] - std::floor(fSlow2 + fRec1[1]));
+ fVec1[0] = fSlow3;
+ iRec2[0] = (iRec2[1] + (iRec2[1] > 0)) * (fSlow3 <= fVec1[1]) + (fSlow3 > fVec1[1]);
+ float fTemp0 = float(iRec2[0]);
+ float fTemp1 = fConst3 * fTemp0;
+ float fTemp2 = fConst2 - fTemp0;
+ fRec3[0] = fSlow4 + fConst5 * fRec3[1];
+ fRec4[0] = fSlow5 + (fRec4[1] - std::floor(fSlow5 + fRec4[1]));
+ fRec5[0] = fSlow6 + (fRec5[1] - std::floor(fSlow6 + fRec5[1]));
+ fRec6[0] = fSlow7 + (fRec6[1] - std::floor(fSlow7 + fRec6[1]));
+ fRec7[0] = fSlow8 + (fRec7[1] - std::floor(fSlow8 + fRec7[1]));
+ fRec8[0] = fSlow9 + (fRec8[1] - std::floor(fSlow9 + fRec8[1]));
+ output0[i0] = FAUSTFLOAT(0.05f * (0.44444445f * ftbl0tonedspSIG0[int(65536.0f * fRec1[0])] * std::max<float>(0.0f, std::min<float>(fTemp1, fTemp2 / std::max<float>(1.0f, fConst0 * fRec3[0]) + 1.0f)) + ftbl0tonedspSIG0[int(65536.0f * fRec4[0])] * (0.0f - 0.11111111f * std::max<float>(0.0f, std::min<float>(fTemp1, fTemp2 / std::max<float>(1.0f, fConst6 * fRec3[0]) + 1.0f))) + ftbl0tonedspSIG0[int(65536.0f * fRec5[0])] * (0.0f - 0.6666667f * std::max<float>(0.0f, std::min<float>(fTemp1, fTemp2 / std::max<float>(1.0f, fConst7 * fRec3[0]) + 1.0f))) + ftbl0tonedspSIG0[int(65536.0f * fRec6[0])] * (0.0f - 1.2222222f * std::max<float>(0.0f, std::min<float>(fTemp1, fTemp2 / std::max<float>(1.0f, fConst8 * fRec3[0]) + 1.0f))) + ftbl0tonedspSIG0[int(65536.0f * fRec7[0])] * (0.0f - 1.7777778f * std::max<float>(0.0f, std::min<float>(fTemp1, fTemp2 / std::max<float>(1.0f, fConst9 * fRec3[0]) + 1.0f))) + ftbl0tonedspSIG0[int(65536.0f * fRec8[0])] * (0.0f - 2.3333333f * std::max<float>(0.0f, std::min<float>(fTemp1, fTemp2 / std::max<float>(1.0f, fConst10 * fRec3[0]) + 1.0f)))));
+ fRec1[1] = fRec1[0];
+ fVec1[1] = fVec1[0];
+ iRec2[1] = iRec2[0];
+ fRec3[1] = fRec3[0];
+ fRec4[1] = fRec4[0];
+ fRec5[1] = fRec5[0];
+ fRec6[1] = fRec6[0];
+ fRec7[1] = fRec7[0];
+ fRec8[1] = fRec8[0];
+ }
+ }
+
+};
+
+
+#endif
diff --git a/src/volumedsp.h b/src/volumedsp.h
new file mode 100644
index 0000000..f3df212
--- /dev/null
+++ b/src/volumedsp.h
@@ -0,0 +1,1986 @@
+/* ------------------------------------------------------------
+author: "Matt Horton, adapted from GRAME"
+license: "MIT Style STK-4.2"
+name: "volume"
+version: "1.0"
+Code generated with Faust 2.41.1 (https://faust.grame.fr)
+Compilation options: -a faust2header.cpp -lang cpp -i -inpl -cn volumedsp -es 1 -mcd 16 -single -ftz 0
+------------------------------------------------------------ */
+
+#ifndef __volumedsp_H__
+#define __volumedsp_H__
+
+// NOTE: ANY INCLUDE-GUARD HERE MUST BE DERIVED FROM THE CLASS NAME
+//
+// faust2header.cpp - FAUST Architecture File
+// This is a simple variation of matlabplot.cpp in the Faust distribution
+// aimed at creating a simple C++ header file (.h) containing a Faust DSP.
+// See the Makefile for how to use it.
+
+/************************** BEGIN dsp.h ********************************
+ FAUST Architecture File
+ Copyright (C) 2003-2022 GRAME, Centre National de Creation Musicale
+ ---------------------------------------------------------------------
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ EXCEPTION : As a special exception, you may create a larger work
+ that contains this FAUST architecture section and distribute
+ that work under terms of your choice, so long as this FAUST
+ architecture section is not modified.
+ ************************************************************************/
+
+#ifndef __dsp__
+#define __dsp__
+
+#include <string>
+#include <vector>
+
+/************************************************************************
+ ************************************************************************
+ FAUST compiler
+ Copyright (C) 2003-2018 GRAME, Centre National de Creation Musicale
+ ---------------------------------------------------------------------
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ ************************************************************************
+ ************************************************************************/
+
+#ifndef __export__
+#define __export__
+
+#define FAUSTVERSION "2.41.1"
+
+// Use FAUST_API for code that is part of the external API but is also compiled in faust and libfaust
+// Use LIBFAUST_API for code that is compiled in faust and libfaust
+
+#ifdef _WIN32
+ #pragma warning (disable: 4251)
+ #ifdef FAUST_EXE
+ #define FAUST_API
+ #define LIBFAUST_API
+ #elif FAUST_LIB
+ #define FAUST_API __declspec(dllexport)
+ #define LIBFAUST_API __declspec(dllexport)
+ #else
+ #define FAUST_API
+ #define LIBFAUST_API
+ #endif
+#else
+ #ifdef FAUST_EXE
+ #define FAUST_API
+ #define LIBFAUST_API
+ #else
+ #define FAUST_API __attribute__((visibility("default")))
+ #define LIBFAUST_API __attribute__((visibility("default")))
+ #endif
+#endif
+
+#endif
+
+#ifndef FAUSTFLOAT
+#define FAUSTFLOAT float
+#endif
+
+struct FAUST_API UI;
+struct FAUST_API Meta;
+
+/**
+ * DSP memory manager.
+ */
+
+struct FAUST_API dsp_memory_manager {
+
+ virtual ~dsp_memory_manager() {}
+
+ /**
+ * Inform the Memory Manager with the number of expected memory zones.
+ * @param count - the number of expected memory zones
+ */
+ virtual void begin(size_t /*count*/) {}
+
+ /**
+ * Give the Memory Manager information on a given memory zone.
+ * @param size - the size in bytes of the memory zone
+ * @param reads - the number of Read access to the zone used to compute one frame
+ * @param writes - the number of Write access to the zone used to compute one frame
+ */
+ virtual void info(size_t /*size*/, size_t /*reads*/, size_t /*writes*/) {}
+
+ /**
+ * Inform the Memory Manager that all memory zones have been described,
+ * to possibly start a 'compute the best allocation strategy' step.
+ */
+ virtual void end() {}
+
+ /**
+ * Allocate a memory zone.
+ * @param size - the memory zone size in bytes
+ */
+ virtual void* allocate(size_t size) = 0;
+
+ /**
+ * Destroy a memory zone.
+ * @param ptr - the memory zone pointer to be deallocated
+ */
+ virtual void destroy(void* ptr) = 0;
+
+};
+
+/**
+* Signal processor definition.
+*/
+
+class FAUST_API dsp {
+
+ public:
+
+ dsp() {}
+ virtual ~dsp() {}
+
+ /* Return instance number of audio inputs */
+ virtual int getNumInputs() = 0;
+
+ /* Return instance number of audio outputs */
+ virtual int getNumOutputs() = 0;
+
+ /**
+ * Trigger the ui_interface parameter with instance specific calls
+ * to 'openTabBox', 'addButton', 'addVerticalSlider'... in order to build the UI.
+ *
+ * @param ui_interface - the user interface builder
+ */
+ virtual void buildUserInterface(UI* ui_interface) = 0;
+
+ /* Return the sample rate currently used by the instance */
+ virtual int getSampleRate() = 0;
+
+ /**
+ * Global init, calls the following methods:
+ * - static class 'classInit': static tables initialization
+ * - 'instanceInit': constants and instance state initialization
+ *
+ * @param sample_rate - the sampling rate in Hz
+ */
+ virtual void init(int sample_rate) = 0;
+
+ /**
+ * Init instance state
+ *
+ * @param sample_rate - the sampling rate in Hz
+ */
+ virtual void instanceInit(int sample_rate) = 0;
+
+ /**
+ * Init instance constant state
+ *
+ * @param sample_rate - the sampling rate in Hz
+ */
+ virtual void instanceConstants(int sample_rate) = 0;
+
+ /* Init default control parameters values */
+ virtual void instanceResetUserInterface() = 0;
+
+ /* Init instance state (like delay lines...) but keep the control parameter values */
+ virtual void instanceClear() = 0;
+
+ /**
+ * Return a clone of the instance.
+ *
+ * @return a copy of the instance on success, otherwise a null pointer.
+ */
+ virtual dsp* clone() = 0;
+
+ /**
+ * Trigger the Meta* parameter with instance specific calls to 'declare' (key, value) metadata.
+ *
+ * @param m - the Meta* meta user
+ */
+ virtual void metadata(Meta* m) = 0;
+
+ /**
+ * DSP instance computation, to be called with successive in/out audio buffers.
+ *
+ * @param count - the number of frames to compute
+ * @param inputs - the input audio buffers as an array of non-interleaved FAUSTFLOAT samples (eiher float, double or quad)
+ * @param outputs - the output audio buffers as an array of non-interleaved FAUSTFLOAT samples (eiher float, double or quad)
+ *
+ */
+ virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) = 0;
+
+ /**
+ * DSP instance computation: alternative method to be used by subclasses.
+ *
+ * @param date_usec - the timestamp in microsec given by audio driver.
+ * @param count - the number of frames to compute
+ * @param inputs - the input audio buffers as an array of non-interleaved FAUSTFLOAT samples (either float, double or quad)
+ * @param outputs - the output audio buffers as an array of non-interleaved FAUSTFLOAT samples (either float, double or quad)
+ *
+ */
+ virtual void compute(double /*date_usec*/, int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) { compute(count, inputs, outputs); }
+
+};
+
+/**
+ * Generic DSP decorator.
+ */
+
+class FAUST_API decorator_dsp : public dsp {
+
+ protected:
+
+ dsp* fDSP;
+
+ public:
+
+ decorator_dsp(dsp* dsp = nullptr):fDSP(dsp) {}
+ virtual ~decorator_dsp() { delete fDSP; }
+
+ virtual int getNumInputs() { return fDSP->getNumInputs(); }
+ virtual int getNumOutputs() { return fDSP->getNumOutputs(); }
+ virtual void buildUserInterface(UI* ui_interface) { fDSP->buildUserInterface(ui_interface); }
+ virtual int getSampleRate() { return fDSP->getSampleRate(); }
+ virtual void init(int sample_rate) { fDSP->init(sample_rate); }
+ virtual void instanceInit(int sample_rate) { fDSP->instanceInit(sample_rate); }
+ virtual void instanceConstants(int sample_rate) { fDSP->instanceConstants(sample_rate); }
+ virtual void instanceResetUserInterface() { fDSP->instanceResetUserInterface(); }
+ virtual void instanceClear() { fDSP->instanceClear(); }
+ virtual decorator_dsp* clone() { return new decorator_dsp(fDSP->clone()); }
+ virtual void metadata(Meta* m) { fDSP->metadata(m); }
+ // Beware: subclasses usually have to overload the two 'compute' methods
+ virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) { fDSP->compute(count, inputs, outputs); }
+ virtual void compute(double date_usec, int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) { fDSP->compute(date_usec, count, inputs, outputs); }
+
+};
+
+/**
+ * DSP factory class, used with LLVM and Interpreter backends
+ * to create DSP instances from a compiled DSP program.
+ */
+
+class FAUST_API dsp_factory {
+
+ protected:
+
+ // So that to force sub-classes to use deleteDSPFactory(dsp_factory* factory);
+ virtual ~dsp_factory() {}
+
+ public:
+
+ virtual std::string getName() = 0;
+ virtual std::string getSHAKey() = 0;
+ virtual std::string getDSPCode() = 0;
+ virtual std::string getCompileOptions() = 0;
+ virtual std::vector<std::string> getLibraryList() = 0;
+ virtual std::vector<std::string> getIncludePathnames() = 0;
+
+ virtual dsp* createDSPInstance() = 0;
+
+ virtual void setMemoryManager(dsp_memory_manager* manager) = 0;
+ virtual dsp_memory_manager* getMemoryManager() = 0;
+
+};
+
+// Denormal handling
+
+#if defined (__SSE__)
+#include <xmmintrin.h>
+#endif
+
+class FAUST_API ScopedNoDenormals {
+
+ private:
+
+ intptr_t fpsr;
+
+ void setFpStatusRegister(intptr_t fpsr_aux) noexcept
+ {
+ #if defined (__arm64__) || defined (__aarch64__)
+ asm volatile("msr fpcr, %0" : : "ri" (fpsr_aux));
+ #elif defined (__SSE__)
+ _mm_setcsr(static_cast<uint32_t>(fpsr_aux));
+ #endif
+ }
+
+ void getFpStatusRegister() noexcept
+ {
+ #if defined (__arm64__) || defined (__aarch64__)
+ asm volatile("mrs %0, fpcr" : "=r" (fpsr));
+ #elif defined ( __SSE__)
+ fpsr = static_cast<intptr_t>(_mm_getcsr());
+ #endif
+ }
+
+ public:
+
+ ScopedNoDenormals() noexcept
+ {
+ #if defined (__arm64__) || defined (__aarch64__)
+ intptr_t mask = (1 << 24 /* FZ */);
+ #else
+ #if defined(__SSE__)
+ #if defined(__SSE2__)
+ intptr_t mask = 0x8040;
+ #else
+ intptr_t mask = 0x8000;
+ #endif
+ #else
+ intptr_t mask = 0x0000;
+ #endif
+ #endif
+ getFpStatusRegister();
+ setFpStatusRegister(fpsr | mask);
+ }
+
+ ~ScopedNoDenormals() noexcept
+ {
+ setFpStatusRegister(fpsr);
+ }
+
+};
+
+#define AVOIDDENORMALS ScopedNoDenormals();
+
+#endif
+
+/************************** END dsp.h **************************/
+/************************** BEGIN APIUI.h *****************************
+FAUST Architecture File
+Copyright (C) 2003-2022 GRAME, Centre National de Creation Musicale
+---------------------------------------------------------------------
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+EXCEPTION : As a special exception, you may create a larger work
+that contains this FAUST architecture section and distribute
+that work under terms of your choice, so long as this FAUST
+architecture section is not modified.
+************************************************************************/
+
+#ifndef API_UI_H
+#define API_UI_H
+
+#include <sstream>
+#include <string>
+#include <vector>
+#include <stdio.h>
+#include <map>
+
+/************************** BEGIN meta.h *******************************
+ FAUST Architecture File
+ Copyright (C) 2003-2022 GRAME, Centre National de Creation Musicale
+ ---------------------------------------------------------------------
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ EXCEPTION : As a special exception, you may create a larger work
+ that contains this FAUST architecture section and distribute
+ that work under terms of your choice, so long as this FAUST
+ architecture section is not modified.
+ ************************************************************************/
+
+#ifndef __meta__
+#define __meta__
+
+
+/**
+ The base class of Meta handler to be used in dsp::metadata(Meta* m) method to retrieve (key, value) metadata.
+ */
+struct FAUST_API Meta {
+ virtual ~Meta() {}
+ virtual void declare(const char* key, const char* value) = 0;
+};
+
+#endif
+/************************** END meta.h **************************/
+/************************** BEGIN UI.h *****************************
+ FAUST Architecture File
+ Copyright (C) 2003-2022 GRAME, Centre National de Creation Musicale
+ ---------------------------------------------------------------------
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ EXCEPTION : As a special exception, you may create a larger work
+ that contains this FAUST architecture section and distribute
+ that work under terms of your choice, so long as this FAUST
+ architecture section is not modified.
+ ********************************************************************/
+
+#ifndef __UI_H__
+#define __UI_H__
+
+
+#ifndef FAUSTFLOAT
+#define FAUSTFLOAT float
+#endif
+
+/*******************************************************************************
+ * UI : Faust DSP User Interface
+ * User Interface as expected by the buildUserInterface() method of a DSP.
+ * This abstract class contains only the method that the Faust compiler can
+ * generate to describe a DSP user interface.
+ ******************************************************************************/
+
+struct Soundfile;
+
+template <typename REAL>
+struct FAUST_API UIReal {
+
+ UIReal() {}
+ virtual ~UIReal() {}
+
+ // -- widget's layouts
+
+ virtual void openTabBox(const char* label) = 0;
+ virtual void openHorizontalBox(const char* label) = 0;
+ virtual void openVerticalBox(const char* label) = 0;
+ virtual void closeBox() = 0;
+
+ // -- active widgets
+
+ virtual void addButton(const char* label, REAL* zone) = 0;
+ virtual void addCheckButton(const char* label, REAL* zone) = 0;
+ virtual void addVerticalSlider(const char* label, REAL* zone, REAL init, REAL min, REAL max, REAL step) = 0;
+ virtual void addHorizontalSlider(const char* label, REAL* zone, REAL init, REAL min, REAL max, REAL step) = 0;
+ virtual void addNumEntry(const char* label, REAL* zone, REAL init, REAL min, REAL max, REAL step) = 0;
+
+ // -- passive widgets
+
+ virtual void addHorizontalBargraph(const char* label, REAL* zone, REAL min, REAL max) = 0;
+ virtual void addVerticalBargraph(const char* label, REAL* zone, REAL min, REAL max) = 0;
+
+ // -- soundfiles
+
+ virtual void addSoundfile(const char* /*label*/, const char* /*filename*/, Soundfile** /*sf_zone*/) = 0;
+
+ // -- metadata declarations
+
+ virtual void declare(REAL* /*zone*/, const char* /*key*/, const char* /*val*/) {}
+
+ // To be used by LLVM client
+ virtual int sizeOfFAUSTFLOAT() { return sizeof(FAUSTFLOAT); }
+};
+
+struct FAUST_API UI : public UIReal<FAUSTFLOAT> {
+ UI() {}
+ virtual ~UI() {}
+};
+
+#endif
+/************************** END UI.h **************************/
+/************************** BEGIN PathBuilder.h **************************
+ FAUST Architecture File
+ Copyright (C) 2003-2022 GRAME, Centre National de Creation Musicale
+ ---------------------------------------------------------------------
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ EXCEPTION : As a special exception, you may create a larger work
+ that contains this FAUST architecture section and distribute
+ that work under terms of your choice, so long as this FAUST
+ architecture section is not modified.
+ ************************************************************************/
+
+#ifndef __PathBuilder__
+#define __PathBuilder__
+
+#include <vector>
+#include <set>
+#include <map>
+#include <string>
+#include <algorithm>
+#include <regex>
+
+
+/*******************************************************************************
+ * PathBuilder : Faust User Interface
+ * Helper class to build complete hierarchical path for UI items.
+ ******************************************************************************/
+
+class FAUST_API PathBuilder {
+
+ protected:
+
+ std::vector<std::string> fControlsLevel;
+ std::vector<std::string> fFullPaths;
+ std::map<std::string, std::string> fFull2Short; // filled by computeShortNames()
+
+ /**
+ * @brief check if a character is acceptable for an ID
+ *
+ * @param c
+ * @return true is the character is acceptable for an ID
+ */
+ bool isIDChar(char c) const
+ {
+ return ((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z')) || ((c >= '0') && (c <= '9'));
+ }
+
+ /**
+ * @brief remove all "/0x00" parts
+ *
+ * @param src
+ * @return modified string
+ */
+ std::string remove0x00(const std::string& src) const
+ {
+ return std::regex_replace(src, std::regex("/0x00"), "");
+ }
+
+ /**
+ * @brief replace all non ID char with '_' (one '_' may replace several non ID char)
+ *
+ * @param src
+ * @return modified string
+ */
+ std::string str2ID(const std::string& src) const
+ {
+ std::string dst;
+ bool need_underscore = false;
+ for (char c : src) {
+ if (isIDChar(c) || (c == '/')) {
+ if (need_underscore) {
+ dst.push_back('_');
+ need_underscore = false;
+ }
+ dst.push_back(c);
+ } else {
+ need_underscore = true;
+ }
+ }
+ return dst;
+ }
+
+ /**
+ * @brief Keep only the last n slash-parts
+ *
+ * @param src
+ * @param n : 1 indicates the last slash-part
+ * @return modified string
+ */
+ std::string cut(const std::string& src, int n) const
+ {
+ std::string rdst;
+ for (int i = int(src.length())-1; i >= 0; i--) {
+ char c = src[i];
+ if (c != '/') {
+ rdst.push_back(c);
+ } else if (n == 1) {
+ std::string dst;
+ for (int j = int(rdst.length())-1; j >= 0; j--) {
+ dst.push_back(rdst[j]);
+ }
+ return dst;
+ } else {
+ n--;
+ rdst.push_back(c);
+ }
+ }
+ return src;
+ }
+
+ void addFullPath(const std::string& label) { fFullPaths.push_back(buildPath(label)); }
+
+ /**
+ * @brief Compute the mapping between full path and short names
+ */
+ void computeShortNames()
+ {
+ std::vector<std::string> uniquePaths; // all full paths transformed but made unique with a prefix
+ std::map<std::string, std::string> unique2full; // all full paths transformed but made unique with a prefix
+ char num_buffer[16];
+ int pnum = 0;
+
+ for (const auto& s : fFullPaths) {
+ sprintf(num_buffer, "%d", pnum++);
+ std::string u = "/P" + std::string(num_buffer) + str2ID(remove0x00(s));
+ uniquePaths.push_back(u);
+ unique2full[u] = s; // remember the full path associated to a unique path
+ }
+
+ std::map<std::string, int> uniquePath2level; // map path to level
+ for (const auto& s : uniquePaths) uniquePath2level[s] = 1; // we init all levels to 1
+ bool have_collisions = true;
+
+ while (have_collisions) {
+ // compute collision list
+ std::set<std::string> collisionSet;
+ std::map<std::string, std::string> short2full;
+ have_collisions = false;
+ for (const auto& it : uniquePath2level) {
+ std::string u = it.first;
+ int n = it.second;
+ std::string shortName = cut(u, n);
+ auto p = short2full.find(shortName);
+ if (p == short2full.end()) {
+ // no collision
+ short2full[shortName] = u;
+ } else {
+ // we have a collision, add the two paths to the collision set
+ have_collisions = true;
+ collisionSet.insert(u);
+ collisionSet.insert(p->second);
+ }
+ }
+ for (const auto& s : collisionSet) uniquePath2level[s]++; // increase level of colliding path
+ }
+
+ for (const auto& it : uniquePath2level) {
+ std::string u = it.first;
+ int n = it.second;
+ std::string shortName = replaceCharList(cut(u, n), {'/'}, '_');
+ fFull2Short[unique2full[u]] = shortName;
+ }
+ }
+
+ std::string replaceCharList(const std::string& str, const std::vector<char>& ch1, char ch2)
+ {
+ auto beg = ch1.begin();
+ auto end = ch1.end();
+ std::string res = str;
+ for (size_t i = 0; i < str.length(); ++i) {
+ if (std::find(beg, end, str[i]) != end) res[i] = ch2;
+ }
+ return res;
+ }
+
+ public:
+
+ PathBuilder() {}
+ virtual ~PathBuilder() {}
+
+ // Return true for the first level of groups
+ bool pushLabel(const std::string& label) { fControlsLevel.push_back(label); return fControlsLevel.size() == 1;}
+
+ // Return true for the last level of groups
+ bool popLabel() { fControlsLevel.pop_back(); return fControlsLevel.size() == 0; }
+
+ std::string buildPath(const std::string& label)
+ {
+ std::string res = "/";
+ for (size_t i = 0; i < fControlsLevel.size(); i++) {
+ res = res + fControlsLevel[i] + "/";
+ }
+ res += label;
+ return replaceCharList(res, {' ', '#', '*', ',', '?', '[', ']', '{', '}', '(', ')'}, '_');
+ }
+
+};
+
+#endif // __PathBuilder__
+/************************** END PathBuilder.h **************************/
+/************************** BEGIN ValueConverter.h ********************
+ FAUST Architecture File
+ Copyright (C) 2003-2022 GRAME, Centre National de Creation Musicale
+ ---------------------------------------------------------------------
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ EXCEPTION : As a special exception, you may create a larger work
+ that contains this FAUST architecture section and distribute
+ that work under terms of your choice, so long as this FAUST
+ architecture section is not modified.
+ ********************************************************************/
+
+#ifndef __ValueConverter__
+#define __ValueConverter__
+
+/***************************************************************************************
+ ValueConverter.h
+ (GRAME, Copyright 2015-2019)
+
+ Set of conversion objects used to map user interface values (for example a gui slider
+ delivering values between 0 and 1) to faust values (for example a vslider between
+ 20 and 20000) using a log scale.
+
+ -- Utilities
+
+ Range(lo,hi) : clip a value x between lo and hi
+ Interpolator(lo,hi,v1,v2) : Maps a value x between lo and hi to a value y between v1 and v2
+ Interpolator3pt(lo,mi,hi,v1,vm,v2) : Map values between lo mid hi to values between v1 vm v2
+
+ -- Value Converters
+
+ ValueConverter::ui2faust(x)
+ ValueConverter::faust2ui(x)
+
+ -- ValueConverters used for sliders depending of the scale
+
+ LinearValueConverter(umin, umax, fmin, fmax)
+ LinearValueConverter2(lo, mi, hi, v1, vm, v2) using 2 segments
+ LogValueConverter(umin, umax, fmin, fmax)
+ ExpValueConverter(umin, umax, fmin, fmax)
+
+ -- ValueConverters used for accelerometers based on 3 points
+
+ AccUpConverter(amin, amid, amax, fmin, fmid, fmax) -- curve 0
+ AccDownConverter(amin, amid, amax, fmin, fmid, fmax) -- curve 1
+ AccUpDownConverter(amin, amid, amax, fmin, fmid, fmax) -- curve 2
+ AccDownUpConverter(amin, amid, amax, fmin, fmid, fmax) -- curve 3
+
+ -- lists of ZoneControl are used to implement accelerometers metadata for each axes
+
+ ZoneControl(zone, valueConverter) : a zone with an accelerometer data converter
+
+ -- ZoneReader are used to implement screencolor metadata
+
+ ZoneReader(zone, valueConverter) : a zone with a data converter
+
+****************************************************************************************/
+
+#include <float.h>
+#include <algorithm> // std::max
+#include <cmath>
+#include <vector>
+#include <assert.h>
+
+
+//--------------------------------------------------------------------------------------
+// Interpolator(lo,hi,v1,v2)
+// Maps a value x between lo and hi to a value y between v1 and v2
+// y = v1 + (x-lo)/(hi-lo)*(v2-v1)
+// y = v1 + (x-lo) * coef with coef = (v2-v1)/(hi-lo)
+// y = v1 + x*coef - lo*coef
+// y = v1 - lo*coef + x*coef
+// y = offset + x*coef with offset = v1 - lo*coef
+//--------------------------------------------------------------------------------------
+class FAUST_API Interpolator {
+
+ private:
+
+ //--------------------------------------------------------------------------------------
+ // Range(lo,hi) clip a value between lo and hi
+ //--------------------------------------------------------------------------------------
+ struct Range
+ {
+ double fLo;
+ double fHi;
+
+ Range(double x, double y) : fLo(std::min<double>(x,y)), fHi(std::max<double>(x,y)) {}
+ double operator()(double x) { return (x<fLo) ? fLo : (x>fHi) ? fHi : x; }
+ };
+
+
+ Range fRange;
+ double fCoef;
+ double fOffset;
+
+ public:
+
+ Interpolator(double lo, double hi, double v1, double v2) : fRange(lo,hi)
+ {
+ if (hi != lo) {
+ // regular case
+ fCoef = (v2-v1)/(hi-lo);
+ fOffset = v1 - lo*fCoef;
+ } else {
+ // degenerate case, avoids division by zero
+ fCoef = 0;
+ fOffset = (v1+v2)/2;
+ }
+ }
+ double operator()(double v)
+ {
+ double x = fRange(v);
+ return fOffset + x*fCoef;
+ }
+
+ void getLowHigh(double& amin, double& amax)
+ {
+ amin = fRange.fLo;
+ amax = fRange.fHi;
+ }
+};
+
+//--------------------------------------------------------------------------------------
+// Interpolator3pt(lo,mi,hi,v1,vm,v2)
+// Map values between lo mid hi to values between v1 vm v2
+//--------------------------------------------------------------------------------------
+class FAUST_API Interpolator3pt {
+
+ private:
+
+ Interpolator fSegment1;
+ Interpolator fSegment2;
+ double fMid;
+
+ public:
+
+ Interpolator3pt(double lo, double mi, double hi, double v1, double vm, double v2) :
+ fSegment1(lo, mi, v1, vm),
+ fSegment2(mi, hi, vm, v2),
+ fMid(mi) {}
+ double operator()(double x) { return (x < fMid) ? fSegment1(x) : fSegment2(x); }
+
+ void getMappingValues(double& amin, double& amid, double& amax)
+ {
+ fSegment1.getLowHigh(amin, amid);
+ fSegment2.getLowHigh(amid, amax);
+ }
+};
+
+//--------------------------------------------------------------------------------------
+// Abstract ValueConverter class. Converts values between UI and Faust representations
+//--------------------------------------------------------------------------------------
+class FAUST_API ValueConverter {
+
+ public:
+
+ virtual ~ValueConverter() {}
+ virtual double ui2faust(double x) { return x; };
+ virtual double faust2ui(double x) { return x; };
+};
+
+//--------------------------------------------------------------------------------------
+// A converter than can be updated
+//--------------------------------------------------------------------------------------
+
+class FAUST_API UpdatableValueConverter : public ValueConverter {
+
+ protected:
+
+ bool fActive;
+
+ public:
+
+ UpdatableValueConverter():fActive(true)
+ {}
+ virtual ~UpdatableValueConverter()
+ {}
+
+ virtual void setMappingValues(double amin, double amid, double amax, double min, double init, double max) = 0;
+ virtual void getMappingValues(double& amin, double& amid, double& amax) = 0;
+
+ void setActive(bool on_off) { fActive = on_off; }
+ bool getActive() { return fActive; }
+
+};
+
+//--------------------------------------------------------------------------------------
+// Linear conversion between ui and Faust values
+//--------------------------------------------------------------------------------------
+class FAUST_API LinearValueConverter : public ValueConverter {
+
+ private:
+
+ Interpolator fUI2F;
+ Interpolator fF2UI;
+
+ public:
+
+ LinearValueConverter(double umin, double umax, double fmin, double fmax) :
+ fUI2F(umin,umax,fmin,fmax), fF2UI(fmin,fmax,umin,umax)
+ {}
+
+ LinearValueConverter() : fUI2F(0.,0.,0.,0.), fF2UI(0.,0.,0.,0.)
+ {}
+ virtual double ui2faust(double x) { return fUI2F(x); }
+ virtual double faust2ui(double x) { return fF2UI(x); }
+
+};
+
+//--------------------------------------------------------------------------------------
+// Two segments linear conversion between ui and Faust values
+//--------------------------------------------------------------------------------------
+class FAUST_API LinearValueConverter2 : public UpdatableValueConverter {
+
+ private:
+
+ Interpolator3pt fUI2F;
+ Interpolator3pt fF2UI;
+
+ public:
+
+ LinearValueConverter2(double amin, double amid, double amax, double min, double init, double max) :
+ fUI2F(amin, amid, amax, min, init, max), fF2UI(min, init, max, amin, amid, amax)
+ {}
+
+ LinearValueConverter2() : fUI2F(0.,0.,0.,0.,0.,0.), fF2UI(0.,0.,0.,0.,0.,0.)
+ {}
+
+ virtual double ui2faust(double x) { return fUI2F(x); }
+ virtual double faust2ui(double x) { return fF2UI(x); }
+
+ virtual void setMappingValues(double amin, double amid, double amax, double min, double init, double max)
+ {
+ fUI2F = Interpolator3pt(amin, amid, amax, min, init, max);
+ fF2UI = Interpolator3pt(min, init, max, amin, amid, amax);
+ }
+
+ virtual void getMappingValues(double& amin, double& amid, double& amax)
+ {
+ fUI2F.getMappingValues(amin, amid, amax);
+ }
+
+};
+
+//--------------------------------------------------------------------------------------
+// Logarithmic conversion between ui and Faust values
+//--------------------------------------------------------------------------------------
+class FAUST_API LogValueConverter : public LinearValueConverter {
+
+ public:
+
+ LogValueConverter(double umin, double umax, double fmin, double fmax) :
+ LinearValueConverter(umin, umax, std::log(std::max<double>(DBL_MIN, fmin)), std::log(std::max<double>(DBL_MIN, fmax)))
+ {}
+
+ virtual double ui2faust(double x) { return std::exp(LinearValueConverter::ui2faust(x)); }
+ virtual double faust2ui(double x) { return LinearValueConverter::faust2ui(std::log(std::max<double>(x, DBL_MIN))); }
+
+};
+
+//--------------------------------------------------------------------------------------
+// Exponential conversion between ui and Faust values
+//--------------------------------------------------------------------------------------
+class FAUST_API ExpValueConverter : public LinearValueConverter {
+
+ public:
+
+ ExpValueConverter(double umin, double umax, double fmin, double fmax) :
+ LinearValueConverter(umin, umax, std::min<double>(DBL_MAX, std::exp(fmin)), std::min<double>(DBL_MAX, std::exp(fmax)))
+ {}
+
+ virtual double ui2faust(double x) { return std::log(LinearValueConverter::ui2faust(x)); }
+ virtual double faust2ui(double x) { return LinearValueConverter::faust2ui(std::min<double>(DBL_MAX, std::exp(x))); }
+
+};
+
+//--------------------------------------------------------------------------------------
+// Convert accelerometer or gyroscope values to Faust values
+// Using an Up curve (curve 0)
+//--------------------------------------------------------------------------------------
+class FAUST_API AccUpConverter : public UpdatableValueConverter {
+
+ private:
+
+ Interpolator3pt fA2F;
+ Interpolator3pt fF2A;
+
+ public:
+
+ AccUpConverter(double amin, double amid, double amax, double fmin, double fmid, double fmax) :
+ fA2F(amin,amid,amax,fmin,fmid,fmax),
+ fF2A(fmin,fmid,fmax,amin,amid,amax)
+ {}
+
+ virtual double ui2faust(double x) { return fA2F(x); }
+ virtual double faust2ui(double x) { return fF2A(x); }
+
+ virtual void setMappingValues(double amin, double amid, double amax, double fmin, double fmid, double fmax)
+ {
+ //__android_log_print(ANDROID_LOG_ERROR, "Faust", "AccUpConverter update %f %f %f %f %f %f", amin,amid,amax,fmin,fmid,fmax);
+ fA2F = Interpolator3pt(amin, amid, amax, fmin, fmid, fmax);
+ fF2A = Interpolator3pt(fmin, fmid, fmax, amin, amid, amax);
+ }
+
+ virtual void getMappingValues(double& amin, double& amid, double& amax)
+ {
+ fA2F.getMappingValues(amin, amid, amax);
+ }
+
+};
+
+//--------------------------------------------------------------------------------------
+// Convert accelerometer or gyroscope values to Faust values
+// Using a Down curve (curve 1)
+//--------------------------------------------------------------------------------------
+class FAUST_API AccDownConverter : public UpdatableValueConverter {
+
+ private:
+
+ Interpolator3pt fA2F;
+ Interpolator3pt fF2A;
+
+ public:
+
+ AccDownConverter(double amin, double amid, double amax, double fmin, double fmid, double fmax) :
+ fA2F(amin,amid,amax,fmax,fmid,fmin),
+ fF2A(fmin,fmid,fmax,amax,amid,amin)
+ {}
+
+ virtual double ui2faust(double x) { return fA2F(x); }
+ virtual double faust2ui(double x) { return fF2A(x); }
+
+ virtual void setMappingValues(double amin, double amid, double amax, double fmin, double fmid, double fmax)
+ {
+ //__android_log_print(ANDROID_LOG_ERROR, "Faust", "AccDownConverter update %f %f %f %f %f %f", amin,amid,amax,fmin,fmid,fmax);
+ fA2F = Interpolator3pt(amin, amid, amax, fmax, fmid, fmin);
+ fF2A = Interpolator3pt(fmin, fmid, fmax, amax, amid, amin);
+ }
+
+ virtual void getMappingValues(double& amin, double& amid, double& amax)
+ {
+ fA2F.getMappingValues(amin, amid, amax);
+ }
+};
+
+//--------------------------------------------------------------------------------------
+// Convert accelerometer or gyroscope values to Faust values
+// Using an Up-Down curve (curve 2)
+//--------------------------------------------------------------------------------------
+class FAUST_API AccUpDownConverter : public UpdatableValueConverter {
+
+ private:
+
+ Interpolator3pt fA2F;
+ Interpolator fF2A;
+
+ public:
+
+ AccUpDownConverter(double amin, double amid, double amax, double fmin, double /*fmid*/, double fmax) :
+ fA2F(amin,amid,amax,fmin,fmax,fmin),
+ fF2A(fmin,fmax,amin,amax) // Special, pseudo inverse of a non monotonic function
+ {}
+
+ virtual double ui2faust(double x) { return fA2F(x); }
+ virtual double faust2ui(double x) { return fF2A(x); }
+
+ virtual void setMappingValues(double amin, double amid, double amax, double fmin, double /*fmid*/, double fmax)
+ {
+ //__android_log_print(ANDROID_LOG_ERROR, "Faust", "AccUpDownConverter update %f %f %f %f %f %f", amin,amid,amax,fmin,fmid,fmax);
+ fA2F = Interpolator3pt(amin, amid, amax, fmin, fmax, fmin);
+ fF2A = Interpolator(fmin, fmax, amin, amax);
+ }
+
+ virtual void getMappingValues(double& amin, double& amid, double& amax)
+ {
+ fA2F.getMappingValues(amin, amid, amax);
+ }
+};
+
+//--------------------------------------------------------------------------------------
+// Convert accelerometer or gyroscope values to Faust values
+// Using a Down-Up curve (curve 3)
+//--------------------------------------------------------------------------------------
+class FAUST_API AccDownUpConverter : public UpdatableValueConverter {
+
+ private:
+
+ Interpolator3pt fA2F;
+ Interpolator fF2A;
+
+ public:
+
+ AccDownUpConverter(double amin, double amid, double amax, double fmin, double /*fmid*/, double fmax) :
+ fA2F(amin,amid,amax,fmax,fmin,fmax),
+ fF2A(fmin,fmax,amin,amax) // Special, pseudo inverse of a non monotonic function
+ {}
+
+ virtual double ui2faust(double x) { return fA2F(x); }
+ virtual double faust2ui(double x) { return fF2A(x); }
+
+ virtual void setMappingValues(double amin, double amid, double amax, double fmin, double /*fmid*/, double fmax)
+ {
+ //__android_log_print(ANDROID_LOG_ERROR, "Faust", "AccDownUpConverter update %f %f %f %f %f %f", amin,amid,amax,fmin,fmid,fmax);
+ fA2F = Interpolator3pt(amin, amid, amax, fmax, fmin, fmax);
+ fF2A = Interpolator(fmin, fmax, amin, amax);
+ }
+
+ virtual void getMappingValues(double& amin, double& amid, double& amax)
+ {
+ fA2F.getMappingValues(amin, amid, amax);
+ }
+};
+
+//--------------------------------------------------------------------------------------
+// Base class for ZoneControl
+//--------------------------------------------------------------------------------------
+class FAUST_API ZoneControl {
+
+ protected:
+
+ FAUSTFLOAT* fZone;
+
+ public:
+
+ ZoneControl(FAUSTFLOAT* zone) : fZone(zone) {}
+ virtual ~ZoneControl() {}
+
+ virtual void update(double /*v*/) const {}
+
+ virtual void setMappingValues(int /*curve*/, double /*amin*/, double /*amid*/, double /*amax*/, double /*min*/, double /*init*/, double /*max*/) {}
+ virtual void getMappingValues(double& /*amin*/, double& /*amid*/, double& /*amax*/) {}
+
+ FAUSTFLOAT* getZone() { return fZone; }
+
+ virtual void setActive(bool /*on_off*/) {}
+ virtual bool getActive() { return false; }
+
+ virtual int getCurve() { return -1; }
+
+};
+
+//--------------------------------------------------------------------------------------
+// Useful to implement accelerometers metadata as a list of ZoneControl for each axes
+//--------------------------------------------------------------------------------------
+class FAUST_API ConverterZoneControl : public ZoneControl {
+
+ protected:
+
+ ValueConverter* fValueConverter;
+
+ public:
+
+ ConverterZoneControl(FAUSTFLOAT* zone, ValueConverter* converter) : ZoneControl(zone), fValueConverter(converter) {}
+ virtual ~ConverterZoneControl() { delete fValueConverter; } // Assuming fValueConverter is not kept elsewhere...
+
+ virtual void update(double v) const { *fZone = FAUSTFLOAT(fValueConverter->ui2faust(v)); }
+
+ ValueConverter* getConverter() { return fValueConverter; }
+
+};
+
+//--------------------------------------------------------------------------------------
+// Association of a zone and a four value converter, each one for each possible curve.
+// Useful to implement accelerometers metadata as a list of ZoneControl for each axes
+//--------------------------------------------------------------------------------------
+class FAUST_API CurveZoneControl : public ZoneControl {
+
+ private:
+
+ std::vector<UpdatableValueConverter*> fValueConverters;
+ int fCurve;
+
+ public:
+
+ CurveZoneControl(FAUSTFLOAT* zone, int curve, double amin, double amid, double amax, double min, double init, double max) : ZoneControl(zone), fCurve(0)
+ {
+ assert(curve >= 0 && curve <= 3);
+ fValueConverters.push_back(new AccUpConverter(amin, amid, amax, min, init, max));
+ fValueConverters.push_back(new AccDownConverter(amin, amid, amax, min, init, max));
+ fValueConverters.push_back(new AccUpDownConverter(amin, amid, amax, min, init, max));
+ fValueConverters.push_back(new AccDownUpConverter(amin, amid, amax, min, init, max));
+ fCurve = curve;
+ }
+ virtual ~CurveZoneControl()
+ {
+ for (const auto& it : fValueConverters) { delete it; }
+ }
+ void update(double v) const { if (fValueConverters[fCurve]->getActive()) *fZone = FAUSTFLOAT(fValueConverters[fCurve]->ui2faust(v)); }
+
+ void setMappingValues(int curve, double amin, double amid, double amax, double min, double init, double max)
+ {
+ fValueConverters[curve]->setMappingValues(amin, amid, amax, min, init, max);
+ fCurve = curve;
+ }
+
+ void getMappingValues(double& amin, double& amid, double& amax)
+ {
+ fValueConverters[fCurve]->getMappingValues(amin, amid, amax);
+ }
+
+ void setActive(bool on_off)
+ {
+ for (const auto& it : fValueConverters) { it->setActive(on_off); }
+ }
+
+ int getCurve() { return fCurve; }
+};
+
+class FAUST_API ZoneReader {
+
+ private:
+
+ FAUSTFLOAT* fZone;
+ Interpolator fInterpolator;
+
+ public:
+
+ ZoneReader(FAUSTFLOAT* zone, double lo, double hi) : fZone(zone), fInterpolator(lo, hi, 0, 255) {}
+
+ virtual ~ZoneReader() {}
+
+ int getValue()
+ {
+ return (fZone != nullptr) ? int(fInterpolator(*fZone)) : 127;
+ }
+
+};
+
+#endif
+/************************** END ValueConverter.h **************************/
+
+typedef unsigned int uint;
+
+class APIUI : public PathBuilder, public Meta, public UI
+{
+ public:
+ enum ItemType { kButton = 0, kCheckButton, kVSlider, kHSlider, kNumEntry, kHBargraph, kVBargraph };
+ enum Type { kAcc = 0, kGyr = 1, kNoType };
+
+ protected:
+
+ enum Mapping { kLin = 0, kLog = 1, kExp = 2 };
+
+ struct Item {
+ std::string fLabel;
+ std::string fShortname;
+ std::string fPath;
+ ValueConverter* fConversion;
+ FAUSTFLOAT* fZone;
+ FAUSTFLOAT fInit;
+ FAUSTFLOAT fMin;
+ FAUSTFLOAT fMax;
+ FAUSTFLOAT fStep;
+ ItemType fItemType;
+
+ Item(const std::string& label,
+ const std::string& short_name,
+ const std::string& path,
+ ValueConverter* conversion,
+ FAUSTFLOAT* zone,
+ FAUSTFLOAT init,
+ FAUSTFLOAT min,
+ FAUSTFLOAT max,
+ FAUSTFLOAT step,
+ ItemType item_type)
+ :fLabel(label), fShortname(short_name), fPath(path), fConversion(conversion),
+ fZone(zone), fInit(init), fMin(min), fMax(max), fStep(step), fItemType(item_type)
+ {}
+ };
+ std::vector<Item> fItems;
+
+ std::vector<std::map<std::string, std::string> > fMetaData;
+ std::vector<ZoneControl*> fAcc[3];
+ std::vector<ZoneControl*> fGyr[3];
+
+ // Screen color control
+ // "...[screencolor:red]..." etc.
+ bool fHasScreenControl; // true if control screen color metadata
+ ZoneReader* fRedReader;
+ ZoneReader* fGreenReader;
+ ZoneReader* fBlueReader;
+
+ // Current values controlled by metadata
+ std::string fCurrentUnit;
+ int fCurrentScale;
+ std::string fCurrentAcc;
+ std::string fCurrentGyr;
+ std::string fCurrentColor;
+ std::string fCurrentTooltip;
+ std::map<std::string, std::string> fCurrentMetadata;
+
+ // Add a generic parameter
+ virtual void addParameter(const char* label,
+ FAUSTFLOAT* zone,
+ FAUSTFLOAT init,
+ FAUSTFLOAT min,
+ FAUSTFLOAT max,
+ FAUSTFLOAT step,
+ ItemType type)
+ {
+ std::string path = buildPath(label);
+ fFullPaths.push_back(path);
+
+ // handle scale metadata
+ ValueConverter* converter = nullptr;
+ switch (fCurrentScale) {
+ case kLin:
+ converter = new LinearValueConverter(0, 1, min, max);
+ break;
+ case kLog:
+ converter = new LogValueConverter(0, 1, min, max);
+ break;
+ case kExp:
+ converter = new ExpValueConverter(0, 1, min, max);
+ break;
+ }
+ fCurrentScale = kLin;
+
+ fItems.push_back(Item(label, "", path, converter, zone, init, min, max, step, type));
+
+ if (fCurrentAcc.size() > 0 && fCurrentGyr.size() > 0) {
+ fprintf(stderr, "warning : 'acc' and 'gyr' metadata used for the same %s parameter !!\n", label);
+ }
+
+ // handle acc metadata "...[acc : <axe> <curve> <amin> <amid> <amax>]..."
+ if (fCurrentAcc.size() > 0) {
+ std::istringstream iss(fCurrentAcc);
+ int axe, curve;
+ double amin, amid, amax;
+ iss >> axe >> curve >> amin >> amid >> amax;
+
+ if ((0 <= axe) && (axe < 3) &&
+ (0 <= curve) && (curve < 4) &&
+ (amin < amax) && (amin <= amid) && (amid <= amax))
+ {
+ fAcc[axe].push_back(new CurveZoneControl(zone, curve, amin, amid, amax, min, init, max));
+ } else {
+ fprintf(stderr, "incorrect acc metadata : %s \n", fCurrentAcc.c_str());
+ }
+ fCurrentAcc = "";
+ }
+
+ // handle gyr metadata "...[gyr : <axe> <curve> <amin> <amid> <amax>]..."
+ if (fCurrentGyr.size() > 0) {
+ std::istringstream iss(fCurrentGyr);
+ int axe, curve;
+ double amin, amid, amax;
+ iss >> axe >> curve >> amin >> amid >> amax;
+
+ if ((0 <= axe) && (axe < 3) &&
+ (0 <= curve) && (curve < 4) &&
+ (amin < amax) && (amin <= amid) && (amid <= amax))
+ {
+ fGyr[axe].push_back(new CurveZoneControl(zone, curve, amin, amid, amax, min, init, max));
+ } else {
+ fprintf(stderr, "incorrect gyr metadata : %s \n", fCurrentGyr.c_str());
+ }
+ fCurrentGyr = "";
+ }
+
+ // handle screencolor metadata "...[screencolor:red|green|blue|white]..."
+ if (fCurrentColor.size() > 0) {
+ if ((fCurrentColor == "red") && (fRedReader == nullptr)) {
+ fRedReader = new ZoneReader(zone, min, max);
+ fHasScreenControl = true;
+ } else if ((fCurrentColor == "green") && (fGreenReader == nullptr)) {
+ fGreenReader = new ZoneReader(zone, min, max);
+ fHasScreenControl = true;
+ } else if ((fCurrentColor == "blue") && (fBlueReader == nullptr)) {
+ fBlueReader = new ZoneReader(zone, min, max);
+ fHasScreenControl = true;
+ } else if ((fCurrentColor == "white") && (fRedReader == nullptr) && (fGreenReader == nullptr) && (fBlueReader == nullptr)) {
+ fRedReader = new ZoneReader(zone, min, max);
+ fGreenReader = new ZoneReader(zone, min, max);
+ fBlueReader = new ZoneReader(zone, min, max);
+ fHasScreenControl = true;
+ } else {
+ fprintf(stderr, "incorrect screencolor metadata : %s \n", fCurrentColor.c_str());
+ }
+ }
+ fCurrentColor = "";
+
+ fMetaData.push_back(fCurrentMetadata);
+ fCurrentMetadata.clear();
+ }
+
+ int getZoneIndex(std::vector<ZoneControl*>* table, int p, int val)
+ {
+ FAUSTFLOAT* zone = fItems[uint(p)].fZone;
+ for (size_t i = 0; i < table[val].size(); i++) {
+ if (zone == table[val][i]->getZone()) return int(i);
+ }
+ return -1;
+ }
+
+ void setConverter(std::vector<ZoneControl*>* table, int p, int val, int curve, double amin, double amid, double amax)
+ {
+ int id1 = getZoneIndex(table, p, 0);
+ int id2 = getZoneIndex(table, p, 1);
+ int id3 = getZoneIndex(table, p, 2);
+
+ // Deactivates everywhere..
+ if (id1 != -1) table[0][uint(id1)]->setActive(false);
+ if (id2 != -1) table[1][uint(id2)]->setActive(false);
+ if (id3 != -1) table[2][uint(id3)]->setActive(false);
+
+ if (val == -1) { // Means: no more mapping...
+ // So stay all deactivated...
+ } else {
+ int id4 = getZoneIndex(table, p, val);
+ if (id4 != -1) {
+ // Reactivate the one we edit...
+ table[val][uint(id4)]->setMappingValues(curve, amin, amid, amax, fItems[uint(p)].fMin, fItems[uint(p)].fInit, fItems[uint(p)].fMax);
+ table[val][uint(id4)]->setActive(true);
+ } else {
+ // Allocate a new CurveZoneControl which is 'active' by default
+ FAUSTFLOAT* zone = fItems[uint(p)].fZone;
+ table[val].push_back(new CurveZoneControl(zone, curve, amin, amid, amax, fItems[uint(p)].fMin, fItems[uint(p)].fInit, fItems[uint(p)].fMax));
+ }
+ }
+ }
+
+ void getConverter(std::vector<ZoneControl*>* table, int p, int& val, int& curve, double& amin, double& amid, double& amax)
+ {
+ int id1 = getZoneIndex(table, p, 0);
+ int id2 = getZoneIndex(table, p, 1);
+ int id3 = getZoneIndex(table, p, 2);
+
+ if (id1 != -1) {
+ val = 0;
+ curve = table[val][uint(id1)]->getCurve();
+ table[val][uint(id1)]->getMappingValues(amin, amid, amax);
+ } else if (id2 != -1) {
+ val = 1;
+ curve = table[val][uint(id2)]->getCurve();
+ table[val][uint(id2)]->getMappingValues(amin, amid, amax);
+ } else if (id3 != -1) {
+ val = 2;
+ curve = table[val][uint(id3)]->getCurve();
+ table[val][uint(id3)]->getMappingValues(amin, amid, amax);
+ } else {
+ val = -1; // No mapping
+ curve = 0;
+ amin = -100.;
+ amid = 0.;
+ amax = 100.;
+ }
+ }
+
+ public:
+
+ APIUI() : fHasScreenControl(false), fRedReader(nullptr), fGreenReader(nullptr), fBlueReader(nullptr), fCurrentScale(kLin)
+ {}
+
+ virtual ~APIUI()
+ {
+ for (const auto& it : fItems) delete it.fConversion;
+ for (int i = 0; i < 3; i++) {
+ for (const auto& it : fAcc[i]) delete it;
+ for (const auto& it : fGyr[i]) delete it;
+ }
+ delete fRedReader;
+ delete fGreenReader;
+ delete fBlueReader;
+ }
+
+ // -- widget's layouts
+
+ virtual void openTabBox(const char* label) { pushLabel(label); }
+ virtual void openHorizontalBox(const char* label) { pushLabel(label); }
+ virtual void openVerticalBox(const char* label) { pushLabel(label); }
+ virtual void closeBox()
+ {
+ if (popLabel()) {
+ // Shortnames can be computed when all fullnames are known
+ computeShortNames();
+ // Fill 'shortname' field for each item
+ for (const auto& it : fFull2Short) {
+ int index = getParamIndex(it.first.c_str());
+ fItems[index].fShortname = it.second;
+ }
+ }
+ }
+
+ // -- active widgets
+
+ virtual void addButton(const char* label, FAUSTFLOAT* zone)
+ {
+ addParameter(label, zone, 0, 0, 1, 1, kButton);
+ }
+
+ virtual void addCheckButton(const char* label, FAUSTFLOAT* zone)
+ {
+ addParameter(label, zone, 0, 0, 1, 1, kCheckButton);
+ }
+
+ virtual void addVerticalSlider(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT init, FAUSTFLOAT min, FAUSTFLOAT max, FAUSTFLOAT step)
+ {
+ addParameter(label, zone, init, min, max, step, kVSlider);
+ }
+
+ virtual void addHorizontalSlider(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT init, FAUSTFLOAT min, FAUSTFLOAT max, FAUSTFLOAT step)
+ {
+ addParameter(label, zone, init, min, max, step, kHSlider);
+ }
+
+ virtual void addNumEntry(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT init, FAUSTFLOAT min, FAUSTFLOAT max, FAUSTFLOAT step)
+ {
+ addParameter(label, zone, init, min, max, step, kNumEntry);
+ }
+
+ // -- passive widgets
+
+ virtual void addHorizontalBargraph(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT min, FAUSTFLOAT max)
+ {
+ addParameter(label, zone, min, min, max, (max-min)/1000.0f, kHBargraph);
+ }
+
+ virtual void addVerticalBargraph(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT min, FAUSTFLOAT max)
+ {
+ addParameter(label, zone, min, min, max, (max-min)/1000.0f, kVBargraph);
+ }
+
+ // -- soundfiles
+
+ virtual void addSoundfile(const char* /*label*/, const char* /*filename*/, Soundfile** /*sf_zone*/) {}
+
+ // -- metadata declarations
+
+ virtual void declare(FAUSTFLOAT* /*zone*/, const char* key, const char* val)
+ {
+ // Keep metadata
+ fCurrentMetadata[key] = val;
+
+ if (strcmp(key, "scale") == 0) {
+ if (strcmp(val, "log") == 0) {
+ fCurrentScale = kLog;
+ } else if (strcmp(val, "exp") == 0) {
+ fCurrentScale = kExp;
+ } else {
+ fCurrentScale = kLin;
+ }
+ } else if (strcmp(key, "unit") == 0) {
+ fCurrentUnit = val;
+ } else if (strcmp(key, "acc") == 0) {
+ fCurrentAcc = val;
+ } else if (strcmp(key, "gyr") == 0) {
+ fCurrentGyr = val;
+ } else if (strcmp(key, "screencolor") == 0) {
+ fCurrentColor = val; // val = "red", "green", "blue" or "white"
+ } else if (strcmp(key, "tooltip") == 0) {
+ fCurrentTooltip = val;
+ }
+ }
+
+ virtual void declare(const char* /*key*/, const char* /*val*/)
+ {}
+
+ //-------------------------------------------------------------------------------
+ // Simple API part
+ //-------------------------------------------------------------------------------
+ int getParamsCount() { return int(fItems.size()); }
+
+ int getParamIndex(const char* path_aux)
+ {
+ std::string path = std::string(path_aux);
+ auto it = find_if(fItems.begin(), fItems.end(),
+ [=](const Item& it) { return (it.fLabel == path) || (it.fShortname == path) || (it.fPath == path); });
+ return (it != fItems.end()) ? int(it - fItems.begin()) : -1;
+ }
+
+ const char* getParamLabel(int p) { return fItems[uint(p)].fLabel.c_str(); }
+ const char* getParamShortname(int p) { return fItems[uint(p)].fShortname.c_str(); }
+ const char* getParamAddress(int p) { return fItems[uint(p)].fPath.c_str(); }
+
+ std::map<const char*, const char*> getMetadata(int p)
+ {
+ std::map<const char*, const char*> res;
+ std::map<std::string, std::string> metadata = fMetaData[uint(p)];
+ for (const auto& it : metadata) {
+ res[it.first.c_str()] = it.second.c_str();
+ }
+ return res;
+ }
+
+ const char* getMetadata(int p, const char* key)
+ {
+ return (fMetaData[uint(p)].find(key) != fMetaData[uint(p)].end()) ? fMetaData[uint(p)][key].c_str() : "";
+ }
+ FAUSTFLOAT getParamMin(int p) { return fItems[uint(p)].fMin; }
+ FAUSTFLOAT getParamMax(int p) { return fItems[uint(p)].fMax; }
+ FAUSTFLOAT getParamStep(int p) { return fItems[uint(p)].fStep; }
+ FAUSTFLOAT getParamInit(int p) { return fItems[uint(p)].fInit; }
+
+ FAUSTFLOAT* getParamZone(int p) { return fItems[uint(p)].fZone; }
+
+ FAUSTFLOAT getParamValue(int p) { return *fItems[uint(p)].fZone; }
+ FAUSTFLOAT getParamValue(const char* path)
+ {
+ int index = getParamIndex(path);
+ if (index >= 0) {
+ return getParamValue(index);
+ } else {
+ fprintf(stderr, "getParamValue : '%s' not found\n", (path == nullptr ? "NULL" : path));
+ return FAUSTFLOAT(0);
+ }
+ }
+
+ void setParamValue(int p, FAUSTFLOAT v) { *fItems[uint(p)].fZone = v; }
+ void setParamValue(const char* path, FAUSTFLOAT v)
+ {
+ int index = getParamIndex(path);
+ if (index >= 0) {
+ setParamValue(index, v);
+ } else {
+ fprintf(stderr, "setParamValue : '%s' not found\n", (path == nullptr ? "NULL" : path));
+ }
+ }
+
+ double getParamRatio(int p) { return fItems[uint(p)].fConversion->faust2ui(*fItems[uint(p)].fZone); }
+ void setParamRatio(int p, double r) { *fItems[uint(p)].fZone = FAUSTFLOAT(fItems[uint(p)].fConversion->ui2faust(r)); }
+
+ double value2ratio(int p, double r) { return fItems[uint(p)].fConversion->faust2ui(r); }
+ double ratio2value(int p, double r) { return fItems[uint(p)].fConversion->ui2faust(r); }
+
+ /**
+ * Return the control type (kAcc, kGyr, or -1) for a given parameter.
+ *
+ * @param p - the UI parameter index
+ *
+ * @return the type
+ */
+ Type getParamType(int p)
+ {
+ if (p >= 0) {
+ if (getZoneIndex(fAcc, p, 0) != -1
+ || getZoneIndex(fAcc, p, 1) != -1
+ || getZoneIndex(fAcc, p, 2) != -1) {
+ return kAcc;
+ } else if (getZoneIndex(fGyr, p, 0) != -1
+ || getZoneIndex(fGyr, p, 1) != -1
+ || getZoneIndex(fGyr, p, 2) != -1) {
+ return kGyr;
+ }
+ }
+ return kNoType;
+ }
+
+ /**
+ * Return the Item type (kButton = 0, kCheckButton, kVSlider, kHSlider, kNumEntry, kHBargraph, kVBargraph) for a given parameter.
+ *
+ * @param p - the UI parameter index
+ *
+ * @return the Item type
+ */
+ ItemType getParamItemType(int p)
+ {
+ return fItems[uint(p)].fItemType;
+ }
+
+ /**
+ * Set a new value coming from an accelerometer, propagate it to all relevant FAUSTFLOAT* zones.
+ *
+ * @param acc - 0 for X accelerometer, 1 for Y accelerometer, 2 for Z accelerometer
+ * @param value - the new value
+ *
+ */
+ void propagateAcc(int acc, double value)
+ {
+ for (size_t i = 0; i < fAcc[acc].size(); i++) {
+ fAcc[acc][i]->update(value);
+ }
+ }
+
+ /**
+ * Used to edit accelerometer curves and mapping. Set curve and related mapping for a given UI parameter.
+ *
+ * @param p - the UI parameter index
+ * @param acc - 0 for X accelerometer, 1 for Y accelerometer, 2 for Z accelerometer (-1 means "no mapping")
+ * @param curve - between 0 and 3
+ * @param amin - mapping 'min' point
+ * @param amid - mapping 'middle' point
+ * @param amax - mapping 'max' point
+ *
+ */
+ void setAccConverter(int p, int acc, int curve, double amin, double amid, double amax)
+ {
+ setConverter(fAcc, p, acc, curve, amin, amid, amax);
+ }
+
+ /**
+ * Used to edit gyroscope curves and mapping. Set curve and related mapping for a given UI parameter.
+ *
+ * @param p - the UI parameter index
+ * @param gyr - 0 for X gyroscope, 1 for Y gyroscope, 2 for Z gyroscope (-1 means "no mapping")
+ * @param curve - between 0 and 3
+ * @param amin - mapping 'min' point
+ * @param amid - mapping 'middle' point
+ * @param amax - mapping 'max' point
+ *
+ */
+ void setGyrConverter(int p, int gyr, int curve, double amin, double amid, double amax)
+ {
+ setConverter(fGyr, p, gyr, curve, amin, amid, amax);
+ }
+
+ /**
+ * Used to edit accelerometer curves and mapping. Get curve and related mapping for a given UI parameter.
+ *
+ * @param p - the UI parameter index
+ * @param acc - the acc value to be retrieved (-1 means "no mapping")
+ * @param curve - the curve value to be retrieved
+ * @param amin - the amin value to be retrieved
+ * @param amid - the amid value to be retrieved
+ * @param amax - the amax value to be retrieved
+ *
+ */
+ void getAccConverter(int p, int& acc, int& curve, double& amin, double& amid, double& amax)
+ {
+ getConverter(fAcc, p, acc, curve, amin, amid, amax);
+ }
+
+ /**
+ * Used to edit gyroscope curves and mapping. Get curve and related mapping for a given UI parameter.
+ *
+ * @param p - the UI parameter index
+ * @param gyr - the gyr value to be retrieved (-1 means "no mapping")
+ * @param curve - the curve value to be retrieved
+ * @param amin - the amin value to be retrieved
+ * @param amid - the amid value to be retrieved
+ * @param amax - the amax value to be retrieved
+ *
+ */
+ void getGyrConverter(int p, int& gyr, int& curve, double& amin, double& amid, double& amax)
+ {
+ getConverter(fGyr, p, gyr, curve, amin, amid, amax);
+ }
+
+ /**
+ * Set a new value coming from an gyroscope, propagate it to all relevant FAUSTFLOAT* zones.
+ *
+ * @param gyr - 0 for X gyroscope, 1 for Y gyroscope, 2 for Z gyroscope
+ * @param value - the new value
+ *
+ */
+ void propagateGyr(int gyr, double value)
+ {
+ for (size_t i = 0; i < fGyr[gyr].size(); i++) {
+ fGyr[gyr][i]->update(value);
+ }
+ }
+
+ /**
+ * Get the number of FAUSTFLOAT* zones controlled with the accelerometer.
+ *
+ * @param acc - 0 for X accelerometer, 1 for Y accelerometer, 2 for Z accelerometer
+ * @return the number of zones
+ *
+ */
+ int getAccCount(int acc)
+ {
+ return (acc >= 0 && acc < 3) ? int(fAcc[acc].size()) : 0;
+ }
+
+ /**
+ * Get the number of FAUSTFLOAT* zones controlled with the gyroscope.
+ *
+ * @param gyr - 0 for X gyroscope, 1 for Y gyroscope, 2 for Z gyroscope
+ * @param the number of zones
+ *
+ */
+ int getGyrCount(int gyr)
+ {
+ return (gyr >= 0 && gyr < 3) ? int(fGyr[gyr].size()) : 0;
+ }
+
+ // getScreenColor() : -1 means no screen color control (no screencolor metadata found)
+ // otherwise return 0x00RRGGBB a ready to use color
+ int getScreenColor()
+ {
+ if (fHasScreenControl) {
+ int r = (fRedReader) ? fRedReader->getValue() : 0;
+ int g = (fGreenReader) ? fGreenReader->getValue() : 0;
+ int b = (fBlueReader) ? fBlueReader->getValue() : 0;
+ return (r<<16) | (g<<8) | b;
+ } else {
+ return -1;
+ }
+ }
+
+};
+
+#endif
+/************************** END APIUI.h **************************/
+
+// NOTE: "faust -scn name" changes the last line above to
+// #include <faust/name/name.h>
+
+//----------------------------------------------------------------------------
+// FAUST Generated Code
+//----------------------------------------------------------------------------
+
+
+#ifndef FAUSTFLOAT
+#define FAUSTFLOAT float
+#endif
+
+#include <algorithm>
+#include <cmath>
+#include <cstdint>
+#include <math.h>
+
+#ifndef FAUSTCLASS
+#define FAUSTCLASS volumedsp
+#endif
+
+#ifdef __APPLE__
+#define exp10f __exp10f
+#define exp10 __exp10
+#endif
+
+#if defined(_WIN32)
+#define RESTRICT __restrict
+#else
+#define RESTRICT __restrict__
+#endif
+
+
+class volumedsp : public dsp {
+
+ private:
+
+ FAUSTFLOAT fHslider0;
+ FAUSTFLOAT fCheckbox0;
+ int fSampleRate;
+ float fConst0;
+ float fConst1;
+ float fRec0[2];
+
+ public:
+
+ void metadata(Meta* m) {
+ m->declare("author", "Matt Horton, adapted from GRAME");
+ m->declare("basics.lib/name", "Faust Basic Element Library");
+ m->declare("basics.lib/version", "0.8");
+ m->declare("compile_options", "-a faust2header.cpp -lang cpp -i -inpl -cn volumedsp -es 1 -mcd 16 -single -ftz 0");
+ m->declare("description", "Volume Control Faust Plugin for JackTrip, based on Faust examples");
+ m->declare("filename", "volumedsp.dsp");
+ m->declare("license", "MIT Style STK-4.2");
+ m->declare("maths.lib/author", "GRAME");
+ m->declare("maths.lib/copyright", "GRAME");
+ m->declare("maths.lib/license", "LGPL with exception");
+ m->declare("maths.lib/name", "Faust Math Library");
+ m->declare("maths.lib/version", "2.5");
+ m->declare("name", "volume");
+ m->declare("platform.lib/name", "Generic Platform Library");
+ m->declare("platform.lib/version", "0.2");
+ m->declare("signals.lib/name", "Faust Signal Routing Library");
+ m->declare("signals.lib/version", "0.3");
+ m->declare("version", "1.0");
+ }
+
+ virtual int getNumInputs() {
+ return 1;
+ }
+ virtual int getNumOutputs() {
+ return 1;
+ }
+
+ static void classInit(int /*sample_rate*/) {
+ }
+
+ virtual void instanceConstants(int sample_rate) {
+ fSampleRate = sample_rate;
+ fConst0 = 44.0999985f / std::min<float>(192000.0f, std::max<float>(1.0f, float(fSampleRate)));
+ fConst1 = 1.0f - fConst0;
+ }
+
+ virtual void instanceResetUserInterface() {
+ fHslider0 = FAUSTFLOAT(0.0f);
+ fCheckbox0 = FAUSTFLOAT(0.0f);
+ }
+
+ virtual void instanceClear() {
+ for (int l0 = 0; l0 < 2; l0 = l0 + 1) {
+ fRec0[l0] = 0.0f;
+ }
+ }
+
+ virtual void init(int sample_rate) {
+ classInit(sample_rate);
+ instanceInit(sample_rate);
+ }
+ virtual void instanceInit(int sample_rate) {
+ instanceConstants(sample_rate);
+ instanceResetUserInterface();
+ instanceClear();
+ }
+
+ virtual volumedsp* clone() {
+ return new volumedsp();
+ }
+
+ virtual int getSampleRate() {
+ return fSampleRate;
+ }
+
+ virtual void buildUserInterface(UI* ui_interface) {
+ ui_interface->openVerticalBox("Volume Control");
+ ui_interface->declare(&fHslider0, "0", "");
+ ui_interface->addHorizontalSlider("Volume", &fHslider0, FAUSTFLOAT(0.0f), FAUSTFLOAT(-40.0f), FAUSTFLOAT(0.0f), FAUSTFLOAT(0.100000001f));
+ ui_interface->declare(&fCheckbox0, "1", "");
+ ui_interface->addCheckButton("Mute", &fCheckbox0);
+ ui_interface->closeBox();
+ }
+
+ virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) {
+ FAUSTFLOAT* input0 = inputs[0];
+ FAUSTFLOAT* output0 = outputs[0];
+ float fSlow0 = float(fHslider0);
+ int iSlow1 = fSlow0 == -40.0f;
+ int iSlow2 = int(float(fCheckbox0));
+ float fSlow3 = fConst0 * std::pow(10.0f, 0.0500000007f * fSlow0);
+ for (int i0 = 0; i0 < count; i0 = i0 + 1) {
+ float fTemp0 = float(input0[i0]);
+ fRec0[0] = fSlow3 + fConst1 * fRec0[1];
+ float fThen0 = fTemp0 * fRec0[0];
+ float fThen1 = ((iSlow2) ? 0.0f : fThen0);
+ output0[i0] = FAUSTFLOAT(((iSlow1) ? 0.0f : fThen1));
+ fRec0[1] = fRec0[0];
+ }
+ }
+
+};
+
+
+#endif
diff --git a/src/zitarevdsp.h b/src/zitarevdsp.h
index 8b26291..0ee6905 100644
--- a/src/zitarevdsp.h
+++ b/src/zitarevdsp.h
@@ -1,7 +1,8 @@
/* ------------------------------------------------------------
name: "zitarevdsp"
-Code generated with Faust 2.28.6 (https://faust.grame.fr)
-Compilation options: -lang cpp -inpl -scal -ftz 0
+Code generated with Faust 2.41.1 (https://faust.grame.fr)
+Compilation options: -a faust2header.cpp -lang cpp -i -inpl -cn zitarevdsp -es 1 -mcd 16
+-single -ftz 0
------------------------------------------------------------ */
#ifndef __zitarevdsp_H__
@@ -14,23 +15,23 @@ Compilation options: -lang cpp -inpl -scal -ftz 0
// aimed at creating a simple C++ header file (.h) containing a Faust DSP.
// See the Makefile for how to use it.
-/************************** BEGIN dsp.h **************************/
-/************************************************************************
+/************************** BEGIN dsp.h ********************************
FAUST Architecture File
- Copyright (C) 2003-2017 GRAME, Centre National de Creation Musicale
+ Copyright (C) 2003-2022 GRAME, Centre National de Creation Musicale
---------------------------------------------------------------------
- This Architecture section is free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 3 of
- the License, or (at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; If not, see <http://www.gnu.org/licenses/>.
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
EXCEPTION : As a special exception, you may create a larger work
that contains this FAUST architecture section and distribute
@@ -44,29 +45,111 @@ Compilation options: -lang cpp -inpl -scal -ftz 0
#include <string>
#include <vector>
+/************************************************************************
+ ************************************************************************
+ FAUST compiler
+ Copyright (C) 2003-2018 GRAME, Centre National de Creation Musicale
+ ---------------------------------------------------------------------
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ ************************************************************************
+ ************************************************************************/
+
+#ifndef __export__
+#define __export__
+
+#define FAUSTVERSION "2.41.1"
+
+// Use FAUST_API for code that is part of the external API but is also compiled in faust
+// and libfaust Use LIBFAUST_API for code that is compiled in faust and libfaust
+
+#ifdef _WIN32
+#pragma warning(disable : 4251)
+#ifdef FAUST_EXE
+#define FAUST_API
+#define LIBFAUST_API
+#elif FAUST_LIB
+#define FAUST_API __declspec(dllexport)
+#define LIBFAUST_API __declspec(dllexport)
+#else
+#define FAUST_API
+#define LIBFAUST_API
+#endif
+#else
+#ifdef FAUST_EXE
+#define FAUST_API
+#define LIBFAUST_API
+#else
+#define FAUST_API __attribute__((visibility("default")))
+#define LIBFAUST_API __attribute__((visibility("default")))
+#endif
+#endif
+
+#endif
+
#ifndef FAUSTFLOAT
#define FAUSTFLOAT float
#endif
-struct UI;
-struct Meta;
+struct FAUST_API UI;
+struct FAUST_API Meta;
/**
* DSP memory manager.
*/
-struct dsp_memory_manager {
+struct FAUST_API dsp_memory_manager {
virtual ~dsp_memory_manager() {}
+ /**
+ * Inform the Memory Manager with the number of expected memory zones.
+ * @param count - the number of expected memory zones
+ */
+ virtual void begin(size_t /*count*/) {}
+
+ /**
+ * Give the Memory Manager information on a given memory zone.
+ * @param size - the size in bytes of the memory zone
+ * @param reads - the number of Read access to the zone used to compute one frame
+ * @param writes - the number of Write access to the zone used to compute one frame
+ */
+ virtual void info(size_t /*size*/, size_t /*reads*/, size_t /*writes*/) {}
+
+ /**
+ * Inform the Memory Manager that all memory zones have been described,
+ * to possibly start a 'compute the best allocation strategy' step.
+ */
+ virtual void end() {}
+
+ /**
+ * Allocate a memory zone.
+ * @param size - the memory zone size in bytes
+ */
virtual void* allocate(size_t size) = 0;
- virtual void destroy(void* ptr) = 0;
+
+ /**
+ * Destroy a memory zone.
+ * @param ptr - the memory zone pointer to be deallocated
+ */
+ virtual void destroy(void* ptr) = 0;
};
/**
* Signal processor definition.
*/
-class dsp
+class FAUST_API dsp
{
public:
dsp() {}
@@ -86,7 +169,7 @@ class dsp
*/
virtual void buildUserInterface(UI* ui_interface) = 0;
- /* Returns the sample rate currently used by the instance */
+ /* Return the sample rate currently used by the instance */
virtual int getSampleRate() = 0;
/**
@@ -94,28 +177,28 @@ class dsp
* - static class 'classInit': static tables initialization
* - 'instanceInit': constants and instance state initialization
*
- * @param sample_rate - the sampling rate in Hertz
+ * @param sample_rate - the sampling rate in Hz
*/
virtual void init(int sample_rate) = 0;
/**
* Init instance state
*
- * @param sample_rate - the sampling rate in Hertz
+ * @param sample_rate - the sampling rate in Hz
*/
virtual void instanceInit(int sample_rate) = 0;
/**
* Init instance constant state
*
- * @param sample_rate - the sampling rate in Hertz
+ * @param sample_rate - the sampling rate in Hz
*/
virtual void instanceConstants(int sample_rate) = 0;
/* Init default control parameters values */
virtual void instanceResetUserInterface() = 0;
- /* Init instance state (delay lines...) */
+ /* Init instance state (like delay lines...) but keep the control parameter values */
virtual void instanceClear() = 0;
/**
@@ -167,7 +250,7 @@ class dsp
* Generic DSP decorator.
*/
-class decorator_dsp : public dsp
+class FAUST_API decorator_dsp : public dsp
{
protected:
dsp* fDSP;
@@ -206,10 +289,11 @@ class decorator_dsp : public dsp
};
/**
- * DSP factory class.
+ * DSP factory class, used with LLVM and Interpreter backends
+ * to create DSP instances from a compiled DSP program.
*/
-class dsp_factory
+class FAUST_API dsp_factory
{
protected:
// So that to force sub-classes to use deleteDSPFactory(dsp_factory* factory);
@@ -229,75 +313,114 @@ class dsp_factory
virtual dsp_memory_manager* getMemoryManager() = 0;
};
-/**
- * On Intel set FZ (Flush to Zero) and DAZ (Denormals Are Zero)
- * flags to avoid costly denormals.
- */
+// Denormal handling
-#ifdef __SSE__
+#if defined(__SSE__)
#include <xmmintrin.h>
-#ifdef __SSE2__
-#define AVOIDDENORMALS _mm_setcsr(_mm_getcsr() | 0x8040)
+#endif
+
+class FAUST_API ScopedNoDenormals
+{
+ private:
+ intptr_t fpsr;
+
+ void setFpStatusRegister(intptr_t fpsr_aux) noexcept
+ {
+#if defined(__arm64__) || defined(__aarch64__)
+ asm volatile("msr fpcr, %0" : : "ri"(fpsr_aux));
+#elif defined(__SSE__)
+ _mm_setcsr(static_cast<uint32_t>(fpsr_aux));
+#endif
+ }
+
+ void getFpStatusRegister() noexcept
+ {
+#if defined(__arm64__) || defined(__aarch64__)
+ asm volatile("mrs %0, fpcr" : "=r"(fpsr));
+#elif defined(__SSE__)
+ fpsr = static_cast<intptr_t>(_mm_getcsr());
+#endif
+ }
+
+ public:
+ ScopedNoDenormals() noexcept
+ {
+#if defined(__arm64__) || defined(__aarch64__)
+ intptr_t mask = (1 << 24 /* FZ */);
+#else
+#if defined(__SSE__)
+#if defined(__SSE2__)
+ intptr_t mask = 0x8040;
#else
-#define AVOIDDENORMALS _mm_setcsr(_mm_getcsr() | 0x8000)
+ intptr_t mask = 0x8000;
#endif
#else
-#define AVOIDDENORMALS
+ intptr_t mask = 0x0000;
#endif
-
#endif
-/************************** END dsp.h **************************/
+ getFpStatusRegister();
+ setFpStatusRegister(fpsr | mask);
+ }
-/************************** BEGIN APIUI.h **************************/
-/************************************************************************
- FAUST Architecture File
- Copyright (C) 2003-2017 GRAME, Centre National de Creation Musicale
- ---------------------------------------------------------------------
- This Architecture section is free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 3 of
- the License, or (at your option) any later version.
+ ~ScopedNoDenormals() noexcept { setFpStatusRegister(fpsr); }
+};
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+#define AVOIDDENORMALS ScopedNoDenormals();
- You should have received a copy of the GNU General Public License
- along with this program; If not, see <http://www.gnu.org/licenses/>.
+#endif
- EXCEPTION : As a special exception, you may create a larger work
- that contains this FAUST architecture section and distribute
- that work under terms of your choice, so long as this FAUST
- architecture section is not modified.
- ************************************************************************/
+/************************** END dsp.h **************************/
+/************************** BEGIN APIUI.h *****************************
+FAUST Architecture File
+Copyright (C) 2003-2022 GRAME, Centre National de Creation Musicale
+---------------------------------------------------------------------
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+EXCEPTION : As a special exception, you may create a larger work
+that contains this FAUST architecture section and distribute
+that work under terms of your choice, so long as this FAUST
+architecture section is not modified.
+************************************************************************/
#ifndef API_UI_H
#define API_UI_H
-#include <iostream>
+#include <stdio.h>
+
#include <map>
#include <sstream>
#include <string>
#include <vector>
-/************************** BEGIN meta.h **************************/
-/************************************************************************
+/************************** BEGIN meta.h *******************************
FAUST Architecture File
- Copyright (C) 2003-2017 GRAME, Centre National de Creation Musicale
+ Copyright (C) 2003-2022 GRAME, Centre National de Creation Musicale
---------------------------------------------------------------------
- This Architecture section is free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 3 of
- the License, or (at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; If not, see <http://www.gnu.org/licenses/>.
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
EXCEPTION : As a special exception, you may create a larger work
that contains this FAUST architecture section and distribute
@@ -308,36 +431,40 @@ class dsp_factory
#ifndef __meta__
#define __meta__
-struct Meta {
- virtual ~Meta(){};
+/**
+ The base class of Meta handler to be used in dsp::metadata(Meta* m) method to retrieve
+ (key, value) metadata.
+ */
+struct FAUST_API Meta {
+ virtual ~Meta() {}
virtual void declare(const char* key, const char* value) = 0;
};
#endif
/************************** END meta.h **************************/
-/************************** BEGIN UI.h **************************/
-/************************************************************************
+/************************** BEGIN UI.h *****************************
FAUST Architecture File
- Copyright (C) 2003-2020 GRAME, Centre National de Creation Musicale
+ Copyright (C) 2003-2022 GRAME, Centre National de Creation Musicale
---------------------------------------------------------------------
- This Architecture section is free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 3 of
- the License, or (at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; If not, see <http://www.gnu.org/licenses/>.
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
EXCEPTION : As a special exception, you may create a larger work
that contains this FAUST architecture section and distribute
that work under terms of your choice, so long as this FAUST
architecture section is not modified.
- ************************************************************************/
+ ********************************************************************/
#ifndef __UI_H__
#define __UI_H__
@@ -356,7 +483,7 @@ struct Meta {
struct Soundfile;
template<typename REAL>
-struct UIReal {
+struct FAUST_API UIReal {
UIReal() {}
virtual ~UIReal() {}
@@ -387,38 +514,41 @@ struct UIReal {
// -- soundfiles
- virtual void addSoundfile(const char* label, const char* filename,
- Soundfile** sf_zone) = 0;
+ virtual void addSoundfile(const char* /*label*/, const char* /*filename*/,
+ Soundfile** /*sf_zone*/) = 0;
// -- metadata declarations
- virtual void declare(REAL* zone, const char* key, const char* val) {}
+ virtual void declare(REAL* /*zone*/, const char* /*key*/, const char* /*val*/) {}
+
+ // To be used by LLVM client
+ virtual int sizeOfFAUSTFLOAT() { return sizeof(FAUSTFLOAT); }
};
-struct UI : public UIReal<FAUSTFLOAT> {
+struct FAUST_API UI : public UIReal<FAUSTFLOAT> {
UI() {}
virtual ~UI() {}
};
#endif
/************************** END UI.h **************************/
-/************************** BEGIN PathBuilder.h **************************/
-/************************************************************************
+/************************** BEGIN PathBuilder.h **************************
FAUST Architecture File
- Copyright (C) 2003-2017 GRAME, Centre National de Creation Musicale
+ Copyright (C) 2003-2022 GRAME, Centre National de Creation Musicale
---------------------------------------------------------------------
- This Architecture section is free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 3 of
- the License, or (at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; If not, see <http://www.gnu.org/licenses/>.
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
EXCEPTION : As a special exception, you may create a larger work
that contains this FAUST architecture section and distribute
@@ -426,10 +556,13 @@ struct UI : public UIReal<FAUSTFLOAT> {
architecture section is not modified.
************************************************************************/
-#ifndef FAUST_PATHBUILDER_H
-#define FAUST_PATHBUILDER_H
+#ifndef __PathBuilder__
+#define __PathBuilder__
#include <algorithm>
+#include <map>
+#include <regex>
+#include <set>
#include <string>
#include <vector>
@@ -438,113 +571,266 @@ struct UI : public UIReal<FAUSTFLOAT> {
* Helper class to build complete hierarchical path for UI items.
******************************************************************************/
-class PathBuilder
+class FAUST_API PathBuilder
{
protected:
std::vector<std::string> fControlsLevel;
+ std::vector<std::string> fFullPaths;
+ std::map<std::string, std::string> fFull2Short; // filled by computeShortNames()
+
+ /**
+ * @brief check if a character is acceptable for an ID
+ *
+ * @param c
+ * @return true is the character is acceptable for an ID
+ */
+ bool isIDChar(char c) const
+ {
+ return ((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z'))
+ || ((c >= '0') && (c <= '9'));
+ }
+
+ /**
+ * @brief remove all "/0x00" parts
+ *
+ * @param src
+ * @return modified string
+ */
+ std::string remove0x00(const std::string& src) const
+ {
+ return std::regex_replace(src, std::regex("/0x00"), "");
+ }
+
+ /**
+ * @brief replace all non ID char with '_' (one '_' may replace several non ID char)
+ *
+ * @param src
+ * @return modified string
+ */
+ std::string str2ID(const std::string& src) const
+ {
+ std::string dst;
+ bool need_underscore = false;
+ for (char c : src) {
+ if (isIDChar(c) || (c == '/')) {
+ if (need_underscore) {
+ dst.push_back('_');
+ need_underscore = false;
+ }
+ dst.push_back(c);
+ } else {
+ need_underscore = true;
+ }
+ }
+ return dst;
+ }
+
+ /**
+ * @brief Keep only the last n slash-parts
+ *
+ * @param src
+ * @param n : 1 indicates the last slash-part
+ * @return modified string
+ */
+ std::string cut(const std::string& src, int n) const
+ {
+ std::string rdst;
+ for (int i = int(src.length()) - 1; i >= 0; i--) {
+ char c = src[i];
+ if (c != '/') {
+ rdst.push_back(c);
+ } else if (n == 1) {
+ std::string dst;
+ for (int j = int(rdst.length()) - 1; j >= 0; j--) {
+ dst.push_back(rdst[j]);
+ }
+ return dst;
+ } else {
+ n--;
+ rdst.push_back(c);
+ }
+ }
+ return src;
+ }
+
+ void addFullPath(const std::string& label) { fFullPaths.push_back(buildPath(label)); }
+
+ /**
+ * @brief Compute the mapping between full path and short names
+ */
+ void computeShortNames()
+ {
+ std::vector<std::string>
+ uniquePaths; // all full paths transformed but made unique with a prefix
+ std::map<std::string, std::string>
+ unique2full; // all full paths transformed but made unique with a prefix
+ char num_buffer[16];
+ int pnum = 0;
+
+ for (const auto& s : fFullPaths) {
+ sprintf(num_buffer, "%d", pnum++);
+ std::string u = "/P" + std::string(num_buffer) + str2ID(remove0x00(s));
+ uniquePaths.push_back(u);
+ unique2full[u] = s; // remember the full path associated to a unique path
+ }
+
+ std::map<std::string, int> uniquePath2level; // map path to level
+ for (const auto& s : uniquePaths)
+ uniquePath2level[s] = 1; // we init all levels to 1
+ bool have_collisions = true;
+
+ while (have_collisions) {
+ // compute collision list
+ std::set<std::string> collisionSet;
+ std::map<std::string, std::string> short2full;
+ have_collisions = false;
+ for (const auto& it : uniquePath2level) {
+ std::string u = it.first;
+ int n = it.second;
+ std::string shortName = cut(u, n);
+ auto p = short2full.find(shortName);
+ if (p == short2full.end()) {
+ // no collision
+ short2full[shortName] = u;
+ } else {
+ // we have a collision, add the two paths to the collision set
+ have_collisions = true;
+ collisionSet.insert(u);
+ collisionSet.insert(p->second);
+ }
+ }
+ for (const auto& s : collisionSet)
+ uniquePath2level[s]++; // increase level of colliding path
+ }
+
+ for (const auto& it : uniquePath2level) {
+ std::string u = it.first;
+ int n = it.second;
+ std::string shortName = replaceCharList(cut(u, n), {'/'}, '_');
+ fFull2Short[unique2full[u]] = shortName;
+ }
+ }
+
+ std::string replaceCharList(const std::string& str, const std::vector<char>& ch1,
+ char ch2)
+ {
+ auto beg = ch1.begin();
+ auto end = ch1.end();
+ std::string res = str;
+ for (size_t i = 0; i < str.length(); ++i) {
+ if (std::find(beg, end, str[i]) != end)
+ res[i] = ch2;
+ }
+ return res;
+ }
public:
PathBuilder() {}
virtual ~PathBuilder() {}
+ // Return true for the first level of groups
+ bool pushLabel(const std::string& label)
+ {
+ fControlsLevel.push_back(label);
+ return fControlsLevel.size() == 1;
+ }
+
+ // Return true for the last level of groups
+ bool popLabel()
+ {
+ fControlsLevel.pop_back();
+ return fControlsLevel.size() == 0;
+ }
+
std::string buildPath(const std::string& label)
{
std::string res = "/";
for (size_t i = 0; i < fControlsLevel.size(); i++) {
- res += fControlsLevel[i];
- res += "/";
+ res = res + fControlsLevel[i] + "/";
}
res += label;
- std::replace(res.begin(), res.end(), ' ', '_');
- return res;
+ return replaceCharList(
+ res, {' ', '#', '*', ',', '?', '[', ']', '{', '}', '(', ')'}, '_');
}
-
- std::string buildLabel(std::string label)
- {
- std::replace(label.begin(), label.end(), ' ', '_');
- return label;
- }
-
- void pushLabel(const std::string& label) { fControlsLevel.push_back(label); }
- void popLabel() { fControlsLevel.pop_back(); }
};
-#endif // FAUST_PATHBUILDER_H
+#endif // __PathBuilder__
/************************** END PathBuilder.h **************************/
-/************************** BEGIN ValueConverter.h **************************/
-/************************************************************************
+/************************** BEGIN ValueConverter.h ********************
FAUST Architecture File
- Copyright (C) 2003-2017 GRAME, Centre National de Creation Musicale
+ Copyright (C) 2003-2022 GRAME, Centre National de Creation Musicale
---------------------------------------------------------------------
- This Architecture section is free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 3 of
- the License, or (at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; If not, see <http://www.gnu.org/licenses/>.
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
EXCEPTION : As a special exception, you may create a larger work
that contains this FAUST architecture section and distribute
that work under terms of your choice, so long as this FAUST
architecture section is not modified.
- ************************************************************************/
+ ********************************************************************/
#ifndef __ValueConverter__
#define __ValueConverter__
/***************************************************************************************
- ValueConverter.h
- (GRAME, Copyright 2015-2019)
+ ValueConverter.h
+ (GRAME, Copyright 2015-2019)
-Set of conversion objects used to map user interface values (for example a gui slider
-delivering values between 0 and 1) to faust values (for example a vslider between
-20 and 20000) using a log scale.
+ Set of conversion objects used to map user interface values (for example a gui slider
+ delivering values between 0 and 1) to faust values (for example a vslider between
+ 20 and 20000) using a log scale.
--- Utilities
+ -- Utilities
-Range(lo,hi) : clip a value x between lo and hi
-Interpolator(lo,hi,v1,v2) : Maps a value x between lo and hi to a value y between v1 and
+ Range(lo,hi) : clip a value x between lo and hi
+ Interpolator(lo,hi,v1,v2) : Maps a value x between lo and hi to a value y between v1 and
v2 Interpolator3pt(lo,mi,hi,v1,vm,v2) : Map values between lo mid hi to values between v1
vm v2
--- Value Converters
+ -- Value Converters
-ValueConverter::ui2faust(x)
-ValueConverter::faust2ui(x)
+ ValueConverter::ui2faust(x)
+ ValueConverter::faust2ui(x)
--- ValueConverters used for sliders depending of the scale
+ -- ValueConverters used for sliders depending of the scale
-LinearValueConverter(umin, umax, fmin, fmax)
-LinearValueConverter2(lo, mi, hi, v1, vm, v2) using 2 segments
-LogValueConverter(umin, umax, fmin, fmax)
-ExpValueConverter(umin, umax, fmin, fmax)
+ LinearValueConverter(umin, umax, fmin, fmax)
+ LinearValueConverter2(lo, mi, hi, v1, vm, v2) using 2 segments
+ LogValueConverter(umin, umax, fmin, fmax)
+ ExpValueConverter(umin, umax, fmin, fmax)
--- ValueConverters used for accelerometers based on 3 points
+ -- ValueConverters used for accelerometers based on 3 points
-AccUpConverter(amin, amid, amax, fmin, fmid, fmax) -- curve 0
-AccDownConverter(amin, amid, amax, fmin, fmid, fmax) -- curve 1
-AccUpDownConverter(amin, amid, amax, fmin, fmid, fmax) -- curve 2
-AccDownUpConverter(amin, amid, amax, fmin, fmid, fmax) -- curve 3
+ AccUpConverter(amin, amid, amax, fmin, fmid, fmax) -- curve 0
+ AccDownConverter(amin, amid, amax, fmin, fmid, fmax) -- curve 1
+ AccUpDownConverter(amin, amid, amax, fmin, fmid, fmax) -- curve 2
+ AccDownUpConverter(amin, amid, amax, fmin, fmid, fmax) -- curve 3
--- lists of ZoneControl are used to implement accelerometers metadata for each axes
+ -- lists of ZoneControl are used to implement accelerometers metadata for each axes
-ZoneControl(zone, valueConverter) : a zone with an accelerometer data converter
+ ZoneControl(zone, valueConverter) : a zone with an accelerometer data converter
--- ZoneReader are used to implement screencolor metadata
+ -- ZoneReader are used to implement screencolor metadata
-ZoneReader(zone, valueConverter) : a zone with a data converter
+ ZoneReader(zone, valueConverter) : a zone with a data converter
****************************************************************************************/
+#include <assert.h>
+#include <float.h>
+
#include <algorithm> // std::max
-#include <cassert>
-#include <cfloat>
#include <cmath>
#include <vector>
@@ -552,12 +838,12 @@ ZoneReader(zone, valueConverter) : a zone with a data converter
// Interpolator(lo,hi,v1,v2)
// Maps a value x between lo and hi to a value y between v1 and v2
// y = v1 + (x-lo)/(hi-lo)*(v2-v1)
-// y = v1 + (x-lo) * coef with coef = (v2-v1)/(hi-lo)
+// y = v1 + (x-lo) * coef with coef = (v2-v1)/(hi-lo)
// y = v1 + x*coef - lo*coef
// y = v1 - lo*coef + x*coef
-// y = offset + x*coef with offset = v1 - lo*coef
+// y = offset + x*coef with offset = v1 - lo*coef
//--------------------------------------------------------------------------------------
-class Interpolator
+class FAUST_API Interpolator
{
private:
//--------------------------------------------------------------------------------------
@@ -608,7 +894,7 @@ class Interpolator
// Interpolator3pt(lo,mi,hi,v1,vm,v2)
// Map values between lo mid hi to values between v1 vm v2
//--------------------------------------------------------------------------------------
-class Interpolator3pt
+class FAUST_API Interpolator3pt
{
private:
Interpolator fSegment1;
@@ -632,19 +918,19 @@ class Interpolator3pt
//--------------------------------------------------------------------------------------
// Abstract ValueConverter class. Converts values between UI and Faust representations
//--------------------------------------------------------------------------------------
-class ValueConverter
+class FAUST_API ValueConverter
{
public:
virtual ~ValueConverter() {}
- virtual double ui2faust(double x) = 0;
- virtual double faust2ui(double x) = 0;
+ virtual double ui2faust(double x) { return x; };
+ virtual double faust2ui(double x) { return x; };
};
//--------------------------------------------------------------------------------------
// A converter than can be updated
//--------------------------------------------------------------------------------------
-class UpdatableValueConverter : public ValueConverter
+class FAUST_API UpdatableValueConverter : public ValueConverter
{
protected:
bool fActive;
@@ -664,7 +950,7 @@ class UpdatableValueConverter : public ValueConverter
//--------------------------------------------------------------------------------------
// Linear conversion between ui and Faust values
//--------------------------------------------------------------------------------------
-class LinearValueConverter : public ValueConverter
+class FAUST_API LinearValueConverter : public ValueConverter
{
private:
Interpolator fUI2F;
@@ -684,7 +970,7 @@ class LinearValueConverter : public ValueConverter
//--------------------------------------------------------------------------------------
// Two segments linear conversion between ui and Faust values
//--------------------------------------------------------------------------------------
-class LinearValueConverter2 : public UpdatableValueConverter
+class FAUST_API LinearValueConverter2 : public UpdatableValueConverter
{
private:
Interpolator3pt fUI2F;
@@ -720,7 +1006,7 @@ class LinearValueConverter2 : public UpdatableValueConverter
//--------------------------------------------------------------------------------------
// Logarithmic conversion between ui and Faust values
//--------------------------------------------------------------------------------------
-class LogValueConverter : public LinearValueConverter
+class FAUST_API LogValueConverter : public LinearValueConverter
{
public:
LogValueConverter(double umin, double umax, double fmin, double fmax)
@@ -742,7 +1028,7 @@ class LogValueConverter : public LinearValueConverter
//--------------------------------------------------------------------------------------
// Exponential conversion between ui and Faust values
//--------------------------------------------------------------------------------------
-class ExpValueConverter : public LinearValueConverter
+class FAUST_API ExpValueConverter : public LinearValueConverter
{
public:
ExpValueConverter(double umin, double umax, double fmin, double fmax)
@@ -765,7 +1051,7 @@ class ExpValueConverter : public LinearValueConverter
// Convert accelerometer or gyroscope values to Faust values
// Using an Up curve (curve 0)
//--------------------------------------------------------------------------------------
-class AccUpConverter : public UpdatableValueConverter
+class FAUST_API AccUpConverter : public UpdatableValueConverter
{
private:
Interpolator3pt fA2F;
@@ -801,7 +1087,7 @@ class AccUpConverter : public UpdatableValueConverter
// Convert accelerometer or gyroscope values to Faust values
// Using a Down curve (curve 1)
//--------------------------------------------------------------------------------------
-class AccDownConverter : public UpdatableValueConverter
+class FAUST_API AccDownConverter : public UpdatableValueConverter
{
private:
Interpolator3pt fA2F;
@@ -837,14 +1123,14 @@ class AccDownConverter : public UpdatableValueConverter
// Convert accelerometer or gyroscope values to Faust values
// Using an Up-Down curve (curve 2)
//--------------------------------------------------------------------------------------
-class AccUpDownConverter : public UpdatableValueConverter
+class FAUST_API AccUpDownConverter : public UpdatableValueConverter
{
private:
Interpolator3pt fA2F;
Interpolator fF2A;
public:
- AccUpDownConverter(double amin, double amid, double amax, double fmin, double fmid,
+ AccUpDownConverter(double amin, double amid, double amax, double fmin, double /*fmid*/,
double fmax)
: fA2F(amin, amid, amax, fmin, fmax, fmin)
, fF2A(fmin, fmax, amin,
@@ -856,7 +1142,7 @@ class AccUpDownConverter : public UpdatableValueConverter
virtual double faust2ui(double x) { return fF2A(x); }
virtual void setMappingValues(double amin, double amid, double amax, double fmin,
- double fmid, double fmax)
+ double /*fmid*/, double fmax)
{
//__android_log_print(ANDROID_LOG_ERROR, "Faust", "AccUpDownConverter update %f %f
//%f %f %f %f", amin,amid,amax,fmin,fmid,fmax);
@@ -874,14 +1160,14 @@ class AccUpDownConverter : public UpdatableValueConverter
// Convert accelerometer or gyroscope values to Faust values
// Using a Down-Up curve (curve 3)
//--------------------------------------------------------------------------------------
-class AccDownUpConverter : public UpdatableValueConverter
+class FAUST_API AccDownUpConverter : public UpdatableValueConverter
{
private:
Interpolator3pt fA2F;
Interpolator fF2A;
public:
- AccDownUpConverter(double amin, double amid, double amax, double fmin, double fmid,
+ AccDownUpConverter(double amin, double amid, double amax, double fmin, double /*fmid*/,
double fmax)
: fA2F(amin, amid, amax, fmax, fmin, fmax)
, fF2A(fmin, fmax, amin,
@@ -893,7 +1179,7 @@ class AccDownUpConverter : public UpdatableValueConverter
virtual double faust2ui(double x) { return fF2A(x); }
virtual void setMappingValues(double amin, double amid, double amax, double fmin,
- double fmid, double fmax)
+ double /*fmid*/, double fmax)
{
//__android_log_print(ANDROID_LOG_ERROR, "Faust", "AccDownUpConverter update %f %f
//%f %f %f %f", amin,amid,amax,fmin,fmid,fmax);
@@ -910,7 +1196,7 @@ class AccDownUpConverter : public UpdatableValueConverter
//--------------------------------------------------------------------------------------
// Base class for ZoneControl
//--------------------------------------------------------------------------------------
-class ZoneControl
+class FAUST_API ZoneControl
{
protected:
FAUSTFLOAT* fZone;
@@ -919,17 +1205,17 @@ class ZoneControl
ZoneControl(FAUSTFLOAT* zone) : fZone(zone) {}
virtual ~ZoneControl() {}
- virtual void update(double v) const {}
+ virtual void update(double /*v*/) const {}
- virtual void setMappingValues(int curve, double amin, double amid, double amax,
- double min, double init, double max)
+ virtual void setMappingValues(int /*curve*/, double /*amin*/, double /*amid*/, double /*amax*/,
+ double /*min*/, double /*init*/, double /*max*/)
{
}
- virtual void getMappingValues(double& amin, double& amid, double& amax) {}
+ virtual void getMappingValues(double& /*amin*/, double& /*amid*/, double& /*amax*/) {}
FAUSTFLOAT* getZone() { return fZone; }
- virtual void setActive(bool on_off) {}
+ virtual void setActive(bool /*on_off*/) {}
virtual bool getActive() { return false; }
virtual int getCurve() { return -1; }
@@ -938,7 +1224,7 @@ class ZoneControl
//--------------------------------------------------------------------------------------
// Useful to implement accelerometers metadata as a list of ZoneControl for each axes
//--------------------------------------------------------------------------------------
-class ConverterZoneControl : public ZoneControl
+class FAUST_API ConverterZoneControl : public ZoneControl
{
protected:
ValueConverter* fValueConverter;
@@ -953,7 +1239,10 @@ class ConverterZoneControl : public ZoneControl
delete fValueConverter;
} // Assuming fValueConverter is not kept elsewhere...
- virtual void update(double v) const { *fZone = fValueConverter->ui2faust(v); }
+ virtual void update(double v) const
+ {
+ *fZone = FAUSTFLOAT(fValueConverter->ui2faust(v));
+ }
ValueConverter* getConverter() { return fValueConverter; }
};
@@ -962,7 +1251,7 @@ class ConverterZoneControl : public ZoneControl
// Association of a zone and a four value converter, each one for each possible curve.
// Useful to implement accelerometers metadata as a list of ZoneControl for each axes
//--------------------------------------------------------------------------------------
-class CurveZoneControl : public ZoneControl
+class FAUST_API CurveZoneControl : public ZoneControl
{
private:
std::vector<UpdatableValueConverter*> fValueConverters;
@@ -985,15 +1274,14 @@ class CurveZoneControl : public ZoneControl
}
virtual ~CurveZoneControl()
{
- std::vector<UpdatableValueConverter*>::iterator it;
- for (it = fValueConverters.begin(); it != fValueConverters.end(); it++) {
- delete (*it);
+ for (const auto& it : fValueConverters) {
+ delete it;
}
}
void update(double v) const
{
if (fValueConverters[fCurve]->getActive())
- *fZone = fValueConverters[fCurve]->ui2faust(v);
+ *fZone = FAUSTFLOAT(fValueConverters[fCurve]->ui2faust(v));
}
void setMappingValues(int curve, double amin, double amid, double amax, double min,
@@ -1010,16 +1298,15 @@ class CurveZoneControl : public ZoneControl
void setActive(bool on_off)
{
- std::vector<UpdatableValueConverter*>::iterator it;
- for (it = fValueConverters.begin(); it != fValueConverters.end(); it++) {
- (*it)->setActive(on_off);
+ for (const auto& it : fValueConverters) {
+ it->setActive(on_off);
}
}
int getCurve() { return fCurve; }
};
-class ZoneReader
+class FAUST_API ZoneReader
{
private:
FAUSTFLOAT* fZone;
@@ -1039,6 +1326,8 @@ class ZoneReader
#endif
/************************** END ValueConverter.h **************************/
+typedef unsigned int uint;
+
class APIUI
: public PathBuilder
, public Meta
@@ -1054,22 +1343,42 @@ class APIUI
kHBargraph,
kVBargraph
};
+ enum Type { kAcc = 0, kGyr = 1, kNoType };
protected:
- enum { kLin = 0, kLog = 1, kExp = 2 };
-
- int fNumParameters;
- std::vector<std::string> fPaths;
- std::vector<std::string> fLabels;
- std::map<std::string, int> fPathMap;
- std::map<std::string, int> fLabelMap;
- std::vector<ValueConverter*> fConversion;
- std::vector<FAUSTFLOAT*> fZone;
- std::vector<FAUSTFLOAT> fInit;
- std::vector<FAUSTFLOAT> fMin;
- std::vector<FAUSTFLOAT> fMax;
- std::vector<FAUSTFLOAT> fStep;
- std::vector<ItemType> fItemType;
+ enum Mapping { kLin = 0, kLog = 1, kExp = 2 };
+
+ struct Item {
+ std::string fLabel;
+ std::string fShortname;
+ std::string fPath;
+ ValueConverter* fConversion;
+ FAUSTFLOAT* fZone;
+ FAUSTFLOAT fInit;
+ FAUSTFLOAT fMin;
+ FAUSTFLOAT fMax;
+ FAUSTFLOAT fStep;
+ ItemType fItemType;
+
+ Item(const std::string& label, const std::string& short_name,
+ const std::string& path, ValueConverter* conversion, FAUSTFLOAT* zone,
+ FAUSTFLOAT init, FAUSTFLOAT min, FAUSTFLOAT max, FAUSTFLOAT step,
+ ItemType item_type)
+ : fLabel(label)
+ , fShortname(short_name)
+ , fPath(path)
+ , fConversion(conversion)
+ , fZone(zone)
+ , fInit(init)
+ , fMin(min)
+ , fMax(max)
+ , fStep(step)
+ , fItemType(item_type)
+ {
+ }
+ };
+ std::vector<Item> fItems;
+
std::vector<std::map<std::string, std::string> > fMetaData;
std::vector<ZoneControl*> fAcc[3];
std::vector<ZoneControl*> fGyr[3];
@@ -1096,33 +1405,31 @@ class APIUI
ItemType type)
{
std::string path = buildPath(label);
- fPathMap[path] = fLabelMap[label] = fNumParameters++;
- fPaths.push_back(path);
- fLabels.push_back(label);
- fZone.push_back(zone);
- fInit.push_back(init);
- fMin.push_back(min);
- fMax.push_back(max);
- fStep.push_back(step);
- fItemType.push_back(type);
+ fFullPaths.push_back(path);
// handle scale metadata
+ ValueConverter* converter = nullptr;
switch (fCurrentScale) {
case kLin:
- fConversion.push_back(new LinearValueConverter(0, 1, min, max));
+ converter = new LinearValueConverter(0, 1, min, max);
break;
case kLog:
- fConversion.push_back(new LogValueConverter(0, 1, min, max));
+ converter = new LogValueConverter(0, 1, min, max);
break;
case kExp:
- fConversion.push_back(new ExpValueConverter(0, 1, min, max));
+ converter = new ExpValueConverter(0, 1, min, max);
break;
}
fCurrentScale = kLin;
+ fItems.push_back(
+ Item(label, "", path, converter, zone, init, min, max, step, type));
+
if (fCurrentAcc.size() > 0 && fCurrentGyr.size() > 0) {
- std::cerr << "warning : 'acc' and 'gyr' metadata used for the same " << label
- << " parameter !!\n";
+ fprintf(
+ stderr,
+ "warning : 'acc' and 'gyr' metadata used for the same %s parameter !!\n",
+ label);
}
// handle acc metadata "...[acc : <axe> <curve> <amin> <amid> <amax>]..."
@@ -1137,7 +1444,7 @@ class APIUI
fAcc[axe].push_back(
new CurveZoneControl(zone, curve, amin, amid, amax, min, init, max));
} else {
- std::cerr << "incorrect acc metadata : " << fCurrentAcc << std::endl;
+ fprintf(stderr, "incorrect acc metadata : %s \n", fCurrentAcc.c_str());
}
fCurrentAcc = "";
}
@@ -1154,31 +1461,31 @@ class APIUI
fGyr[axe].push_back(
new CurveZoneControl(zone, curve, amin, amid, amax, min, init, max));
} else {
- std::cerr << "incorrect gyr metadata : " << fCurrentGyr << std::endl;
+ fprintf(stderr, "incorrect gyr metadata : %s \n", fCurrentGyr.c_str());
}
fCurrentGyr = "";
}
// handle screencolor metadata "...[screencolor:red|green|blue|white]..."
if (fCurrentColor.size() > 0) {
- if ((fCurrentColor == "red") && (fRedReader == 0)) {
+ if ((fCurrentColor == "red") && (fRedReader == nullptr)) {
fRedReader = new ZoneReader(zone, min, max);
fHasScreenControl = true;
- } else if ((fCurrentColor == "green") && (fGreenReader == 0)) {
+ } else if ((fCurrentColor == "green") && (fGreenReader == nullptr)) {
fGreenReader = new ZoneReader(zone, min, max);
fHasScreenControl = true;
- } else if ((fCurrentColor == "blue") && (fBlueReader == 0)) {
+ } else if ((fCurrentColor == "blue") && (fBlueReader == nullptr)) {
fBlueReader = new ZoneReader(zone, min, max);
fHasScreenControl = true;
- } else if ((fCurrentColor == "white") && (fRedReader == 0)
- && (fGreenReader == 0) && (fBlueReader == 0)) {
+ } else if ((fCurrentColor == "white") && (fRedReader == nullptr)
+ && (fGreenReader == nullptr) && (fBlueReader == nullptr)) {
fRedReader = new ZoneReader(zone, min, max);
fGreenReader = new ZoneReader(zone, min, max);
fBlueReader = new ZoneReader(zone, min, max);
fHasScreenControl = true;
} else {
- std::cerr << "incorrect screencolor metadata : " << fCurrentColor
- << std::endl;
+ fprintf(stderr, "incorrect screencolor metadata : %s \n",
+ fCurrentColor.c_str());
}
}
fCurrentColor = "";
@@ -1189,7 +1496,7 @@ class APIUI
int getZoneIndex(std::vector<ZoneControl*>* table, int p, int val)
{
- FAUSTFLOAT* zone = fZone[p];
+ FAUSTFLOAT* zone = fItems[uint(p)].fZone;
for (size_t i = 0; i < table[val].size(); i++) {
if (zone == table[val][i]->getZone())
return int(i);
@@ -1206,11 +1513,11 @@ class APIUI
// Deactivates everywhere..
if (id1 != -1)
- table[0][id1]->setActive(false);
+ table[0][uint(id1)]->setActive(false);
if (id2 != -1)
- table[1][id2]->setActive(false);
+ table[1][uint(id2)]->setActive(false);
if (id3 != -1)
- table[2][id3]->setActive(false);
+ table[2][uint(id3)]->setActive(false);
if (val == -1) { // Means: no more mapping...
// So stay all deactivated...
@@ -1218,14 +1525,16 @@ class APIUI
int id4 = getZoneIndex(table, p, val);
if (id4 != -1) {
// Reactivate the one we edit...
- table[val][id4]->setMappingValues(curve, amin, amid, amax, fMin[p],
- fInit[p], fMax[p]);
- table[val][id4]->setActive(true);
+ table[val][uint(id4)]->setMappingValues(
+ curve, amin, amid, amax, fItems[uint(p)].fMin, fItems[uint(p)].fInit,
+ fItems[uint(p)].fMax);
+ table[val][uint(id4)]->setActive(true);
} else {
// Allocate a new CurveZoneControl which is 'active' by default
- FAUSTFLOAT* zone = fZone[p];
- table[val].push_back(new CurveZoneControl(zone, curve, amin, amid, amax,
- fMin[p], fInit[p], fMax[p]));
+ FAUSTFLOAT* zone = fItems[uint(p)].fZone;
+ table[val].push_back(new CurveZoneControl(
+ zone, curve, amin, amid, amax, fItems[uint(p)].fMin,
+ fItems[uint(p)].fInit, fItems[uint(p)].fMax));
}
}
}
@@ -1239,16 +1548,16 @@ class APIUI
if (id1 != -1) {
val = 0;
- curve = table[val][id1]->getCurve();
- table[val][id1]->getMappingValues(amin, amid, amax);
+ curve = table[val][uint(id1)]->getCurve();
+ table[val][uint(id1)]->getMappingValues(amin, amid, amax);
} else if (id2 != -1) {
val = 1;
- curve = table[val][id2]->getCurve();
- table[val][id2]->getMappingValues(amin, amid, amax);
+ curve = table[val][uint(id2)]->getCurve();
+ table[val][uint(id2)]->getMappingValues(amin, amid, amax);
} else if (id3 != -1) {
val = 2;
- curve = table[val][id3]->getCurve();
- table[val][id3]->getMappingValues(amin, amid, amax);
+ curve = table[val][uint(id3)]->getCurve();
+ table[val][uint(id3)]->getMappingValues(amin, amid, amax);
} else {
val = -1; // No mapping
curve = 0;
@@ -1259,26 +1568,23 @@ class APIUI
}
public:
- enum Type { kAcc = 0, kGyr = 1, kNoType };
-
APIUI()
- : fNumParameters(0)
- , fHasScreenControl(false)
- , fRedReader(0)
- , fGreenReader(0)
- , fBlueReader(0)
+ : fHasScreenControl(false)
+ , fRedReader(nullptr)
+ , fGreenReader(nullptr)
+ , fBlueReader(nullptr)
, fCurrentScale(kLin)
{
}
virtual ~APIUI()
{
- for (auto& it : fConversion)
- delete it;
+ for (const auto& it : fItems)
+ delete it.fConversion;
for (int i = 0; i < 3; i++) {
- for (auto& it : fAcc[i])
+ for (const auto& it : fAcc[i])
delete it;
- for (auto& it : fGyr[i])
+ for (const auto& it : fGyr[i])
delete it;
}
delete fRedReader;
@@ -1291,7 +1597,18 @@ class APIUI
virtual void openTabBox(const char* label) { pushLabel(label); }
virtual void openHorizontalBox(const char* label) { pushLabel(label); }
virtual void openVerticalBox(const char* label) { pushLabel(label); }
- virtual void closeBox() { popLabel(); }
+ virtual void closeBox()
+ {
+ if (popLabel()) {
+ // Shortnames can be computed when all fullnames are known
+ computeShortNames();
+ // Fill 'shortname' field for each item
+ for (const auto& it : fFull2Short) {
+ int index = getParamIndex(it.first.c_str());
+ fItems[index].fShortname = it.second;
+ }
+ }
+ }
// -- active widgets
@@ -1328,25 +1645,25 @@ class APIUI
virtual void addHorizontalBargraph(const char* label, FAUSTFLOAT* zone,
FAUSTFLOAT min, FAUSTFLOAT max)
{
- addParameter(label, zone, min, min, max, (max - min) / 1000.0, kHBargraph);
+ addParameter(label, zone, min, min, max, (max - min) / 1000.0f, kHBargraph);
}
virtual void addVerticalBargraph(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT min,
FAUSTFLOAT max)
{
- addParameter(label, zone, min, min, max, (max - min) / 1000.0, kVBargraph);
+ addParameter(label, zone, min, min, max, (max - min) / 1000.0f, kVBargraph);
}
// -- soundfiles
- virtual void addSoundfile(const char* label, const char* filename,
- Soundfile** sf_zone)
+ virtual void addSoundfile(const char* /*label*/, const char* /*filename*/,
+ Soundfile** /*sf_zone*/)
{
}
// -- metadata declarations
- virtual void declare(FAUSTFLOAT* zone, const char* key, const char* val)
+ virtual void declare(FAUSTFLOAT* /*zone*/, const char* key, const char* val)
{
// Keep metadata
fCurrentMetadata[key] = val;
@@ -1372,29 +1689,31 @@ class APIUI
}
}
- virtual void declare(const char* key, const char* val) {}
+ virtual void declare(const char* /*key*/, const char* /*val*/) {}
//-------------------------------------------------------------------------------
// Simple API part
//-------------------------------------------------------------------------------
- int getParamsCount() { return fNumParameters; }
- int getParamIndex(const char* path)
+ int getParamsCount() { return int(fItems.size()); }
+
+ int getParamIndex(const char* path_aux)
{
- if (fPathMap.find(path) != fPathMap.end()) {
- return fPathMap[path];
- } else if (fLabelMap.find(path) != fLabelMap.end()) {
- return fLabelMap[path];
- } else {
- return -1;
- }
+ std::string path = std::string(path_aux);
+ auto it = find_if(fItems.begin(), fItems.end(), [=](const Item& it) {
+ return (it.fLabel == path) || (it.fShortname == path) || (it.fPath == path);
+ });
+ return (it != fItems.end()) ? int(it - fItems.begin()) : -1;
}
- const char* getParamAddress(int p) { return fPaths[p].c_str(); }
- const char* getParamLabel(int p) { return fLabels[p].c_str(); }
+
+ const char* getParamLabel(int p) { return fItems[uint(p)].fLabel.c_str(); }
+ const char* getParamShortname(int p) { return fItems[uint(p)].fShortname.c_str(); }
+ const char* getParamAddress(int p) { return fItems[uint(p)].fPath.c_str(); }
+
std::map<const char*, const char*> getMetadata(int p)
{
std::map<const char*, const char*> res;
- std::map<std::string, std::string> metadata = fMetaData[p];
- for (auto it : metadata) {
+ std::map<std::string, std::string> metadata = fMetaData[uint(p)];
+ for (const auto& it : metadata) {
res[it.first.c_str()] = it.second.c_str();
}
return res;
@@ -1402,26 +1721,62 @@ class APIUI
const char* getMetadata(int p, const char* key)
{
- return (fMetaData[p].find(key) != fMetaData[p].end()) ? fMetaData[p][key].c_str()
- : "";
+ return (fMetaData[uint(p)].find(key) != fMetaData[uint(p)].end())
+ ? fMetaData[uint(p)][key].c_str()
+ : "";
}
- FAUSTFLOAT getParamMin(int p) { return fMin[p]; }
- FAUSTFLOAT getParamMax(int p) { return fMax[p]; }
- FAUSTFLOAT getParamStep(int p) { return fStep[p]; }
- FAUSTFLOAT getParamInit(int p) { return fInit[p]; }
+ FAUSTFLOAT getParamMin(int p) { return fItems[uint(p)].fMin; }
+ FAUSTFLOAT getParamMax(int p) { return fItems[uint(p)].fMax; }
+ FAUSTFLOAT getParamStep(int p) { return fItems[uint(p)].fStep; }
+ FAUSTFLOAT getParamInit(int p) { return fItems[uint(p)].fInit; }
- FAUSTFLOAT* getParamZone(int p) { return fZone[p]; }
- FAUSTFLOAT getParamValue(int p) { return *fZone[p]; }
- void setParamValue(int p, FAUSTFLOAT v) { *fZone[p] = v; }
+ FAUSTFLOAT* getParamZone(int p) { return fItems[uint(p)].fZone; }
+
+ FAUSTFLOAT getParamValue(int p) { return *fItems[uint(p)].fZone; }
+ FAUSTFLOAT getParamValue(const char* path)
+ {
+ int index = getParamIndex(path);
+ if (index >= 0) {
+ return getParamValue(index);
+ } else {
+ fprintf(stderr, "getParamValue : '%s' not found\n",
+ (path == nullptr ? "NULL" : path));
+ return FAUSTFLOAT(0);
+ }
+ }
+
+ void setParamValue(int p, FAUSTFLOAT v) { *fItems[uint(p)].fZone = v; }
+ void setParamValue(const char* path, FAUSTFLOAT v)
+ {
+ int index = getParamIndex(path);
+ if (index >= 0) {
+ setParamValue(index, v);
+ } else {
+ fprintf(stderr, "setParamValue : '%s' not found\n",
+ (path == nullptr ? "NULL" : path));
+ }
+ }
- double getParamRatio(int p) { return fConversion[p]->faust2ui(*fZone[p]); }
- void setParamRatio(int p, double r) { *fZone[p] = fConversion[p]->ui2faust(r); }
+ double getParamRatio(int p)
+ {
+ return fItems[uint(p)].fConversion->faust2ui(*fItems[uint(p)].fZone);
+ }
+ void setParamRatio(int p, double r)
+ {
+ *fItems[uint(p)].fZone = FAUSTFLOAT(fItems[uint(p)].fConversion->ui2faust(r));
+ }
- double value2ratio(int p, double r) { return fConversion[p]->faust2ui(r); }
- double ratio2value(int p, double r) { return fConversion[p]->ui2faust(r); }
+ double value2ratio(int p, double r)
+ {
+ return fItems[uint(p)].fConversion->faust2ui(r);
+ }
+ double ratio2value(int p, double r)
+ {
+ return fItems[uint(p)].fConversion->ui2faust(r);
+ }
/**
- * Return the control type (kAcc, kGyr, or -1) for a given parameter
+ * Return the control type (kAcc, kGyr, or -1) for a given parameter.
*
* @param p - the UI parameter index
*
@@ -1443,13 +1798,13 @@ class APIUI
/**
* Return the Item type (kButton = 0, kCheckButton, kVSlider, kHSlider, kNumEntry,
- * kHBargraph, kVBargraph) for a given parameter
+ * kHBargraph, kVBargraph) for a given parameter.
*
* @param p - the UI parameter index
*
* @return the Item type
*/
- ItemType getParamItemType(int p) { return fItemType[p]; }
+ ItemType getParamItemType(int p) { return fItems[uint(p)].fItemType; }
/**
* Set a new value coming from an accelerometer, propagate it to all relevant
@@ -1489,7 +1844,7 @@ class APIUI
* given UI parameter.
*
* @param p - the UI parameter index
- * @param acc - 0 for X gyroscope, 1 for Y gyroscope, 2 for Z gyroscope (-1 means "no
+ * @param gyr - 0 for X gyroscope, 1 for Y gyroscope, 2 for Z gyroscope (-1 means "no
* mapping")
* @param curve - between 0 and 3
* @param amin - mapping 'min' point
@@ -1554,7 +1909,7 @@ class APIUI
}
/**
- * Get the number of FAUSTFLOAT* zones controlled with the accelerometer
+ * Get the number of FAUSTFLOAT* zones controlled with the accelerometer.
*
* @param acc - 0 for X accelerometer, 1 for Y accelerometer, 2 for Z accelerometer
* @return the number of zones
@@ -1563,7 +1918,7 @@ class APIUI
int getAccCount(int acc) { return (acc >= 0 && acc < 3) ? int(fAcc[acc].size()) : 0; }
/**
- * Get the number of FAUSTFLOAT* zones controlled with the gyroscope
+ * Get the number of FAUSTFLOAT* zones controlled with the gyroscope.
*
* @param gyr - 0 for X gyroscope, 1 for Y gyroscope, 2 for Z gyroscope
* @param the number of zones
@@ -1600,13 +1955,11 @@ class APIUI
#define FAUSTFLOAT float
#endif
+#include <math.h>
+
#include <algorithm>
#include <cmath>
-
-static float zitarevdsp_faustpower2_f(float value)
-{
- return (value * value);
-}
+#include <cstdint>
#ifndef FAUSTCLASS
#define FAUSTCLASS zitarevdsp
@@ -1617,109 +1970,105 @@ static float zitarevdsp_faustpower2_f(float value)
#define exp10 __exp10
#endif
+#if defined(_WIN32)
+#define RESTRICT __restrict
+#else
+#define RESTRICT __restrict__
+#endif
+
+static float zitarevdsp_faustpower2_f(float value)
+{
+ return value * value;
+}
+
class zitarevdsp : public dsp
{
private:
- int IOTA;
+ int IOTA0;
float fVec0[16384];
float fVec1[16384];
+ int fSampleRate;
+ float fConst1;
FAUSTFLOAT fVslider0;
+ float fConst2;
float fRec0[2];
FAUSTFLOAT fVslider1;
float fRec1[2];
- int fSampleRate;
- float fConst0;
- float fConst1;
+ float fConst3;
FAUSTFLOAT fVslider2;
FAUSTFLOAT fVslider3;
FAUSTFLOAT fVslider4;
FAUSTFLOAT fVslider5;
- float fConst2;
- float fConst3;
+ float fConst5;
FAUSTFLOAT fVslider6;
FAUSTFLOAT fVslider7;
FAUSTFLOAT fVslider8;
- float fConst4;
+ float fConst6;
FAUSTFLOAT fVslider9;
float fRec15[2];
float fRec14[2];
float fVec2[32768];
- float fConst5;
- int iConst6;
- float fConst7;
+ int iConst8;
+ float fConst9;
FAUSTFLOAT fVslider10;
float fVec3[2048];
- int iConst8;
+ int iConst10;
float fRec12[2];
- float fConst9;
- float fConst10;
+ float fConst12;
float fRec19[2];
float fRec18[2];
float fVec4[32768];
- float fConst11;
- int iConst12;
+ int iConst14;
float fVec5[4096];
- int iConst13;
+ int iConst15;
float fRec16[2];
- float fConst14;
- float fConst15;
+ float fConst17;
float fRec23[2];
float fRec22[2];
float fVec6[16384];
- float fConst16;
- int iConst17;
+ int iConst19;
float fVec7[4096];
- int iConst18;
+ int iConst20;
float fRec20[2];
- float fConst19;
- float fConst20;
+ float fConst22;
float fRec27[2];
float fRec26[2];
float fVec8[32768];
- float fConst21;
- int iConst22;
+ int iConst24;
float fVec9[4096];
- int iConst23;
+ int iConst25;
float fRec24[2];
- float fConst24;
- float fConst25;
+ float fConst27;
float fRec31[2];
float fRec30[2];
float fVec10[16384];
- float fConst26;
- int iConst27;
+ int iConst29;
float fVec11[2048];
- int iConst28;
+ int iConst30;
float fRec28[2];
- float fConst29;
- float fConst30;
+ float fConst32;
float fRec35[2];
float fRec34[2];
float fVec12[16384];
- float fConst31;
- int iConst32;
+ int iConst34;
float fVec13[4096];
- int iConst33;
+ int iConst35;
float fRec32[2];
- float fConst34;
- float fConst35;
+ float fConst37;
float fRec39[2];
float fRec38[2];
float fVec14[16384];
- float fConst36;
- int iConst37;
+ int iConst39;
float fVec15[4096];
- int iConst38;
+ int iConst40;
float fRec36[2];
- float fConst39;
- float fConst40;
+ float fConst42;
float fRec43[2];
float fRec42[2];
float fVec16[16384];
- float fConst41;
- int iConst42;
+ int iConst44;
float fVec17[2048];
- int iConst43;
+ int iConst45;
float fRec40[2];
float fRec4[3];
float fRec5[3];
@@ -1738,7 +2087,10 @@ class zitarevdsp : public dsp
void metadata(Meta* m)
{
m->declare("basics.lib/name", "Faust Basic Element Library");
- m->declare("basics.lib/version", "0.1");
+ m->declare("basics.lib/version", "0.8");
+ m->declare("compile_options",
+ "-a faust2header.cpp -lang cpp -i -inpl -cn zitarevdsp -es 1 -mcd 16 "
+ "-single -ftz 0");
m->declare("delays.lib/name", "Faust Delay Library");
m->declare("delays.lib/version", "0.1");
m->declare("filename", "zitarevdsp.dsp");
@@ -1785,127 +2137,87 @@ class zitarevdsp : public dsp
"filters.lib/tf2:copyright",
"Copyright (C) 2003-2019 by Julius O. Smith III <jos@ccrma.stanford.edu>");
m->declare("filters.lib/tf2:license", "MIT-style STK-4.3 license");
+ m->declare("filters.lib/version", "0.3");
m->declare("maths.lib/author", "GRAME");
m->declare("maths.lib/copyright", "GRAME");
m->declare("maths.lib/license", "LGPL with exception");
m->declare("maths.lib/name", "Faust Math Library");
- m->declare("maths.lib/version", "2.3");
+ m->declare("maths.lib/version", "2.5");
m->declare("name", "zitarevdsp");
m->declare("platform.lib/name", "Generic Platform Library");
- m->declare("platform.lib/version", "0.1");
+ m->declare("platform.lib/version", "0.2");
m->declare("reverbs.lib/name", "Faust Reverb Library");
- m->declare("reverbs.lib/version", "0.0");
+ m->declare("reverbs.lib/version", "0.2");
+ m->declare("routes.lib/hadamard:author", "Remy Muller, revised by Romain Michon");
m->declare("routes.lib/name", "Faust Signal Routing Library");
m->declare("routes.lib/version", "0.2");
m->declare("signals.lib/name", "Faust Signal Routing Library");
- m->declare("signals.lib/version", "0.0");
+ m->declare("signals.lib/version", "0.3");
}
virtual int getNumInputs() { return 2; }
virtual int getNumOutputs() { return 2; }
- virtual int getInputRate(int channel)
- {
- int rate;
- switch ((channel)) {
- case 0: {
- rate = 1;
- break;
- }
- case 1: {
- rate = 1;
- break;
- }
- default: {
- rate = -1;
- break;
- }
- }
- return rate;
- }
- virtual int getOutputRate(int channel)
- {
- int rate;
- switch ((channel)) {
- case 0: {
- rate = 1;
- break;
- }
- case 1: {
- rate = 1;
- break;
- }
- default: {
- rate = -1;
- break;
- }
- }
- return rate;
- }
static void classInit(int /*sample_rate*/) {}
virtual void instanceConstants(int sample_rate)
{
fSampleRate = sample_rate;
- fConst0 = std::min<float>(192000.0f, std::max<float>(1.0f, float(fSampleRate)));
- fConst1 = (6.28318548f / fConst0);
- fConst2 = std::floor(((0.219990999f * fConst0) + 0.5f));
- fConst3 = ((0.0f - (6.90775537f * fConst2)) / fConst0);
- fConst4 = (3.14159274f / fConst0);
- fConst5 = std::floor(((0.0191229992f * fConst0) + 0.5f));
- iConst6 =
- int(std::min<float>(16384.0f, std::max<float>(0.0f, (fConst2 - fConst5))));
- fConst7 = (0.00100000005f * fConst0);
- iConst8 = int(std::min<float>(1024.0f, std::max<float>(0.0f, (fConst5 + -1.0f))));
- fConst9 = std::floor(((0.256891012f * fConst0) + 0.5f));
- fConst10 = ((0.0f - (6.90775537f * fConst9)) / fConst0);
- fConst11 = std::floor(((0.0273330007f * fConst0) + 0.5f));
- iConst12 =
- int(std::min<float>(16384.0f, std::max<float>(0.0f, (fConst9 - fConst11))));
- iConst13 =
- int(std::min<float>(2048.0f, std::max<float>(0.0f, (fConst11 + -1.0f))));
- fConst14 = std::floor(((0.192303002f * fConst0) + 0.5f));
- fConst15 = ((0.0f - (6.90775537f * fConst14)) / fConst0);
- fConst16 = std::floor(((0.0292910002f * fConst0) + 0.5f));
- iConst17 =
- int(std::min<float>(8192.0f, std::max<float>(0.0f, (fConst14 - fConst16))));
- iConst18 =
- int(std::min<float>(2048.0f, std::max<float>(0.0f, (fConst16 + -1.0f))));
- fConst19 = std::floor(((0.210389003f * fConst0) + 0.5f));
- fConst20 = ((0.0f - (6.90775537f * fConst19)) / fConst0);
- fConst21 = std::floor(((0.0244210009f * fConst0) + 0.5f));
- iConst22 =
- int(std::min<float>(16384.0f, std::max<float>(0.0f, (fConst19 - fConst21))));
- iConst23 =
- int(std::min<float>(2048.0f, std::max<float>(0.0f, (fConst21 + -1.0f))));
- fConst24 = std::floor(((0.125f * fConst0) + 0.5f));
- fConst25 = ((0.0f - (6.90775537f * fConst24)) / fConst0);
- fConst26 = std::floor(((0.0134579996f * fConst0) + 0.5f));
- iConst27 =
- int(std::min<float>(8192.0f, std::max<float>(0.0f, (fConst24 - fConst26))));
- iConst28 =
- int(std::min<float>(1024.0f, std::max<float>(0.0f, (fConst26 + -1.0f))));
- fConst29 = std::floor(((0.127837002f * fConst0) + 0.5f));
- fConst30 = ((0.0f - (6.90775537f * fConst29)) / fConst0);
- fConst31 = std::floor(((0.0316039994f * fConst0) + 0.5f));
- iConst32 =
- int(std::min<float>(8192.0f, std::max<float>(0.0f, (fConst29 - fConst31))));
- iConst33 =
- int(std::min<float>(2048.0f, std::max<float>(0.0f, (fConst31 + -1.0f))));
- fConst34 = std::floor(((0.174713001f * fConst0) + 0.5f));
- fConst35 = ((0.0f - (6.90775537f * fConst34)) / fConst0);
- fConst36 = std::floor(((0.0229039993f * fConst0) + 0.5f));
- iConst37 =
- int(std::min<float>(8192.0f, std::max<float>(0.0f, (fConst34 - fConst36))));
- iConst38 =
- int(std::min<float>(2048.0f, std::max<float>(0.0f, (fConst36 + -1.0f))));
- fConst39 = std::floor(((0.153128996f * fConst0) + 0.5f));
- fConst40 = ((0.0f - (6.90775537f * fConst39)) / fConst0);
- fConst41 = std::floor(((0.0203460008f * fConst0) + 0.5f));
- iConst42 =
- int(std::min<float>(8192.0f, std::max<float>(0.0f, (fConst39 - fConst41))));
- iConst43 =
- int(std::min<float>(1024.0f, std::max<float>(0.0f, (fConst41 + -1.0f))));
+ float fConst0 =
+ std::min<float>(192000.0f, std::max<float>(1.0f, float(fSampleRate)));
+ fConst1 = 44.0999985f / fConst0;
+ fConst2 = 1.0f - fConst1;
+ fConst3 = 6.28318548f / fConst0;
+ float fConst4 = std::floor(0.219990999f * fConst0 + 0.5f);
+ fConst5 = (0.0f - 6.90775537f * fConst4) / fConst0;
+ fConst6 = 3.14159274f / fConst0;
+ float fConst7 = std::floor(0.0191229992f * fConst0 + 0.5f);
+ iConst8 =
+ int(std::min<float>(16384.0f, std::max<float>(0.0f, fConst4 - fConst7)));
+ fConst9 = 0.00100000005f * fConst0;
+ iConst10 = int(std::min<float>(1024.0f, std::max<float>(0.0f, fConst7 + -1.0f)));
+ float fConst11 = std::floor(0.256891012f * fConst0 + 0.5f);
+ fConst12 = (0.0f - 6.90775537f * fConst11) / fConst0;
+ float fConst13 = std::floor(0.0273330007f * fConst0 + 0.5f);
+ iConst14 =
+ int(std::min<float>(16384.0f, std::max<float>(0.0f, fConst11 - fConst13)));
+ iConst15 = int(std::min<float>(2048.0f, std::max<float>(0.0f, fConst13 + -1.0f)));
+ float fConst16 = std::floor(0.192303002f * fConst0 + 0.5f);
+ fConst17 = (0.0f - 6.90775537f * fConst16) / fConst0;
+ float fConst18 = std::floor(0.0292910002f * fConst0 + 0.5f);
+ iConst19 =
+ int(std::min<float>(8192.0f, std::max<float>(0.0f, fConst16 - fConst18)));
+ iConst20 = int(std::min<float>(2048.0f, std::max<float>(0.0f, fConst18 + -1.0f)));
+ float fConst21 = std::floor(0.210389003f * fConst0 + 0.5f);
+ fConst22 = (0.0f - 6.90775537f * fConst21) / fConst0;
+ float fConst23 = std::floor(0.0244210009f * fConst0 + 0.5f);
+ iConst24 =
+ int(std::min<float>(16384.0f, std::max<float>(0.0f, fConst21 - fConst23)));
+ iConst25 = int(std::min<float>(2048.0f, std::max<float>(0.0f, fConst23 + -1.0f)));
+ float fConst26 = std::floor(0.125f * fConst0 + 0.5f);
+ fConst27 = (0.0f - 6.90775537f * fConst26) / fConst0;
+ float fConst28 = std::floor(0.0134579996f * fConst0 + 0.5f);
+ iConst29 =
+ int(std::min<float>(8192.0f, std::max<float>(0.0f, fConst26 - fConst28)));
+ iConst30 = int(std::min<float>(1024.0f, std::max<float>(0.0f, fConst28 + -1.0f)));
+ float fConst31 = std::floor(0.127837002f * fConst0 + 0.5f);
+ fConst32 = (0.0f - 6.90775537f * fConst31) / fConst0;
+ float fConst33 = std::floor(0.0316039994f * fConst0 + 0.5f);
+ iConst34 =
+ int(std::min<float>(8192.0f, std::max<float>(0.0f, fConst31 - fConst33)));
+ iConst35 = int(std::min<float>(2048.0f, std::max<float>(0.0f, fConst33 + -1.0f)));
+ float fConst36 = std::floor(0.174713001f * fConst0 + 0.5f);
+ fConst37 = (0.0f - 6.90775537f * fConst36) / fConst0;
+ float fConst38 = std::floor(0.0229039993f * fConst0 + 0.5f);
+ iConst39 =
+ int(std::min<float>(8192.0f, std::max<float>(0.0f, fConst36 - fConst38)));
+ iConst40 = int(std::min<float>(2048.0f, std::max<float>(0.0f, fConst38 + -1.0f)));
+ float fConst41 = std::floor(0.153128996f * fConst0 + 0.5f);
+ fConst42 = (0.0f - 6.90775537f * fConst41) / fConst0;
+ float fConst43 = std::floor(0.0203460008f * fConst0 + 0.5f);
+ iConst44 =
+ int(std::min<float>(8192.0f, std::max<float>(0.0f, fConst41 - fConst43)));
+ iConst45 = int(std::min<float>(1024.0f, std::max<float>(0.0f, fConst43 + -1.0f)));
}
virtual void instanceResetUserInterface()
@@ -1925,173 +2237,173 @@ class zitarevdsp : public dsp
virtual void instanceClear()
{
- IOTA = 0;
- for (int l0 = 0; (l0 < 16384); l0 = (l0 + 1)) {
+ IOTA0 = 0;
+ for (int l0 = 0; l0 < 16384; l0 = l0 + 1) {
fVec0[l0] = 0.0f;
}
- for (int l1 = 0; (l1 < 16384); l1 = (l1 + 1)) {
+ for (int l1 = 0; l1 < 16384; l1 = l1 + 1) {
fVec1[l1] = 0.0f;
}
- for (int l2 = 0; (l2 < 2); l2 = (l2 + 1)) {
+ for (int l2 = 0; l2 < 2; l2 = l2 + 1) {
fRec0[l2] = 0.0f;
}
- for (int l3 = 0; (l3 < 2); l3 = (l3 + 1)) {
+ for (int l3 = 0; l3 < 2; l3 = l3 + 1) {
fRec1[l3] = 0.0f;
}
- for (int l4 = 0; (l4 < 2); l4 = (l4 + 1)) {
+ for (int l4 = 0; l4 < 2; l4 = l4 + 1) {
fRec15[l4] = 0.0f;
}
- for (int l5 = 0; (l5 < 2); l5 = (l5 + 1)) {
+ for (int l5 = 0; l5 < 2; l5 = l5 + 1) {
fRec14[l5] = 0.0f;
}
- for (int l6 = 0; (l6 < 32768); l6 = (l6 + 1)) {
+ for (int l6 = 0; l6 < 32768; l6 = l6 + 1) {
fVec2[l6] = 0.0f;
}
- for (int l7 = 0; (l7 < 2048); l7 = (l7 + 1)) {
+ for (int l7 = 0; l7 < 2048; l7 = l7 + 1) {
fVec3[l7] = 0.0f;
}
- for (int l8 = 0; (l8 < 2); l8 = (l8 + 1)) {
+ for (int l8 = 0; l8 < 2; l8 = l8 + 1) {
fRec12[l8] = 0.0f;
}
- for (int l9 = 0; (l9 < 2); l9 = (l9 + 1)) {
+ for (int l9 = 0; l9 < 2; l9 = l9 + 1) {
fRec19[l9] = 0.0f;
}
- for (int l10 = 0; (l10 < 2); l10 = (l10 + 1)) {
+ for (int l10 = 0; l10 < 2; l10 = l10 + 1) {
fRec18[l10] = 0.0f;
}
- for (int l11 = 0; (l11 < 32768); l11 = (l11 + 1)) {
+ for (int l11 = 0; l11 < 32768; l11 = l11 + 1) {
fVec4[l11] = 0.0f;
}
- for (int l12 = 0; (l12 < 4096); l12 = (l12 + 1)) {
+ for (int l12 = 0; l12 < 4096; l12 = l12 + 1) {
fVec5[l12] = 0.0f;
}
- for (int l13 = 0; (l13 < 2); l13 = (l13 + 1)) {
+ for (int l13 = 0; l13 < 2; l13 = l13 + 1) {
fRec16[l13] = 0.0f;
}
- for (int l14 = 0; (l14 < 2); l14 = (l14 + 1)) {
+ for (int l14 = 0; l14 < 2; l14 = l14 + 1) {
fRec23[l14] = 0.0f;
}
- for (int l15 = 0; (l15 < 2); l15 = (l15 + 1)) {
+ for (int l15 = 0; l15 < 2; l15 = l15 + 1) {
fRec22[l15] = 0.0f;
}
- for (int l16 = 0; (l16 < 16384); l16 = (l16 + 1)) {
+ for (int l16 = 0; l16 < 16384; l16 = l16 + 1) {
fVec6[l16] = 0.0f;
}
- for (int l17 = 0; (l17 < 4096); l17 = (l17 + 1)) {
+ for (int l17 = 0; l17 < 4096; l17 = l17 + 1) {
fVec7[l17] = 0.0f;
}
- for (int l18 = 0; (l18 < 2); l18 = (l18 + 1)) {
+ for (int l18 = 0; l18 < 2; l18 = l18 + 1) {
fRec20[l18] = 0.0f;
}
- for (int l19 = 0; (l19 < 2); l19 = (l19 + 1)) {
+ for (int l19 = 0; l19 < 2; l19 = l19 + 1) {
fRec27[l19] = 0.0f;
}
- for (int l20 = 0; (l20 < 2); l20 = (l20 + 1)) {
+ for (int l20 = 0; l20 < 2; l20 = l20 + 1) {
fRec26[l20] = 0.0f;
}
- for (int l21 = 0; (l21 < 32768); l21 = (l21 + 1)) {
+ for (int l21 = 0; l21 < 32768; l21 = l21 + 1) {
fVec8[l21] = 0.0f;
}
- for (int l22 = 0; (l22 < 4096); l22 = (l22 + 1)) {
+ for (int l22 = 0; l22 < 4096; l22 = l22 + 1) {
fVec9[l22] = 0.0f;
}
- for (int l23 = 0; (l23 < 2); l23 = (l23 + 1)) {
+ for (int l23 = 0; l23 < 2; l23 = l23 + 1) {
fRec24[l23] = 0.0f;
}
- for (int l24 = 0; (l24 < 2); l24 = (l24 + 1)) {
+ for (int l24 = 0; l24 < 2; l24 = l24 + 1) {
fRec31[l24] = 0.0f;
}
- for (int l25 = 0; (l25 < 2); l25 = (l25 + 1)) {
+ for (int l25 = 0; l25 < 2; l25 = l25 + 1) {
fRec30[l25] = 0.0f;
}
- for (int l26 = 0; (l26 < 16384); l26 = (l26 + 1)) {
+ for (int l26 = 0; l26 < 16384; l26 = l26 + 1) {
fVec10[l26] = 0.0f;
}
- for (int l27 = 0; (l27 < 2048); l27 = (l27 + 1)) {
+ for (int l27 = 0; l27 < 2048; l27 = l27 + 1) {
fVec11[l27] = 0.0f;
}
- for (int l28 = 0; (l28 < 2); l28 = (l28 + 1)) {
+ for (int l28 = 0; l28 < 2; l28 = l28 + 1) {
fRec28[l28] = 0.0f;
}
- for (int l29 = 0; (l29 < 2); l29 = (l29 + 1)) {
+ for (int l29 = 0; l29 < 2; l29 = l29 + 1) {
fRec35[l29] = 0.0f;
}
- for (int l30 = 0; (l30 < 2); l30 = (l30 + 1)) {
+ for (int l30 = 0; l30 < 2; l30 = l30 + 1) {
fRec34[l30] = 0.0f;
}
- for (int l31 = 0; (l31 < 16384); l31 = (l31 + 1)) {
+ for (int l31 = 0; l31 < 16384; l31 = l31 + 1) {
fVec12[l31] = 0.0f;
}
- for (int l32 = 0; (l32 < 4096); l32 = (l32 + 1)) {
+ for (int l32 = 0; l32 < 4096; l32 = l32 + 1) {
fVec13[l32] = 0.0f;
}
- for (int l33 = 0; (l33 < 2); l33 = (l33 + 1)) {
+ for (int l33 = 0; l33 < 2; l33 = l33 + 1) {
fRec32[l33] = 0.0f;
}
- for (int l34 = 0; (l34 < 2); l34 = (l34 + 1)) {
+ for (int l34 = 0; l34 < 2; l34 = l34 + 1) {
fRec39[l34] = 0.0f;
}
- for (int l35 = 0; (l35 < 2); l35 = (l35 + 1)) {
+ for (int l35 = 0; l35 < 2; l35 = l35 + 1) {
fRec38[l35] = 0.0f;
}
- for (int l36 = 0; (l36 < 16384); l36 = (l36 + 1)) {
+ for (int l36 = 0; l36 < 16384; l36 = l36 + 1) {
fVec14[l36] = 0.0f;
}
- for (int l37 = 0; (l37 < 4096); l37 = (l37 + 1)) {
+ for (int l37 = 0; l37 < 4096; l37 = l37 + 1) {
fVec15[l37] = 0.0f;
}
- for (int l38 = 0; (l38 < 2); l38 = (l38 + 1)) {
+ for (int l38 = 0; l38 < 2; l38 = l38 + 1) {
fRec36[l38] = 0.0f;
}
- for (int l39 = 0; (l39 < 2); l39 = (l39 + 1)) {
+ for (int l39 = 0; l39 < 2; l39 = l39 + 1) {
fRec43[l39] = 0.0f;
}
- for (int l40 = 0; (l40 < 2); l40 = (l40 + 1)) {
+ for (int l40 = 0; l40 < 2; l40 = l40 + 1) {
fRec42[l40] = 0.0f;
}
- for (int l41 = 0; (l41 < 16384); l41 = (l41 + 1)) {
+ for (int l41 = 0; l41 < 16384; l41 = l41 + 1) {
fVec16[l41] = 0.0f;
}
- for (int l42 = 0; (l42 < 2048); l42 = (l42 + 1)) {
+ for (int l42 = 0; l42 < 2048; l42 = l42 + 1) {
fVec17[l42] = 0.0f;
}
- for (int l43 = 0; (l43 < 2); l43 = (l43 + 1)) {
+ for (int l43 = 0; l43 < 2; l43 = l43 + 1) {
fRec40[l43] = 0.0f;
}
- for (int l44 = 0; (l44 < 3); l44 = (l44 + 1)) {
+ for (int l44 = 0; l44 < 3; l44 = l44 + 1) {
fRec4[l44] = 0.0f;
}
- for (int l45 = 0; (l45 < 3); l45 = (l45 + 1)) {
+ for (int l45 = 0; l45 < 3; l45 = l45 + 1) {
fRec5[l45] = 0.0f;
}
- for (int l46 = 0; (l46 < 3); l46 = (l46 + 1)) {
+ for (int l46 = 0; l46 < 3; l46 = l46 + 1) {
fRec6[l46] = 0.0f;
}
- for (int l47 = 0; (l47 < 3); l47 = (l47 + 1)) {
+ for (int l47 = 0; l47 < 3; l47 = l47 + 1) {
fRec7[l47] = 0.0f;
}
- for (int l48 = 0; (l48 < 3); l48 = (l48 + 1)) {
+ for (int l48 = 0; l48 < 3; l48 = l48 + 1) {
fRec8[l48] = 0.0f;
}
- for (int l49 = 0; (l49 < 3); l49 = (l49 + 1)) {
+ for (int l49 = 0; l49 < 3; l49 = l49 + 1) {
fRec9[l49] = 0.0f;
}
- for (int l50 = 0; (l50 < 3); l50 = (l50 + 1)) {
+ for (int l50 = 0; l50 < 3; l50 = l50 + 1) {
fRec10[l50] = 0.0f;
}
- for (int l51 = 0; (l51 < 3); l51 = (l51 + 1)) {
+ for (int l51 = 0; l51 < 3; l51 = l51 + 1) {
fRec11[l51] = 0.0f;
}
- for (int l52 = 0; (l52 < 3); l52 = (l52 + 1)) {
+ for (int l52 = 0; l52 < 3; l52 = l52 + 1) {
fRec3[l52] = 0.0f;
}
- for (int l53 = 0; (l53 < 3); l53 = (l53 + 1)) {
+ for (int l53 = 0; l53 < 3; l53 = l53 + 1) {
fRec2[l53] = 0.0f;
}
- for (int l54 = 0; (l54 < 3); l54 = (l54 + 1)) {
+ for (int l54 = 0; l54 < 3; l54 = l54 + 1) {
fRec45[l54] = 0.0f;
}
- for (int l55 = 0; (l55 < 3); l55 = (l55 + 1)) {
+ for (int l55 = 0; l55 < 3; l55 = l55 + 1) {
fRec44[l55] = 0.0f;
}
}
@@ -2127,8 +2439,9 @@ class zitarevdsp : public dsp
ui_interface->declare(&fVslider10, "tooltip",
"Delay in ms before reverberation begins");
ui_interface->declare(&fVslider10, "unit", "ms");
- ui_interface->addVerticalSlider("In Delay", &fVslider10, 60.0f, 20.0f, 100.0f,
- 1.0f);
+ ui_interface->addVerticalSlider("In Delay", &fVslider10, FAUSTFLOAT(60.0f),
+ FAUSTFLOAT(20.0f), FAUSTFLOAT(100.0f),
+ FAUSTFLOAT(1.0f));
ui_interface->closeBox();
ui_interface->declare(0, "2", "");
ui_interface->openHorizontalBox("Decay Times in Bands (see tooltips)");
@@ -2139,7 +2452,9 @@ class zitarevdsp : public dsp
&fVslider9, "tooltip",
"Crossover frequency (Hz) separating low and middle frequencies");
ui_interface->declare(&fVslider9, "unit", "Hz");
- ui_interface->addVerticalSlider("LF X", &fVslider9, 200.0f, 50.0f, 1000.0f, 1.0f);
+ ui_interface->addVerticalSlider("LF X", &fVslider9, FAUSTFLOAT(200.0f),
+ FAUSTFLOAT(50.0f), FAUSTFLOAT(1000.0f),
+ FAUSTFLOAT(1.0f));
ui_interface->declare(&fVslider8, "2", "");
ui_interface->declare(&fVslider8, "scale", "log");
ui_interface->declare(&fVslider8, "style", "knob");
@@ -2147,16 +2462,18 @@ class zitarevdsp : public dsp
&fVslider8, "tooltip",
"T60 = time (in seconds) to decay 60dB in low-frequency band");
ui_interface->declare(&fVslider8, "unit", "s");
- ui_interface->addVerticalSlider("Low RT60", &fVslider8, 3.0f, 1.0f, 8.0f,
- 0.100000001f);
+ ui_interface->addVerticalSlider("Low RT60", &fVslider8, FAUSTFLOAT(3.0f),
+ FAUSTFLOAT(1.0f), FAUSTFLOAT(8.0f),
+ FAUSTFLOAT(0.100000001f));
ui_interface->declare(&fVslider6, "3", "");
ui_interface->declare(&fVslider6, "scale", "log");
ui_interface->declare(&fVslider6, "style", "knob");
ui_interface->declare(&fVslider6, "tooltip",
"T60 = time (in seconds) to decay 60dB in middle band");
ui_interface->declare(&fVslider6, "unit", "s");
- ui_interface->addVerticalSlider("Mid RT60", &fVslider6, 2.0f, 1.0f, 8.0f,
- 0.100000001f);
+ ui_interface->addVerticalSlider("Mid RT60", &fVslider6, FAUSTFLOAT(2.0f),
+ FAUSTFLOAT(1.0f), FAUSTFLOAT(8.0f),
+ FAUSTFLOAT(0.100000001f));
ui_interface->declare(&fVslider7, "4", "");
ui_interface->declare(&fVslider7, "scale", "log");
ui_interface->declare(&fVslider7, "style", "knob");
@@ -2164,8 +2481,9 @@ class zitarevdsp : public dsp
"Frequency (Hz) at which the high-frequency T60 is half "
"the middle-band's T60");
ui_interface->declare(&fVslider7, "unit", "Hz");
- ui_interface->addVerticalSlider("HF Damping", &fVslider7, 6000.0f, 1500.0f,
- 23520.0f, 1.0f);
+ ui_interface->addVerticalSlider("HF Damping", &fVslider7, FAUSTFLOAT(6000.0f),
+ FAUSTFLOAT(1500.0f), FAUSTFLOAT(23520.0f),
+ FAUSTFLOAT(1.0f));
ui_interface->closeBox();
ui_interface->declare(0, "3", "");
ui_interface->openHorizontalBox("RM Peaking Equalizer 1");
@@ -2176,16 +2494,18 @@ class zitarevdsp : public dsp
&fVslider4, "tooltip",
"Center-frequency of second-order Regalia-Mitra peaking equalizer section 1");
ui_interface->declare(&fVslider4, "unit", "Hz");
- ui_interface->addVerticalSlider("Eq1 Freq", &fVslider4, 315.0f, 40.0f, 2500.0f,
- 1.0f);
+ ui_interface->addVerticalSlider("Eq1 Freq", &fVslider4, FAUSTFLOAT(315.0f),
+ FAUSTFLOAT(40.0f), FAUSTFLOAT(2500.0f),
+ FAUSTFLOAT(1.0f));
ui_interface->declare(&fVslider5, "2", "");
ui_interface->declare(&fVslider5, "style", "knob");
ui_interface->declare(&fVslider5, "tooltip",
"Peak level in dB of second-order Regalia-Mitra peaking "
"equalizer section 1");
ui_interface->declare(&fVslider5, "unit", "dB");
- ui_interface->addVerticalSlider("Eq1 Level", &fVslider5, 0.0f, -15.0f, 15.0f,
- 0.100000001f);
+ ui_interface->addVerticalSlider("Eq1 Level", &fVslider5, FAUSTFLOAT(0.0f),
+ FAUSTFLOAT(-15.0f), FAUSTFLOAT(15.0f),
+ FAUSTFLOAT(0.100000001f));
ui_interface->closeBox();
ui_interface->declare(0, "4", "");
ui_interface->openHorizontalBox("RM Peaking Equalizer 2");
@@ -2196,30 +2516,34 @@ class zitarevdsp : public dsp
&fVslider2, "tooltip",
"Center-frequency of second-order Regalia-Mitra peaking equalizer section 2");
ui_interface->declare(&fVslider2, "unit", "Hz");
- ui_interface->addVerticalSlider("Eq2 Freq", &fVslider2, 1500.0f, 160.0f, 10000.0f,
- 1.0f);
+ ui_interface->addVerticalSlider("Eq2 Freq", &fVslider2, FAUSTFLOAT(1500.0f),
+ FAUSTFLOAT(160.0f), FAUSTFLOAT(10000.0f),
+ FAUSTFLOAT(1.0f));
ui_interface->declare(&fVslider3, "2", "");
ui_interface->declare(&fVslider3, "style", "knob");
ui_interface->declare(&fVslider3, "tooltip",
"Peak level in dB of second-order Regalia-Mitra peaking "
"equalizer section 2");
ui_interface->declare(&fVslider3, "unit", "dB");
- ui_interface->addVerticalSlider("Eq2 Level", &fVslider3, 0.0f, -15.0f, 15.0f,
- 0.100000001f);
+ ui_interface->addVerticalSlider("Eq2 Level", &fVslider3, FAUSTFLOAT(0.0f),
+ FAUSTFLOAT(-15.0f), FAUSTFLOAT(15.0f),
+ FAUSTFLOAT(0.100000001f));
ui_interface->closeBox();
ui_interface->declare(0, "5", "");
ui_interface->openHorizontalBox("Output");
ui_interface->declare(&fVslider1, "1", "");
ui_interface->declare(&fVslider1, "style", "knob");
ui_interface->declare(&fVslider1, "tooltip", "Dry/Wet Mix: 0 = dry, 1 = wet");
- ui_interface->addVerticalSlider("Wet", &fVslider1, 0.0f, 0.0f, 1.0f,
- 0.00999999978f);
+ ui_interface->addVerticalSlider("Wet", &fVslider1, FAUSTFLOAT(0.0f),
+ FAUSTFLOAT(0.0f), FAUSTFLOAT(1.0f),
+ FAUSTFLOAT(0.00999999978f));
ui_interface->declare(&fVslider0, "2", "");
ui_interface->declare(&fVslider0, "style", "knob");
ui_interface->declare(&fVslider0, "tooltip", "Output scale factor");
ui_interface->declare(&fVslider0, "unit", "dB");
- ui_interface->addVerticalSlider("Level", &fVslider0, -3.0f, -70.0f, 20.0f,
- 0.100000001f);
+ ui_interface->addVerticalSlider("Level", &fVslider0, FAUSTFLOAT(-3.0f),
+ FAUSTFLOAT(-70.0f), FAUSTFLOAT(20.0f),
+ FAUSTFLOAT(0.100000001f));
ui_interface->closeBox();
ui_interface->closeBox();
}
@@ -2230,312 +2554,247 @@ class zitarevdsp : public dsp
FAUSTFLOAT* input1 = inputs[1];
FAUSTFLOAT* output0 = outputs[0];
FAUSTFLOAT* output1 = outputs[1];
- float fSlow0 =
- (0.00100000005f * std::pow(10.0f, (0.0500000007f * float(fVslider0))));
- float fSlow1 = (0.00100000005f * float(fVslider1));
- float fSlow2 = float(fVslider2);
- float fSlow3 = std::pow(10.0f, (0.0500000007f * float(fVslider3)));
- float fSlow4 = (fConst1 * (fSlow2 / std::sqrt(std::max<float>(0.0f, fSlow3))));
- float fSlow5 = ((1.0f - fSlow4) / (fSlow4 + 1.0f));
- float fSlow6 = float(fVslider4);
- float fSlow7 = std::pow(10.0f, (0.0500000007f * float(fVslider5)));
- float fSlow8 = (fConst1 * (fSlow6 / std::sqrt(std::max<float>(0.0f, fSlow7))));
- float fSlow9 = ((1.0f - fSlow8) / (fSlow8 + 1.0f));
- float fSlow10 = float(fVslider6);
- float fSlow11 = std::exp((fConst3 / fSlow10));
- float fSlow12 = zitarevdsp_faustpower2_f(fSlow11);
- float fSlow13 = std::cos((fConst1 * float(fVslider7)));
- float fSlow14 = (1.0f - (fSlow12 * fSlow13));
- float fSlow15 = (1.0f - fSlow12);
- float fSlow16 = (fSlow14 / fSlow15);
- float fSlow17 = std::sqrt(std::max<float>(
- 0.0f, ((zitarevdsp_faustpower2_f(fSlow14) / zitarevdsp_faustpower2_f(fSlow15))
- + -1.0f)));
- float fSlow18 = (fSlow16 - fSlow17);
- float fSlow19 = (fSlow11 * (fSlow17 + (1.0f - fSlow16)));
- float fSlow20 = float(fVslider8);
- float fSlow21 = ((std::exp((fConst3 / fSlow20)) / fSlow11) + -1.0f);
- float fSlow22 = (1.0f / std::tan((fConst4 * float(fVslider9))));
- float fSlow23 = (1.0f / (fSlow22 + 1.0f));
- float fSlow24 = (1.0f - fSlow22);
- int iSlow25 = int(std::min<float>(
- 8192.0f, std::max<float>(0.0f, (fConst7 * float(fVslider10)))));
- float fSlow26 = std::exp((fConst10 / fSlow10));
+ float fSlow0 = fConst1 * std::pow(10.0f, 0.0500000007f * float(fVslider0));
+ float fSlow1 = fConst1 * float(fVslider1);
+ float fSlow2 = float(fVslider2);
+ float fSlow3 = std::pow(10.0f, 0.0500000007f * float(fVslider3));
+ float fSlow4 = fConst3 * fSlow2 / std::sqrt(std::max<float>(0.0f, fSlow3));
+ float fSlow5 = (1.0f - fSlow4) / (fSlow4 + 1.0f);
+ float fSlow6 = float(fVslider4);
+ float fSlow7 = std::pow(10.0f, 0.0500000007f * float(fVslider5));
+ float fSlow8 = fConst3 * fSlow6 / std::sqrt(std::max<float>(0.0f, fSlow7));
+ float fSlow9 = (1.0f - fSlow8) / (fSlow8 + 1.0f);
+ float fSlow10 = float(fVslider6);
+ float fSlow11 = std::exp(fConst5 / fSlow10);
+ float fSlow12 = zitarevdsp_faustpower2_f(fSlow11);
+ float fSlow13 = std::cos(fConst3 * float(fVslider7));
+ float fSlow14 = 1.0f - fSlow12 * fSlow13;
+ float fSlow15 = 1.0f - fSlow12;
+ float fSlow16 = std::sqrt(std::max<float>(
+ 0.0f, zitarevdsp_faustpower2_f(fSlow14) / zitarevdsp_faustpower2_f(fSlow15)
+ + -1.0f));
+ float fSlow17 = fSlow14 / fSlow15;
+ float fSlow18 = fSlow11 * (fSlow16 + 1.0f - fSlow17);
+ float fSlow19 = float(fVslider8);
+ float fSlow20 = std::exp(fConst5 / fSlow19) / fSlow11 + -1.0f;
+ float fSlow21 = 1.0f / std::tan(fConst6 * float(fVslider9));
+ float fSlow22 = 1.0f / (fSlow21 + 1.0f);
+ float fSlow23 = 1.0f - fSlow21;
+ float fSlow24 = fSlow17 - fSlow16;
+ int iSlow25 = int(
+ std::min<float>(8192.0f, std::max<float>(0.0f, fConst9 * float(fVslider10))));
+ float fSlow26 = std::exp(fConst12 / fSlow10);
float fSlow27 = zitarevdsp_faustpower2_f(fSlow26);
- float fSlow28 = (1.0f - (fSlow27 * fSlow13));
- float fSlow29 = (1.0f - fSlow27);
- float fSlow30 = (fSlow28 / fSlow29);
- float fSlow31 = std::sqrt(std::max<float>(
- 0.0f, ((zitarevdsp_faustpower2_f(fSlow28) / zitarevdsp_faustpower2_f(fSlow29))
- + -1.0f)));
- float fSlow32 = (fSlow30 - fSlow31);
- float fSlow33 = (fSlow26 * (fSlow31 + (1.0f - fSlow30)));
- float fSlow34 = ((std::exp((fConst10 / fSlow20)) / fSlow26) + -1.0f);
- float fSlow35 = std::exp((fConst15 / fSlow10));
+ float fSlow28 = 1.0f - fSlow27 * fSlow13;
+ float fSlow29 = 1.0f - fSlow27;
+ float fSlow30 = std::sqrt(std::max<float>(
+ 0.0f, zitarevdsp_faustpower2_f(fSlow28) / zitarevdsp_faustpower2_f(fSlow29)
+ + -1.0f));
+ float fSlow31 = fSlow28 / fSlow29;
+ float fSlow32 = fSlow26 * (fSlow30 + 1.0f - fSlow31);
+ float fSlow33 = std::exp(fConst12 / fSlow19) / fSlow26 + -1.0f;
+ float fSlow34 = fSlow31 - fSlow30;
+ float fSlow35 = std::exp(fConst17 / fSlow10);
float fSlow36 = zitarevdsp_faustpower2_f(fSlow35);
- float fSlow37 = (1.0f - (fSlow36 * fSlow13));
- float fSlow38 = (1.0f - fSlow36);
- float fSlow39 = (fSlow37 / fSlow38);
- float fSlow40 = std::sqrt(std::max<float>(
- 0.0f, ((zitarevdsp_faustpower2_f(fSlow37) / zitarevdsp_faustpower2_f(fSlow38))
- + -1.0f)));
- float fSlow41 = (fSlow39 - fSlow40);
- float fSlow42 = (fSlow35 * (fSlow40 + (1.0f - fSlow39)));
- float fSlow43 = ((std::exp((fConst15 / fSlow20)) / fSlow35) + -1.0f);
- float fSlow44 = std::exp((fConst20 / fSlow10));
+ float fSlow37 = 1.0f - fSlow36 * fSlow13;
+ float fSlow38 = 1.0f - fSlow36;
+ float fSlow39 = std::sqrt(std::max<float>(
+ 0.0f, zitarevdsp_faustpower2_f(fSlow37) / zitarevdsp_faustpower2_f(fSlow38)
+ + -1.0f));
+ float fSlow40 = fSlow37 / fSlow38;
+ float fSlow41 = fSlow35 * (fSlow39 + 1.0f - fSlow40);
+ float fSlow42 = std::exp(fConst17 / fSlow19) / fSlow35 + -1.0f;
+ float fSlow43 = fSlow40 - fSlow39;
+ float fSlow44 = std::exp(fConst22 / fSlow10);
float fSlow45 = zitarevdsp_faustpower2_f(fSlow44);
- float fSlow46 = (1.0f - (fSlow45 * fSlow13));
- float fSlow47 = (1.0f - fSlow45);
- float fSlow48 = (fSlow46 / fSlow47);
- float fSlow49 = std::sqrt(std::max<float>(
- 0.0f, ((zitarevdsp_faustpower2_f(fSlow46) / zitarevdsp_faustpower2_f(fSlow47))
- + -1.0f)));
- float fSlow50 = (fSlow48 - fSlow49);
- float fSlow51 = (fSlow44 * (fSlow49 + (1.0f - fSlow48)));
- float fSlow52 = ((std::exp((fConst20 / fSlow20)) / fSlow44) + -1.0f);
- float fSlow53 = std::exp((fConst25 / fSlow10));
+ float fSlow46 = 1.0f - fSlow45 * fSlow13;
+ float fSlow47 = 1.0f - fSlow45;
+ float fSlow48 = std::sqrt(std::max<float>(
+ 0.0f, zitarevdsp_faustpower2_f(fSlow46) / zitarevdsp_faustpower2_f(fSlow47)
+ + -1.0f));
+ float fSlow49 = fSlow46 / fSlow47;
+ float fSlow50 = fSlow44 * (fSlow48 + 1.0f - fSlow49);
+ float fSlow51 = std::exp(fConst22 / fSlow19) / fSlow44 + -1.0f;
+ float fSlow52 = fSlow49 - fSlow48;
+ float fSlow53 = std::exp(fConst27 / fSlow10);
float fSlow54 = zitarevdsp_faustpower2_f(fSlow53);
- float fSlow55 = (1.0f - (fSlow54 * fSlow13));
- float fSlow56 = (1.0f - fSlow54);
- float fSlow57 = (fSlow55 / fSlow56);
- float fSlow58 = std::sqrt(std::max<float>(
- 0.0f, ((zitarevdsp_faustpower2_f(fSlow55) / zitarevdsp_faustpower2_f(fSlow56))
- + -1.0f)));
- float fSlow59 = (fSlow57 - fSlow58);
- float fSlow60 = (fSlow53 * (fSlow58 + (1.0f - fSlow57)));
- float fSlow61 = ((std::exp((fConst25 / fSlow20)) / fSlow53) + -1.0f);
- float fSlow62 = std::exp((fConst30 / fSlow10));
+ float fSlow55 = 1.0f - fSlow54 * fSlow13;
+ float fSlow56 = 1.0f - fSlow54;
+ float fSlow57 = std::sqrt(std::max<float>(
+ 0.0f, zitarevdsp_faustpower2_f(fSlow55) / zitarevdsp_faustpower2_f(fSlow56)
+ + -1.0f));
+ float fSlow58 = fSlow55 / fSlow56;
+ float fSlow59 = fSlow53 * (fSlow57 + 1.0f - fSlow58);
+ float fSlow60 = std::exp(fConst27 / fSlow19) / fSlow53 + -1.0f;
+ float fSlow61 = fSlow58 - fSlow57;
+ float fSlow62 = std::exp(fConst32 / fSlow10);
float fSlow63 = zitarevdsp_faustpower2_f(fSlow62);
- float fSlow64 = (1.0f - (fSlow63 * fSlow13));
- float fSlow65 = (1.0f - fSlow63);
- float fSlow66 = (fSlow64 / fSlow65);
- float fSlow67 = std::sqrt(std::max<float>(
- 0.0f, ((zitarevdsp_faustpower2_f(fSlow64) / zitarevdsp_faustpower2_f(fSlow65))
- + -1.0f)));
- float fSlow68 = (fSlow66 - fSlow67);
- float fSlow69 = (fSlow62 * (fSlow67 + (1.0f - fSlow66)));
- float fSlow70 = ((std::exp((fConst30 / fSlow20)) / fSlow62) + -1.0f);
- float fSlow71 = std::exp((fConst35 / fSlow10));
+ float fSlow64 = 1.0f - fSlow63 * fSlow13;
+ float fSlow65 = 1.0f - fSlow63;
+ float fSlow66 = std::sqrt(std::max<float>(
+ 0.0f, zitarevdsp_faustpower2_f(fSlow64) / zitarevdsp_faustpower2_f(fSlow65)
+ + -1.0f));
+ float fSlow67 = fSlow64 / fSlow65;
+ float fSlow68 = fSlow62 * (fSlow66 + 1.0f - fSlow67);
+ float fSlow69 = std::exp(fConst32 / fSlow19) / fSlow62 + -1.0f;
+ float fSlow70 = fSlow67 - fSlow66;
+ float fSlow71 = std::exp(fConst37 / fSlow10);
float fSlow72 = zitarevdsp_faustpower2_f(fSlow71);
- float fSlow73 = (1.0f - (fSlow72 * fSlow13));
- float fSlow74 = (1.0f - fSlow72);
- float fSlow75 = (fSlow73 / fSlow74);
- float fSlow76 = std::sqrt(std::max<float>(
- 0.0f, ((zitarevdsp_faustpower2_f(fSlow73) / zitarevdsp_faustpower2_f(fSlow74))
- + -1.0f)));
- float fSlow77 = (fSlow75 - fSlow76);
- float fSlow78 = (fSlow71 * (fSlow76 + (1.0f - fSlow75)));
- float fSlow79 = ((std::exp((fConst35 / fSlow20)) / fSlow71) + -1.0f);
- float fSlow80 = std::exp((fConst40 / fSlow10));
+ float fSlow73 = 1.0f - fSlow72 * fSlow13;
+ float fSlow74 = 1.0f - fSlow72;
+ float fSlow75 = std::sqrt(std::max<float>(
+ 0.0f, zitarevdsp_faustpower2_f(fSlow73) / zitarevdsp_faustpower2_f(fSlow74)
+ + -1.0f));
+ float fSlow76 = fSlow73 / fSlow74;
+ float fSlow77 = fSlow71 * (fSlow75 + 1.0f - fSlow76);
+ float fSlow78 = std::exp(fConst37 / fSlow19) / fSlow71 + -1.0f;
+ float fSlow79 = fSlow76 - fSlow75;
+ float fSlow80 = std::exp(fConst42 / fSlow10);
float fSlow81 = zitarevdsp_faustpower2_f(fSlow80);
- float fSlow82 = (1.0f - (fSlow81 * fSlow13));
- float fSlow83 = (1.0f - fSlow81);
- float fSlow84 = (fSlow82 / fSlow83);
- float fSlow85 = std::sqrt(std::max<float>(
- 0.0f, ((zitarevdsp_faustpower2_f(fSlow82) / zitarevdsp_faustpower2_f(fSlow83))
- + -1.0f)));
- float fSlow86 = (fSlow84 - fSlow85);
- float fSlow87 = (fSlow80 * (fSlow85 + (1.0f - fSlow84)));
- float fSlow88 = ((std::exp((fConst40 / fSlow20)) / fSlow80) + -1.0f);
- float fSlow89 = (0.0f - (std::cos((fConst1 * fSlow6)) * (fSlow9 + 1.0f)));
- float fSlow90 = (0.0f - (std::cos((fConst1 * fSlow2)) * (fSlow5 + 1.0f)));
- for (int i = 0; (i < count); i = (i + 1)) {
- float fTemp0 = float(input0[i]);
- fVec0[(IOTA & 16383)] = fTemp0;
- float fTemp1 = float(input1[i]);
- fVec1[(IOTA & 16383)] = fTemp1;
- fRec0[0] = (fSlow0 + (0.999000013f * fRec0[1]));
- fRec1[0] = (fSlow1 + (0.999000013f * fRec1[1]));
- fRec15[0] =
- (0.0f - (fSlow23 * ((fSlow24 * fRec15[1]) - (fRec11[1] + fRec11[2]))));
- fRec14[0] =
- ((fSlow18 * fRec14[1]) + (fSlow19 * (fRec11[1] + (fSlow21 * fRec15[0]))));
- fVec2[(IOTA & 32767)] = ((0.353553385f * fRec14[0]) + 9.99999968e-21f);
- float fTemp2 = (0.300000012f * fVec1[((IOTA - iSlow25) & 16383)]);
+ float fSlow82 = 1.0f - fSlow81 * fSlow13;
+ float fSlow83 = 1.0f - fSlow81;
+ float fSlow84 = std::sqrt(std::max<float>(
+ 0.0f, zitarevdsp_faustpower2_f(fSlow82) / zitarevdsp_faustpower2_f(fSlow83)
+ + -1.0f));
+ float fSlow85 = fSlow82 / fSlow83;
+ float fSlow86 = fSlow80 * (fSlow84 + 1.0f - fSlow85);
+ float fSlow87 = std::exp(fConst42 / fSlow19) / fSlow80 + -1.0f;
+ float fSlow88 = fSlow85 - fSlow84;
+ float fSlow89 = 0.0f - std::cos(fConst3 * fSlow6) * (fSlow9 + 1.0f);
+ float fSlow90 = 0.0f - std::cos(fConst3 * fSlow2) * (fSlow5 + 1.0f);
+ for (int i0 = 0; i0 < count; i0 = i0 + 1) {
+ float fTemp0 = float(input0[i0]);
+ fVec0[IOTA0 & 16383] = fTemp0;
+ float fTemp1 = float(input1[i0]);
+ fVec1[IOTA0 & 16383] = fTemp1;
+ fRec0[0] = fSlow0 + fConst2 * fRec0[1];
+ fRec1[0] = fSlow1 + fConst2 * fRec1[1];
+ fRec15[0] = 0.0f - fSlow22 * (fSlow23 * fRec15[1] - (fRec11[1] + fRec11[2]));
+ fRec14[0] = fSlow18 * (fRec11[1] + fSlow20 * fRec15[0]) + fSlow24 * fRec14[1];
+ fVec2[IOTA0 & 32767] = 0.353553385f * fRec14[0] + 9.99999968e-21f;
+ float fTemp2 = 0.300000012f * fVec1[(IOTA0 - iSlow25) & 16383];
float fTemp3 =
- (((0.600000024f * fRec12[1]) + fVec2[((IOTA - iConst6) & 32767)])
- - fTemp2);
- fVec3[(IOTA & 2047)] = fTemp3;
- fRec12[0] = fVec3[((IOTA - iConst8) & 2047)];
- float fRec13 = (0.0f - (0.600000024f * fTemp3));
- fRec19[0] =
- (0.0f - (fSlow23 * ((fSlow24 * fRec19[1]) - (fRec7[1] + fRec7[2]))));
- fRec18[0] =
- ((fSlow32 * fRec18[1]) + (fSlow33 * (fRec7[1] + (fSlow34 * fRec19[0]))));
- fVec4[(IOTA & 32767)] = ((0.353553385f * fRec18[0]) + 9.99999968e-21f);
+ (0.600000024f * fRec12[1] + fVec2[(IOTA0 - iConst8) & 32767]) - fTemp2;
+ fVec3[IOTA0 & 2047] = fTemp3;
+ fRec12[0] = fVec3[(IOTA0 - iConst10) & 2047];
+ float fRec13 = 0.0f - 0.600000024f * fTemp3;
+ fRec19[0] = 0.0f - fSlow22 * (fSlow23 * fRec19[1] - (fRec7[1] + fRec7[2]));
+ fRec18[0] = fSlow32 * (fRec7[1] + fSlow33 * fRec19[0]) + fSlow34 * fRec18[1];
+ fVec4[IOTA0 & 32767] = 0.353553385f * fRec18[0] + 9.99999968e-21f;
float fTemp4 =
- (((0.600000024f * fRec16[1]) + fVec4[((IOTA - iConst12) & 32767)])
- - fTemp2);
- fVec5[(IOTA & 4095)] = fTemp4;
- fRec16[0] = fVec5[((IOTA - iConst13) & 4095)];
- float fRec17 = (0.0f - (0.600000024f * fTemp4));
- fRec23[0] =
- (0.0f - (fSlow23 * ((fSlow24 * fRec23[1]) - (fRec9[1] + fRec9[2]))));
- fRec22[0] =
- ((fSlow41 * fRec22[1]) + (fSlow42 * (fRec9[1] + (fSlow43 * fRec23[0]))));
- fVec6[(IOTA & 16383)] = ((0.353553385f * fRec22[0]) + 9.99999968e-21f);
- float fTemp5 = (fVec6[((IOTA - iConst17) & 16383)]
- + (fTemp2 + (0.600000024f * fRec20[1])));
- fVec7[(IOTA & 4095)] = fTemp5;
- fRec20[0] = fVec7[((IOTA - iConst18) & 4095)];
- float fRec21 = (0.0f - (0.600000024f * fTemp5));
- fRec27[0] =
- (0.0f - (fSlow23 * ((fSlow24 * fRec27[1]) - (fRec5[1] + fRec5[2]))));
- fRec26[0] =
- ((fSlow50 * fRec26[1]) + (fSlow51 * (fRec5[1] + (fSlow52 * fRec27[0]))));
- fVec8[(IOTA & 32767)] = ((0.353553385f * fRec26[0]) + 9.99999968e-21f);
+ (0.600000024f * fRec16[1] + fVec4[(IOTA0 - iConst14) & 32767]) - fTemp2;
+ fVec5[IOTA0 & 4095] = fTemp4;
+ fRec16[0] = fVec5[(IOTA0 - iConst15) & 4095];
+ float fRec17 = 0.0f - 0.600000024f * fTemp4;
+ fRec23[0] = 0.0f - fSlow22 * (fSlow23 * fRec23[1] - (fRec9[1] + fRec9[2]));
+ fRec22[0] = fSlow41 * (fRec9[1] + fSlow42 * fRec23[0]) + fSlow43 * fRec22[1];
+ fVec6[IOTA0 & 16383] = 0.353553385f * fRec22[0] + 9.99999968e-21f;
+ float fTemp5 =
+ fVec6[(IOTA0 - iConst19) & 16383] + fTemp2 + 0.600000024f * fRec20[1];
+ fVec7[IOTA0 & 4095] = fTemp5;
+ fRec20[0] = fVec7[(IOTA0 - iConst20) & 4095];
+ float fRec21 = 0.0f - 0.600000024f * fTemp5;
+ fRec27[0] = 0.0f - fSlow22 * (fSlow23 * fRec27[1] - (fRec5[1] + fRec5[2]));
+ fRec26[0] = fSlow50 * (fRec5[1] + fSlow51 * fRec27[0]) + fSlow52 * fRec26[1];
+ fVec8[IOTA0 & 32767] = 0.353553385f * fRec26[0] + 9.99999968e-21f;
float fTemp6 =
- (fTemp2
- + ((0.600000024f * fRec24[1]) + fVec8[((IOTA - iConst22) & 32767)]));
- fVec9[(IOTA & 4095)] = fTemp6;
- fRec24[0] = fVec9[((IOTA - iConst23) & 4095)];
- float fRec25 = (0.0f - (0.600000024f * fTemp6));
- fRec31[0] =
- (0.0f - (fSlow23 * ((fSlow24 * fRec31[1]) - (fRec10[1] + fRec10[2]))));
- fRec30[0] =
- ((fSlow59 * fRec30[1]) + (fSlow60 * (fRec10[1] + (fSlow61 * fRec31[0]))));
- fVec10[(IOTA & 16383)] = ((0.353553385f * fRec30[0]) + 9.99999968e-21f);
- float fTemp7 = (0.300000012f * fVec0[((IOTA - iSlow25) & 16383)]);
- float fTemp8 = (fVec10[((IOTA - iConst27) & 16383)]
- - (fTemp7 + (0.600000024f * fRec28[1])));
- fVec11[(IOTA & 2047)] = fTemp8;
- fRec28[0] = fVec11[((IOTA - iConst28) & 2047)];
- float fRec29 = (0.600000024f * fTemp8);
- fRec35[0] =
- (0.0f - (fSlow23 * ((fSlow24 * fRec35[1]) - (fRec6[1] + fRec6[2]))));
- fRec34[0] =
- ((fSlow68 * fRec34[1]) + (fSlow69 * (fRec6[1] + (fSlow70 * fRec35[0]))));
- fVec12[(IOTA & 16383)] = ((0.353553385f * fRec34[0]) + 9.99999968e-21f);
- float fTemp9 = (fVec12[((IOTA - iConst32) & 16383)]
- - (fTemp7 + (0.600000024f * fRec32[1])));
- fVec13[(IOTA & 4095)] = fTemp9;
- fRec32[0] = fVec13[((IOTA - iConst33) & 4095)];
- float fRec33 = (0.600000024f * fTemp9);
- fRec39[0] =
- (0.0f - (fSlow23 * ((fSlow24 * fRec39[1]) - (fRec8[1] + fRec8[2]))));
- fRec38[0] =
- ((fSlow77 * fRec38[1]) + (fSlow78 * (fRec8[1] + (fSlow79 * fRec39[0]))));
- fVec14[(IOTA & 16383)] = ((0.353553385f * fRec38[0]) + 9.99999968e-21f);
- float fTemp10 = ((fTemp7 + fVec14[((IOTA - iConst37) & 16383)])
- - (0.600000024f * fRec36[1]));
- fVec15[(IOTA & 4095)] = fTemp10;
- fRec36[0] = fVec15[((IOTA - iConst38) & 4095)];
- float fRec37 = (0.600000024f * fTemp10);
- fRec43[0] =
- (0.0f - (fSlow23 * ((fSlow24 * fRec43[1]) - (fRec4[1] + fRec4[2]))));
- fRec42[0] =
- ((fSlow86 * fRec42[1]) + (fSlow87 * (fRec4[1] + (fSlow88 * fRec43[0]))));
- fVec16[(IOTA & 16383)] = ((0.353553385f * fRec42[0]) + 9.99999968e-21f);
- float fTemp11 = ((fVec16[((IOTA - iConst42) & 16383)] + fTemp7)
- - (0.600000024f * fRec40[1]));
- fVec17[(IOTA & 2047)] = fTemp11;
- fRec40[0] = fVec17[((IOTA - iConst43) & 2047)];
- float fRec41 = (0.600000024f * fTemp11);
- float fTemp12 = (fRec41 + fRec37);
- float fTemp13 = (fRec29 + (fRec33 + fTemp12));
- fRec4[0] =
- (fRec12[1]
- + (fRec16[1]
- + (fRec20[1]
- + (fRec24[1]
- + (fRec28[1]
- + (fRec32[1]
- + (fRec36[1]
- + (fRec40[1]
- + (fRec13
- + (fRec17
- + (fRec21 + (fRec25 + fTemp13))))))))))));
- fRec5[0] =
- ((fRec28[1] + (fRec32[1] + (fRec36[1] + (fRec40[1] + fTemp13))))
- - (fRec12[1]
- + (fRec16[1]
- + (fRec20[1]
- + (fRec24[1] + (fRec13 + (fRec17 + (fRec25 + fRec21))))))));
- float fTemp14 = (fRec33 + fRec29);
- fRec6[0] =
- ((fRec20[1]
- + (fRec24[1]
- + (fRec36[1] + (fRec40[1] + (fRec21 + (fRec25 + fTemp12))))))
- - (fRec12[1]
- + (fRec16[1]
- + (fRec28[1] + (fRec32[1] + (fRec13 + (fRec17 + fTemp14)))))));
- fRec7[0] =
- ((fRec12[1]
- + (fRec16[1]
- + (fRec36[1] + (fRec40[1] + (fRec13 + (fRec17 + fTemp12))))))
- - (fRec20[1]
- + (fRec24[1]
- + (fRec28[1] + (fRec32[1] + (fRec21 + (fRec25 + fTemp14)))))));
- float fTemp15 = (fRec41 + fRec33);
- float fTemp16 = (fRec37 + fRec29);
- fRec8[0] =
- ((fRec16[1]
- + (fRec24[1]
- + (fRec32[1] + (fRec40[1] + (fRec17 + (fRec25 + fTemp15))))))
- - (fRec12[1]
- + (fRec20[1]
- + (fRec28[1] + (fRec36[1] + (fRec13 + (fRec21 + fTemp16)))))));
- fRec9[0] =
- ((fRec12[1]
- + (fRec20[1]
- + (fRec32[1] + (fRec40[1] + (fRec13 + (fRec21 + fTemp15))))))
- - (fRec16[1]
- + (fRec24[1]
- + (fRec28[1] + (fRec36[1] + (fRec17 + (fRec25 + fTemp16)))))));
- float fTemp17 = (fRec41 + fRec29);
- float fTemp18 = (fRec37 + fRec33);
- fRec10[0] =
- ((fRec12[1]
- + (fRec24[1]
- + (fRec28[1] + (fRec40[1] + (fRec13 + (fRec25 + fTemp17))))))
- - (fRec16[1]
- + (fRec20[1]
- + (fRec32[1] + (fRec36[1] + (fRec17 + (fRec21 + fTemp18)))))));
- fRec11[0] =
- ((fRec16[1]
- + (fRec20[1]
- + (fRec28[1] + (fRec40[1] + (fRec17 + (fRec21 + fTemp17))))))
- - (fRec12[1]
- + (fRec24[1]
- + (fRec32[1] + (fRec36[1] + (fRec13 + (fRec25 + fTemp18)))))));
- float fTemp19 = (0.370000005f * (fRec5[0] + fRec6[0]));
- float fTemp20 = (fSlow89 * fRec3[1]);
- fRec3[0] = (fTemp19 - (fTemp20 + (fSlow9 * fRec3[2])));
- float fTemp21 = (fSlow9 * fRec3[0]);
- float fTemp22 =
- (0.5f
- * ((fTemp21 + (fRec3[2] + (fTemp19 + fTemp20)))
- + (fSlow7 * ((fTemp21 + (fTemp20 + fRec3[2])) - fTemp19))));
- float fTemp23 = (fSlow90 * fRec2[1]);
- fRec2[0] = (fTemp22 - (fTemp23 + (fSlow5 * fRec2[2])));
- float fTemp24 = (fSlow5 * fRec2[0]);
- float fTemp25 = (1.0f - fRec1[0]);
- output0[i] = FAUSTFLOAT(
- (fRec0[0]
- * ((0.5f
- * (fRec1[0]
- * ((fTemp24 + (fRec2[2] + (fTemp22 + fTemp23)))
- + (fSlow3 * ((fTemp24 + (fTemp23 + fRec2[2])) - fTemp22)))))
- + (fTemp0 * fTemp25))));
- float fTemp26 = (0.370000005f * (fRec5[0] - fRec6[0]));
- float fTemp27 = (fSlow89 * fRec45[1]);
- fRec45[0] = (fTemp26 - (fTemp27 + (fSlow9 * fRec45[2])));
- float fTemp28 = (fSlow9 * fRec45[0]);
- float fTemp29 =
- (0.5f
- * ((fTemp28 + (fRec45[2] + (fTemp26 + fTemp27)))
- + (fSlow7 * ((fTemp28 + (fTemp27 + fRec45[2])) - fTemp26))));
- float fTemp30 = (fSlow90 * fRec44[1]);
- fRec44[0] = (fTemp29 - (fTemp30 + (fSlow5 * fRec44[2])));
- float fTemp31 = (fSlow5 * fRec44[0]);
- output1[i] = FAUSTFLOAT(
- (fRec0[0]
- * ((0.5f
- * (fRec1[0]
- * ((fTemp31 + (fRec44[2] + (fTemp29 + fTemp30)))
- + (fSlow3 * ((fTemp31 + (fTemp30 + fRec44[2])) - fTemp29)))))
- + (fTemp1 * fTemp25))));
- IOTA = (IOTA + 1);
+ fTemp2 + 0.600000024f * fRec24[1] + fVec8[(IOTA0 - iConst24) & 32767];
+ fVec9[IOTA0 & 4095] = fTemp6;
+ fRec24[0] = fVec9[(IOTA0 - iConst25) & 4095];
+ float fRec25 = 0.0f - 0.600000024f * fTemp6;
+ fRec31[0] = 0.0f - fSlow22 * (fSlow23 * fRec31[1] - (fRec10[1] + fRec10[2]));
+ fRec30[0] = fSlow59 * (fRec10[1] + fSlow60 * fRec31[0]) + fSlow61 * fRec30[1];
+ fVec10[IOTA0 & 16383] = 0.353553385f * fRec30[0] + 9.99999968e-21f;
+ float fTemp7 = 0.300000012f * fVec0[(IOTA0 - iSlow25) & 16383];
+ float fTemp8 =
+ fVec10[(IOTA0 - iConst29) & 16383] - (fTemp7 + 0.600000024f * fRec28[1]);
+ fVec11[IOTA0 & 2047] = fTemp8;
+ fRec28[0] = fVec11[(IOTA0 - iConst30) & 2047];
+ float fRec29 = 0.600000024f * fTemp8;
+ fRec35[0] = 0.0f - fSlow22 * (fSlow23 * fRec35[1] - (fRec6[1] + fRec6[2]));
+ fRec34[0] = fSlow68 * (fRec6[1] + fSlow69 * fRec35[0]) + fSlow70 * fRec34[1];
+ fVec12[IOTA0 & 16383] = 0.353553385f * fRec34[0] + 9.99999968e-21f;
+ float fTemp9 =
+ fVec12[(IOTA0 - iConst34) & 16383] - (fTemp7 + 0.600000024f * fRec32[1]);
+ fVec13[IOTA0 & 4095] = fTemp9;
+ fRec32[0] = fVec13[(IOTA0 - iConst35) & 4095];
+ float fRec33 = 0.600000024f * fTemp9;
+ fRec39[0] = 0.0f - fSlow22 * (fSlow23 * fRec39[1] - (fRec8[1] + fRec8[2]));
+ fRec38[0] = fSlow77 * (fRec8[1] + fSlow78 * fRec39[0]) + fSlow79 * fRec38[1];
+ fVec14[IOTA0 & 16383] = 0.353553385f * fRec38[0] + 9.99999968e-21f;
+ float fTemp10 =
+ (fTemp7 + fVec14[(IOTA0 - iConst39) & 16383]) - 0.600000024f * fRec36[1];
+ fVec15[IOTA0 & 4095] = fTemp10;
+ fRec36[0] = fVec15[(IOTA0 - iConst40) & 4095];
+ float fRec37 = 0.600000024f * fTemp10;
+ fRec43[0] = 0.0f - fSlow22 * (fSlow23 * fRec43[1] - (fRec4[1] + fRec4[2]));
+ fRec42[0] = fSlow86 * (fRec4[1] + fSlow87 * fRec43[0]) + fSlow88 * fRec42[1];
+ fVec16[IOTA0 & 16383] = 0.353553385f * fRec42[0] + 9.99999968e-21f;
+ float fTemp11 =
+ (fVec16[(IOTA0 - iConst44) & 16383] + fTemp7) - 0.600000024f * fRec40[1];
+ fVec17[IOTA0 & 2047] = fTemp11;
+ fRec40[0] = fVec17[(IOTA0 - iConst45) & 2047];
+ float fRec41 = 0.600000024f * fTemp11;
+ float fTemp12 = fRec40[1] + fRec36[1];
+ float fTemp13 =
+ fRec29 + fRec33 + fRec37 + fRec41 + fRec28[1] + fTemp12 + fRec32[1];
+ fRec4[0] = fRec12[1] + fRec16[1] + fRec20[1] + fRec24[1] + fRec13 + fRec17
+ + fRec21 + fRec25 + fTemp13;
+ fRec5[0] = fTemp13
+ - (fRec12[1] + fRec16[1] + fRec20[1] + fRec24[1] + fRec13 + fRec17
+ + fRec25 + fRec21);
+ float fTemp14 = fRec37 + fRec41 + fTemp12;
+ float fTemp15 = fRec29 + fRec33 + fRec32[1] + fRec28[1];
+ fRec6[0] = (fRec20[1] + fRec24[1] + fRec21 + fRec25 + fTemp14)
+ - (fRec12[1] + fRec16[1] + fRec13 + fRec17 + fTemp15);
+ fRec7[0] = (fRec12[1] + fRec16[1] + fRec13 + fRec17 + fTemp14)
+ - (fRec20[1] + fRec24[1] + fRec21 + fRec25 + fTemp15);
+ float fTemp16 = fRec33 + fRec41 + fRec40[1] + fRec32[1];
+ float fTemp17 = fRec29 + fRec37 + fRec36[1] + fRec28[1];
+ fRec8[0] = (fRec16[1] + fRec24[1] + fRec17 + fRec25 + fTemp16)
+ - (fRec12[1] + fRec20[1] + fRec13 + fRec21 + fTemp17);
+ fRec9[0] = (fRec12[1] + fRec20[1] + fRec13 + fRec21 + fTemp16)
+ - (fRec16[1] + fRec24[1] + fRec17 + fRec25 + fTemp17);
+ float fTemp18 = fRec29 + fRec41 + fRec40[1] + fRec28[1];
+ float fTemp19 = fRec33 + fRec37 + fRec36[1] + fRec32[1];
+ fRec10[0] = (fRec12[1] + fRec24[1] + fRec13 + fRec25 + fTemp18)
+ - (fRec16[1] + fRec20[1] + fRec17 + fRec21 + fTemp19);
+ fRec11[0] = (fRec16[1] + fRec20[1] + fRec17 + fRec21 + fTemp18)
+ - (fRec12[1] + fRec24[1] + fRec13 + fRec25 + fTemp19);
+ float fTemp20 = 0.370000005f * (fRec5[0] + fRec6[0]);
+ float fTemp21 = fSlow89 * fRec3[1];
+ fRec3[0] = fTemp20 - (fTemp21 + fSlow9 * fRec3[2]);
+ float fTemp22 = fSlow9 * fRec3[0];
+ float fTemp23 = 0.5f
+ * (fTemp22 + fRec3[2] + fTemp20 + fTemp21
+ + fSlow7 * ((fTemp22 + fTemp21 + fRec3[2]) - fTemp20));
+ float fTemp24 = fSlow90 * fRec2[1];
+ fRec2[0] = fTemp23 - (fTemp24 + fSlow5 * fRec2[2]);
+ float fTemp25 = fSlow5 * fRec2[0];
+ float fTemp26 = 1.0f - fRec1[0];
+ output0[i0] = FAUSTFLOAT(
+ fRec0[0]
+ * (0.5f * fRec1[0]
+ * (fTemp25 + fRec2[2] + fTemp23 + fTemp24
+ + fSlow3 * ((fTemp25 + fTemp24 + fRec2[2]) - fTemp23))
+ + fTemp0 * fTemp26));
+ float fTemp27 = 0.370000005f * (fRec5[0] - fRec6[0]);
+ float fTemp28 = fSlow89 * fRec45[1];
+ fRec45[0] = fTemp27 - (fTemp28 + fSlow9 * fRec45[2]);
+ float fTemp29 = fSlow9 * fRec45[0];
+ float fTemp30 = 0.5f
+ * (fTemp29 + fRec45[2] + fTemp27 + fTemp28
+ + fSlow7 * ((fTemp29 + fTemp28 + fRec45[2]) - fTemp27));
+ float fTemp31 = fSlow90 * fRec44[1];
+ fRec44[0] = fTemp30 - (fTemp31 + fSlow5 * fRec44[2]);
+ float fTemp32 = fSlow5 * fRec44[0];
+ output1[i0] = FAUSTFLOAT(
+ fRec0[0]
+ * (0.5f * fRec1[0]
+ * (fTemp32 + fRec44[2] + fTemp30 + fTemp31
+ + fSlow3 * ((fTemp32 + fTemp31 + fRec44[2]) - fTemp30))
+ + fTemp1 * fTemp26));
+ IOTA0 = IOTA0 + 1;
fRec0[1] = fRec0[0];
fRec1[1] = fRec1[0];
fRec15[1] = fRec15[0];
diff --git a/src/zitarevmonodsp.h b/src/zitarevmonodsp.h
index 0053a95..4f0475b 100644
--- a/src/zitarevmonodsp.h
+++ b/src/zitarevmonodsp.h
@@ -1,7 +1,8 @@
/* ------------------------------------------------------------
name: "zitarevmonodsp"
-Code generated with Faust 2.28.6 (https://faust.grame.fr)
-Compilation options: -lang cpp -inpl -scal -ftz 0
+Code generated with Faust 2.41.1 (https://faust.grame.fr)
+Compilation options: -a faust2header.cpp -lang cpp -i -inpl -cn zitarevmonodsp -es 1 -mcd
+16 -single -ftz 0
------------------------------------------------------------ */
#ifndef __zitarevmonodsp_H__
@@ -14,23 +15,23 @@ Compilation options: -lang cpp -inpl -scal -ftz 0
// aimed at creating a simple C++ header file (.h) containing a Faust DSP.
// See the Makefile for how to use it.
-/************************** BEGIN dsp.h **************************/
-/************************************************************************
+/************************** BEGIN dsp.h ********************************
FAUST Architecture File
- Copyright (C) 2003-2017 GRAME, Centre National de Creation Musicale
+ Copyright (C) 2003-2022 GRAME, Centre National de Creation Musicale
---------------------------------------------------------------------
- This Architecture section is free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 3 of
- the License, or (at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; If not, see <http://www.gnu.org/licenses/>.
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
EXCEPTION : As a special exception, you may create a larger work
that contains this FAUST architecture section and distribute
@@ -44,29 +45,111 @@ Compilation options: -lang cpp -inpl -scal -ftz 0
#include <string>
#include <vector>
+/************************************************************************
+ ************************************************************************
+ FAUST compiler
+ Copyright (C) 2003-2018 GRAME, Centre National de Creation Musicale
+ ---------------------------------------------------------------------
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ ************************************************************************
+ ************************************************************************/
+
+#ifndef __export__
+#define __export__
+
+#define FAUSTVERSION "2.41.1"
+
+// Use FAUST_API for code that is part of the external API but is also compiled in faust
+// and libfaust Use LIBFAUST_API for code that is compiled in faust and libfaust
+
+#ifdef _WIN32
+#pragma warning(disable : 4251)
+#ifdef FAUST_EXE
+#define FAUST_API
+#define LIBFAUST_API
+#elif FAUST_LIB
+#define FAUST_API __declspec(dllexport)
+#define LIBFAUST_API __declspec(dllexport)
+#else
+#define FAUST_API
+#define LIBFAUST_API
+#endif
+#else
+#ifdef FAUST_EXE
+#define FAUST_API
+#define LIBFAUST_API
+#else
+#define FAUST_API __attribute__((visibility("default")))
+#define LIBFAUST_API __attribute__((visibility("default")))
+#endif
+#endif
+
+#endif
+
#ifndef FAUSTFLOAT
#define FAUSTFLOAT float
#endif
-struct UI;
-struct Meta;
+struct FAUST_API UI;
+struct FAUST_API Meta;
/**
* DSP memory manager.
*/
-struct dsp_memory_manager {
+struct FAUST_API dsp_memory_manager {
virtual ~dsp_memory_manager() {}
+ /**
+ * Inform the Memory Manager with the number of expected memory zones.
+ * @param count - the number of expected memory zones
+ */
+ virtual void begin(size_t /*count*/) {}
+
+ /**
+ * Give the Memory Manager information on a given memory zone.
+ * @param size - the size in bytes of the memory zone
+ * @param reads - the number of Read access to the zone used to compute one frame
+ * @param writes - the number of Write access to the zone used to compute one frame
+ */
+ virtual void info(size_t /*size*/, size_t /*reads*/, size_t /*writes*/) {}
+
+ /**
+ * Inform the Memory Manager that all memory zones have been described,
+ * to possibly start a 'compute the best allocation strategy' step.
+ */
+ virtual void end() {}
+
+ /**
+ * Allocate a memory zone.
+ * @param size - the memory zone size in bytes
+ */
virtual void* allocate(size_t size) = 0;
- virtual void destroy(void* ptr) = 0;
+
+ /**
+ * Destroy a memory zone.
+ * @param ptr - the memory zone pointer to be deallocated
+ */
+ virtual void destroy(void* ptr) = 0;
};
/**
* Signal processor definition.
*/
-class dsp
+class FAUST_API dsp
{
public:
dsp() {}
@@ -86,7 +169,7 @@ class dsp
*/
virtual void buildUserInterface(UI* ui_interface) = 0;
- /* Returns the sample rate currently used by the instance */
+ /* Return the sample rate currently used by the instance */
virtual int getSampleRate() = 0;
/**
@@ -94,28 +177,28 @@ class dsp
* - static class 'classInit': static tables initialization
* - 'instanceInit': constants and instance state initialization
*
- * @param sample_rate - the sampling rate in Hertz
+ * @param sample_rate - the sampling rate in Hz
*/
virtual void init(int sample_rate) = 0;
/**
* Init instance state
*
- * @param sample_rate - the sampling rate in Hertz
+ * @param sample_rate - the sampling rate in Hz
*/
virtual void instanceInit(int sample_rate) = 0;
/**
* Init instance constant state
*
- * @param sample_rate - the sampling rate in Hertz
+ * @param sample_rate - the sampling rate in Hz
*/
virtual void instanceConstants(int sample_rate) = 0;
/* Init default control parameters values */
virtual void instanceResetUserInterface() = 0;
- /* Init instance state (delay lines...) */
+ /* Init instance state (like delay lines...) but keep the control parameter values */
virtual void instanceClear() = 0;
/**
@@ -167,7 +250,7 @@ class dsp
* Generic DSP decorator.
*/
-class decorator_dsp : public dsp
+class FAUST_API decorator_dsp : public dsp
{
protected:
dsp* fDSP;
@@ -206,10 +289,11 @@ class decorator_dsp : public dsp
};
/**
- * DSP factory class.
+ * DSP factory class, used with LLVM and Interpreter backends
+ * to create DSP instances from a compiled DSP program.
*/
-class dsp_factory
+class FAUST_API dsp_factory
{
protected:
// So that to force sub-classes to use deleteDSPFactory(dsp_factory* factory);
@@ -229,75 +313,114 @@ class dsp_factory
virtual dsp_memory_manager* getMemoryManager() = 0;
};
-/**
- * On Intel set FZ (Flush to Zero) and DAZ (Denormals Are Zero)
- * flags to avoid costly denormals.
- */
+// Denormal handling
-#ifdef __SSE__
+#if defined(__SSE__)
#include <xmmintrin.h>
-#ifdef __SSE2__
-#define AVOIDDENORMALS _mm_setcsr(_mm_getcsr() | 0x8040)
+#endif
+
+class FAUST_API ScopedNoDenormals
+{
+ private:
+ intptr_t fpsr;
+
+ void setFpStatusRegister(intptr_t fpsr_aux) noexcept
+ {
+#if defined(__arm64__) || defined(__aarch64__)
+ asm volatile("msr fpcr, %0" : : "ri"(fpsr_aux));
+#elif defined(__SSE__)
+ _mm_setcsr(static_cast<uint32_t>(fpsr_aux));
+#endif
+ }
+
+ void getFpStatusRegister() noexcept
+ {
+#if defined(__arm64__) || defined(__aarch64__)
+ asm volatile("mrs %0, fpcr" : "=r"(fpsr));
+#elif defined(__SSE__)
+ fpsr = static_cast<intptr_t>(_mm_getcsr());
+#endif
+ }
+
+ public:
+ ScopedNoDenormals() noexcept
+ {
+#if defined(__arm64__) || defined(__aarch64__)
+ intptr_t mask = (1 << 24 /* FZ */);
#else
-#define AVOIDDENORMALS _mm_setcsr(_mm_getcsr() | 0x8000)
+#if defined(__SSE__)
+#if defined(__SSE2__)
+ intptr_t mask = 0x8040;
+#else
+ intptr_t mask = 0x8000;
#endif
#else
-#define AVOIDDENORMALS
+ intptr_t mask = 0x0000;
#endif
-
#endif
-/************************** END dsp.h **************************/
+ getFpStatusRegister();
+ setFpStatusRegister(fpsr | mask);
+ }
-/************************** BEGIN APIUI.h **************************/
-/************************************************************************
- FAUST Architecture File
- Copyright (C) 2003-2017 GRAME, Centre National de Creation Musicale
- ---------------------------------------------------------------------
- This Architecture section is free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 3 of
- the License, or (at your option) any later version.
+ ~ScopedNoDenormals() noexcept { setFpStatusRegister(fpsr); }
+};
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+#define AVOIDDENORMALS ScopedNoDenormals();
- You should have received a copy of the GNU General Public License
- along with this program; If not, see <http://www.gnu.org/licenses/>.
+#endif
- EXCEPTION : As a special exception, you may create a larger work
- that contains this FAUST architecture section and distribute
- that work under terms of your choice, so long as this FAUST
- architecture section is not modified.
- ************************************************************************/
+/************************** END dsp.h **************************/
+/************************** BEGIN APIUI.h *****************************
+FAUST Architecture File
+Copyright (C) 2003-2022 GRAME, Centre National de Creation Musicale
+---------------------------------------------------------------------
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+EXCEPTION : As a special exception, you may create a larger work
+that contains this FAUST architecture section and distribute
+that work under terms of your choice, so long as this FAUST
+architecture section is not modified.
+************************************************************************/
#ifndef API_UI_H
#define API_UI_H
-#include <iostream>
+#include <stdio.h>
+
#include <map>
#include <sstream>
#include <string>
#include <vector>
-/************************** BEGIN meta.h **************************/
-/************************************************************************
+/************************** BEGIN meta.h *******************************
FAUST Architecture File
- Copyright (C) 2003-2017 GRAME, Centre National de Creation Musicale
+ Copyright (C) 2003-2022 GRAME, Centre National de Creation Musicale
---------------------------------------------------------------------
- This Architecture section is free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 3 of
- the License, or (at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; If not, see <http://www.gnu.org/licenses/>.
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
EXCEPTION : As a special exception, you may create a larger work
that contains this FAUST architecture section and distribute
@@ -308,36 +431,40 @@ class dsp_factory
#ifndef __meta__
#define __meta__
-struct Meta {
- virtual ~Meta(){};
+/**
+ The base class of Meta handler to be used in dsp::metadata(Meta* m) method to retrieve
+ (key, value) metadata.
+ */
+struct FAUST_API Meta {
+ virtual ~Meta() {}
virtual void declare(const char* key, const char* value) = 0;
};
#endif
/************************** END meta.h **************************/
-/************************** BEGIN UI.h **************************/
-/************************************************************************
+/************************** BEGIN UI.h *****************************
FAUST Architecture File
- Copyright (C) 2003-2020 GRAME, Centre National de Creation Musicale
+ Copyright (C) 2003-2022 GRAME, Centre National de Creation Musicale
---------------------------------------------------------------------
- This Architecture section is free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 3 of
- the License, or (at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; If not, see <http://www.gnu.org/licenses/>.
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
EXCEPTION : As a special exception, you may create a larger work
that contains this FAUST architecture section and distribute
that work under terms of your choice, so long as this FAUST
architecture section is not modified.
- ************************************************************************/
+ ********************************************************************/
#ifndef __UI_H__
#define __UI_H__
@@ -356,7 +483,7 @@ struct Meta {
struct Soundfile;
template<typename REAL>
-struct UIReal {
+struct FAUST_API UIReal {
UIReal() {}
virtual ~UIReal() {}
@@ -387,38 +514,41 @@ struct UIReal {
// -- soundfiles
- virtual void addSoundfile(const char* label, const char* filename,
- Soundfile** sf_zone) = 0;
+ virtual void addSoundfile(const char* /*label*/, const char* /*filename*/,
+ Soundfile** /*sf_zone*/) = 0;
// -- metadata declarations
- virtual void declare(REAL* zone, const char* key, const char* val) {}
+ virtual void declare(REAL* /*zone*/, const char* /*key*/, const char* /*val*/) {}
+
+ // To be used by LLVM client
+ virtual int sizeOfFAUSTFLOAT() { return sizeof(FAUSTFLOAT); }
};
-struct UI : public UIReal<FAUSTFLOAT> {
+struct FAUST_API UI : public UIReal<FAUSTFLOAT> {
UI() {}
virtual ~UI() {}
};
#endif
/************************** END UI.h **************************/
-/************************** BEGIN PathBuilder.h **************************/
-/************************************************************************
+/************************** BEGIN PathBuilder.h **************************
FAUST Architecture File
- Copyright (C) 2003-2017 GRAME, Centre National de Creation Musicale
+ Copyright (C) 2003-2022 GRAME, Centre National de Creation Musicale
---------------------------------------------------------------------
- This Architecture section is free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 3 of
- the License, or (at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; If not, see <http://www.gnu.org/licenses/>.
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
EXCEPTION : As a special exception, you may create a larger work
that contains this FAUST architecture section and distribute
@@ -426,10 +556,13 @@ struct UI : public UIReal<FAUSTFLOAT> {
architecture section is not modified.
************************************************************************/
-#ifndef FAUST_PATHBUILDER_H
-#define FAUST_PATHBUILDER_H
+#ifndef __PathBuilder__
+#define __PathBuilder__
#include <algorithm>
+#include <map>
+#include <regex>
+#include <set>
#include <string>
#include <vector>
@@ -438,113 +571,266 @@ struct UI : public UIReal<FAUSTFLOAT> {
* Helper class to build complete hierarchical path for UI items.
******************************************************************************/
-class PathBuilder
+class FAUST_API PathBuilder
{
protected:
std::vector<std::string> fControlsLevel;
+ std::vector<std::string> fFullPaths;
+ std::map<std::string, std::string> fFull2Short; // filled by computeShortNames()
+
+ /**
+ * @brief check if a character is acceptable for an ID
+ *
+ * @param c
+ * @return true is the character is acceptable for an ID
+ */
+ bool isIDChar(char c) const
+ {
+ return ((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z'))
+ || ((c >= '0') && (c <= '9'));
+ }
+
+ /**
+ * @brief remove all "/0x00" parts
+ *
+ * @param src
+ * @return modified string
+ */
+ std::string remove0x00(const std::string& src) const
+ {
+ return std::regex_replace(src, std::regex("/0x00"), "");
+ }
+
+ /**
+ * @brief replace all non ID char with '_' (one '_' may replace several non ID char)
+ *
+ * @param src
+ * @return modified string
+ */
+ std::string str2ID(const std::string& src) const
+ {
+ std::string dst;
+ bool need_underscore = false;
+ for (char c : src) {
+ if (isIDChar(c) || (c == '/')) {
+ if (need_underscore) {
+ dst.push_back('_');
+ need_underscore = false;
+ }
+ dst.push_back(c);
+ } else {
+ need_underscore = true;
+ }
+ }
+ return dst;
+ }
+
+ /**
+ * @brief Keep only the last n slash-parts
+ *
+ * @param src
+ * @param n : 1 indicates the last slash-part
+ * @return modified string
+ */
+ std::string cut(const std::string& src, int n) const
+ {
+ std::string rdst;
+ for (int i = int(src.length()) - 1; i >= 0; i--) {
+ char c = src[i];
+ if (c != '/') {
+ rdst.push_back(c);
+ } else if (n == 1) {
+ std::string dst;
+ for (int j = int(rdst.length()) - 1; j >= 0; j--) {
+ dst.push_back(rdst[j]);
+ }
+ return dst;
+ } else {
+ n--;
+ rdst.push_back(c);
+ }
+ }
+ return src;
+ }
+
+ void addFullPath(const std::string& label) { fFullPaths.push_back(buildPath(label)); }
+
+ /**
+ * @brief Compute the mapping between full path and short names
+ */
+ void computeShortNames()
+ {
+ std::vector<std::string>
+ uniquePaths; // all full paths transformed but made unique with a prefix
+ std::map<std::string, std::string>
+ unique2full; // all full paths transformed but made unique with a prefix
+ char num_buffer[16];
+ int pnum = 0;
+
+ for (const auto& s : fFullPaths) {
+ sprintf(num_buffer, "%d", pnum++);
+ std::string u = "/P" + std::string(num_buffer) + str2ID(remove0x00(s));
+ uniquePaths.push_back(u);
+ unique2full[u] = s; // remember the full path associated to a unique path
+ }
+
+ std::map<std::string, int> uniquePath2level; // map path to level
+ for (const auto& s : uniquePaths)
+ uniquePath2level[s] = 1; // we init all levels to 1
+ bool have_collisions = true;
+
+ while (have_collisions) {
+ // compute collision list
+ std::set<std::string> collisionSet;
+ std::map<std::string, std::string> short2full;
+ have_collisions = false;
+ for (const auto& it : uniquePath2level) {
+ std::string u = it.first;
+ int n = it.second;
+ std::string shortName = cut(u, n);
+ auto p = short2full.find(shortName);
+ if (p == short2full.end()) {
+ // no collision
+ short2full[shortName] = u;
+ } else {
+ // we have a collision, add the two paths to the collision set
+ have_collisions = true;
+ collisionSet.insert(u);
+ collisionSet.insert(p->second);
+ }
+ }
+ for (const auto& s : collisionSet)
+ uniquePath2level[s]++; // increase level of colliding path
+ }
+
+ for (const auto& it : uniquePath2level) {
+ std::string u = it.first;
+ int n = it.second;
+ std::string shortName = replaceCharList(cut(u, n), {'/'}, '_');
+ fFull2Short[unique2full[u]] = shortName;
+ }
+ }
+
+ std::string replaceCharList(const std::string& str, const std::vector<char>& ch1,
+ char ch2)
+ {
+ auto beg = ch1.begin();
+ auto end = ch1.end();
+ std::string res = str;
+ for (size_t i = 0; i < str.length(); ++i) {
+ if (std::find(beg, end, str[i]) != end)
+ res[i] = ch2;
+ }
+ return res;
+ }
public:
PathBuilder() {}
virtual ~PathBuilder() {}
+ // Return true for the first level of groups
+ bool pushLabel(const std::string& label)
+ {
+ fControlsLevel.push_back(label);
+ return fControlsLevel.size() == 1;
+ }
+
+ // Return true for the last level of groups
+ bool popLabel()
+ {
+ fControlsLevel.pop_back();
+ return fControlsLevel.size() == 0;
+ }
+
std::string buildPath(const std::string& label)
{
std::string res = "/";
for (size_t i = 0; i < fControlsLevel.size(); i++) {
- res += fControlsLevel[i];
- res += "/";
+ res = res + fControlsLevel[i] + "/";
}
res += label;
- std::replace(res.begin(), res.end(), ' ', '_');
- return res;
+ return replaceCharList(
+ res, {' ', '#', '*', ',', '?', '[', ']', '{', '}', '(', ')'}, '_');
}
-
- std::string buildLabel(std::string label)
- {
- std::replace(label.begin(), label.end(), ' ', '_');
- return label;
- }
-
- void pushLabel(const std::string& label) { fControlsLevel.push_back(label); }
- void popLabel() { fControlsLevel.pop_back(); }
};
-#endif // FAUST_PATHBUILDER_H
+#endif // __PathBuilder__
/************************** END PathBuilder.h **************************/
-/************************** BEGIN ValueConverter.h **************************/
-/************************************************************************
+/************************** BEGIN ValueConverter.h ********************
FAUST Architecture File
- Copyright (C) 2003-2017 GRAME, Centre National de Creation Musicale
+ Copyright (C) 2003-2022 GRAME, Centre National de Creation Musicale
---------------------------------------------------------------------
- This Architecture section is free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 3 of
- the License, or (at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; If not, see <http://www.gnu.org/licenses/>.
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
EXCEPTION : As a special exception, you may create a larger work
that contains this FAUST architecture section and distribute
that work under terms of your choice, so long as this FAUST
architecture section is not modified.
- ************************************************************************/
+ ********************************************************************/
#ifndef __ValueConverter__
#define __ValueConverter__
/***************************************************************************************
- ValueConverter.h
- (GRAME, Copyright 2015-2019)
+ ValueConverter.h
+ (GRAME, Copyright 2015-2019)
-Set of conversion objects used to map user interface values (for example a gui slider
-delivering values between 0 and 1) to faust values (for example a vslider between
-20 and 20000) using a log scale.
+ Set of conversion objects used to map user interface values (for example a gui slider
+ delivering values between 0 and 1) to faust values (for example a vslider between
+ 20 and 20000) using a log scale.
--- Utilities
+ -- Utilities
-Range(lo,hi) : clip a value x between lo and hi
-Interpolator(lo,hi,v1,v2) : Maps a value x between lo and hi to a value y between v1 and
+ Range(lo,hi) : clip a value x between lo and hi
+ Interpolator(lo,hi,v1,v2) : Maps a value x between lo and hi to a value y between v1 and
v2 Interpolator3pt(lo,mi,hi,v1,vm,v2) : Map values between lo mid hi to values between v1
vm v2
--- Value Converters
+ -- Value Converters
-ValueConverter::ui2faust(x)
-ValueConverter::faust2ui(x)
+ ValueConverter::ui2faust(x)
+ ValueConverter::faust2ui(x)
--- ValueConverters used for sliders depending of the scale
+ -- ValueConverters used for sliders depending of the scale
-LinearValueConverter(umin, umax, fmin, fmax)
-LinearValueConverter2(lo, mi, hi, v1, vm, v2) using 2 segments
-LogValueConverter(umin, umax, fmin, fmax)
-ExpValueConverter(umin, umax, fmin, fmax)
+ LinearValueConverter(umin, umax, fmin, fmax)
+ LinearValueConverter2(lo, mi, hi, v1, vm, v2) using 2 segments
+ LogValueConverter(umin, umax, fmin, fmax)
+ ExpValueConverter(umin, umax, fmin, fmax)
--- ValueConverters used for accelerometers based on 3 points
+ -- ValueConverters used for accelerometers based on 3 points
-AccUpConverter(amin, amid, amax, fmin, fmid, fmax) -- curve 0
-AccDownConverter(amin, amid, amax, fmin, fmid, fmax) -- curve 1
-AccUpDownConverter(amin, amid, amax, fmin, fmid, fmax) -- curve 2
-AccDownUpConverter(amin, amid, amax, fmin, fmid, fmax) -- curve 3
+ AccUpConverter(amin, amid, amax, fmin, fmid, fmax) -- curve 0
+ AccDownConverter(amin, amid, amax, fmin, fmid, fmax) -- curve 1
+ AccUpDownConverter(amin, amid, amax, fmin, fmid, fmax) -- curve 2
+ AccDownUpConverter(amin, amid, amax, fmin, fmid, fmax) -- curve 3
--- lists of ZoneControl are used to implement accelerometers metadata for each axes
+ -- lists of ZoneControl are used to implement accelerometers metadata for each axes
-ZoneControl(zone, valueConverter) : a zone with an accelerometer data converter
+ ZoneControl(zone, valueConverter) : a zone with an accelerometer data converter
--- ZoneReader are used to implement screencolor metadata
+ -- ZoneReader are used to implement screencolor metadata
-ZoneReader(zone, valueConverter) : a zone with a data converter
+ ZoneReader(zone, valueConverter) : a zone with a data converter
****************************************************************************************/
+#include <assert.h>
+#include <float.h>
+
#include <algorithm> // std::max
-#include <cassert>
-#include <cfloat>
#include <cmath>
#include <vector>
@@ -552,12 +838,12 @@ ZoneReader(zone, valueConverter) : a zone with a data converter
// Interpolator(lo,hi,v1,v2)
// Maps a value x between lo and hi to a value y between v1 and v2
// y = v1 + (x-lo)/(hi-lo)*(v2-v1)
-// y = v1 + (x-lo) * coef with coef = (v2-v1)/(hi-lo)
+// y = v1 + (x-lo) * coef with coef = (v2-v1)/(hi-lo)
// y = v1 + x*coef - lo*coef
// y = v1 - lo*coef + x*coef
-// y = offset + x*coef with offset = v1 - lo*coef
+// y = offset + x*coef with offset = v1 - lo*coef
//--------------------------------------------------------------------------------------
-class Interpolator
+class FAUST_API Interpolator
{
private:
//--------------------------------------------------------------------------------------
@@ -608,7 +894,7 @@ class Interpolator
// Interpolator3pt(lo,mi,hi,v1,vm,v2)
// Map values between lo mid hi to values between v1 vm v2
//--------------------------------------------------------------------------------------
-class Interpolator3pt
+class FAUST_API Interpolator3pt
{
private:
Interpolator fSegment1;
@@ -632,19 +918,19 @@ class Interpolator3pt
//--------------------------------------------------------------------------------------
// Abstract ValueConverter class. Converts values between UI and Faust representations
//--------------------------------------------------------------------------------------
-class ValueConverter
+class FAUST_API ValueConverter
{
public:
virtual ~ValueConverter() {}
- virtual double ui2faust(double x) = 0;
- virtual double faust2ui(double x) = 0;
+ virtual double ui2faust(double x) { return x; };
+ virtual double faust2ui(double x) { return x; };
};
//--------------------------------------------------------------------------------------
// A converter than can be updated
//--------------------------------------------------------------------------------------
-class UpdatableValueConverter : public ValueConverter
+class FAUST_API UpdatableValueConverter : public ValueConverter
{
protected:
bool fActive;
@@ -664,7 +950,7 @@ class UpdatableValueConverter : public ValueConverter
//--------------------------------------------------------------------------------------
// Linear conversion between ui and Faust values
//--------------------------------------------------------------------------------------
-class LinearValueConverter : public ValueConverter
+class FAUST_API LinearValueConverter : public ValueConverter
{
private:
Interpolator fUI2F;
@@ -684,7 +970,7 @@ class LinearValueConverter : public ValueConverter
//--------------------------------------------------------------------------------------
// Two segments linear conversion between ui and Faust values
//--------------------------------------------------------------------------------------
-class LinearValueConverter2 : public UpdatableValueConverter
+class FAUST_API LinearValueConverter2 : public UpdatableValueConverter
{
private:
Interpolator3pt fUI2F;
@@ -720,7 +1006,7 @@ class LinearValueConverter2 : public UpdatableValueConverter
//--------------------------------------------------------------------------------------
// Logarithmic conversion between ui and Faust values
//--------------------------------------------------------------------------------------
-class LogValueConverter : public LinearValueConverter
+class FAUST_API LogValueConverter : public LinearValueConverter
{
public:
LogValueConverter(double umin, double umax, double fmin, double fmax)
@@ -742,7 +1028,7 @@ class LogValueConverter : public LinearValueConverter
//--------------------------------------------------------------------------------------
// Exponential conversion between ui and Faust values
//--------------------------------------------------------------------------------------
-class ExpValueConverter : public LinearValueConverter
+class FAUST_API ExpValueConverter : public LinearValueConverter
{
public:
ExpValueConverter(double umin, double umax, double fmin, double fmax)
@@ -765,7 +1051,7 @@ class ExpValueConverter : public LinearValueConverter
// Convert accelerometer or gyroscope values to Faust values
// Using an Up curve (curve 0)
//--------------------------------------------------------------------------------------
-class AccUpConverter : public UpdatableValueConverter
+class FAUST_API AccUpConverter : public UpdatableValueConverter
{
private:
Interpolator3pt fA2F;
@@ -801,7 +1087,7 @@ class AccUpConverter : public UpdatableValueConverter
// Convert accelerometer or gyroscope values to Faust values
// Using a Down curve (curve 1)
//--------------------------------------------------------------------------------------
-class AccDownConverter : public UpdatableValueConverter
+class FAUST_API AccDownConverter : public UpdatableValueConverter
{
private:
Interpolator3pt fA2F;
@@ -837,14 +1123,14 @@ class AccDownConverter : public UpdatableValueConverter
// Convert accelerometer or gyroscope values to Faust values
// Using an Up-Down curve (curve 2)
//--------------------------------------------------------------------------------------
-class AccUpDownConverter : public UpdatableValueConverter
+class FAUST_API AccUpDownConverter : public UpdatableValueConverter
{
private:
Interpolator3pt fA2F;
Interpolator fF2A;
public:
- AccUpDownConverter(double amin, double amid, double amax, double fmin, double fmid,
+ AccUpDownConverter(double amin, double amid, double amax, double fmin, double /*fmid*/,
double fmax)
: fA2F(amin, amid, amax, fmin, fmax, fmin)
, fF2A(fmin, fmax, amin,
@@ -856,7 +1142,7 @@ class AccUpDownConverter : public UpdatableValueConverter
virtual double faust2ui(double x) { return fF2A(x); }
virtual void setMappingValues(double amin, double amid, double amax, double fmin,
- double fmid, double fmax)
+ double /*fmid*/, double fmax)
{
//__android_log_print(ANDROID_LOG_ERROR, "Faust", "AccUpDownConverter update %f %f
//%f %f %f %f", amin,amid,amax,fmin,fmid,fmax);
@@ -874,14 +1160,14 @@ class AccUpDownConverter : public UpdatableValueConverter
// Convert accelerometer or gyroscope values to Faust values
// Using a Down-Up curve (curve 3)
//--------------------------------------------------------------------------------------
-class AccDownUpConverter : public UpdatableValueConverter
+class FAUST_API AccDownUpConverter : public UpdatableValueConverter
{
private:
Interpolator3pt fA2F;
Interpolator fF2A;
public:
- AccDownUpConverter(double amin, double amid, double amax, double fmin, double fmid,
+ AccDownUpConverter(double amin, double amid, double amax, double fmin, double /*fmid*/,
double fmax)
: fA2F(amin, amid, amax, fmax, fmin, fmax)
, fF2A(fmin, fmax, amin,
@@ -893,7 +1179,7 @@ class AccDownUpConverter : public UpdatableValueConverter
virtual double faust2ui(double x) { return fF2A(x); }
virtual void setMappingValues(double amin, double amid, double amax, double fmin,
- double fmid, double fmax)
+ double /*fmid*/, double fmax)
{
//__android_log_print(ANDROID_LOG_ERROR, "Faust", "AccDownUpConverter update %f %f
//%f %f %f %f", amin,amid,amax,fmin,fmid,fmax);
@@ -910,7 +1196,7 @@ class AccDownUpConverter : public UpdatableValueConverter
//--------------------------------------------------------------------------------------
// Base class for ZoneControl
//--------------------------------------------------------------------------------------
-class ZoneControl
+class FAUST_API ZoneControl
{
protected:
FAUSTFLOAT* fZone;
@@ -919,17 +1205,17 @@ class ZoneControl
ZoneControl(FAUSTFLOAT* zone) : fZone(zone) {}
virtual ~ZoneControl() {}
- virtual void update(double v) const {}
+ virtual void update(double /*v*/) const {}
- virtual void setMappingValues(int curve, double amin, double amid, double amax,
- double min, double init, double max)
+ virtual void setMappingValues(int /*curve*/, double /*amin*/, double /*amid*/, double /*amax*/,
+ double /*min*/, double /*init*/, double /*max*/)
{
}
- virtual void getMappingValues(double& amin, double& amid, double& amax) {}
+ virtual void getMappingValues(double& /*amin*/, double& /*amid*/, double& /*amax*/) {}
FAUSTFLOAT* getZone() { return fZone; }
- virtual void setActive(bool on_off) {}
+ virtual void setActive(bool /*on_off*/) {}
virtual bool getActive() { return false; }
virtual int getCurve() { return -1; }
@@ -938,7 +1224,7 @@ class ZoneControl
//--------------------------------------------------------------------------------------
// Useful to implement accelerometers metadata as a list of ZoneControl for each axes
//--------------------------------------------------------------------------------------
-class ConverterZoneControl : public ZoneControl
+class FAUST_API ConverterZoneControl : public ZoneControl
{
protected:
ValueConverter* fValueConverter;
@@ -953,7 +1239,10 @@ class ConverterZoneControl : public ZoneControl
delete fValueConverter;
} // Assuming fValueConverter is not kept elsewhere...
- virtual void update(double v) const { *fZone = fValueConverter->ui2faust(v); }
+ virtual void update(double v) const
+ {
+ *fZone = FAUSTFLOAT(fValueConverter->ui2faust(v));
+ }
ValueConverter* getConverter() { return fValueConverter; }
};
@@ -962,7 +1251,7 @@ class ConverterZoneControl : public ZoneControl
// Association of a zone and a four value converter, each one for each possible curve.
// Useful to implement accelerometers metadata as a list of ZoneControl for each axes
//--------------------------------------------------------------------------------------
-class CurveZoneControl : public ZoneControl
+class FAUST_API CurveZoneControl : public ZoneControl
{
private:
std::vector<UpdatableValueConverter*> fValueConverters;
@@ -985,15 +1274,14 @@ class CurveZoneControl : public ZoneControl
}
virtual ~CurveZoneControl()
{
- std::vector<UpdatableValueConverter*>::iterator it;
- for (it = fValueConverters.begin(); it != fValueConverters.end(); it++) {
- delete (*it);
+ for (const auto& it : fValueConverters) {
+ delete it;
}
}
void update(double v) const
{
if (fValueConverters[fCurve]->getActive())
- *fZone = fValueConverters[fCurve]->ui2faust(v);
+ *fZone = FAUSTFLOAT(fValueConverters[fCurve]->ui2faust(v));
}
void setMappingValues(int curve, double amin, double amid, double amax, double min,
@@ -1010,16 +1298,15 @@ class CurveZoneControl : public ZoneControl
void setActive(bool on_off)
{
- std::vector<UpdatableValueConverter*>::iterator it;
- for (it = fValueConverters.begin(); it != fValueConverters.end(); it++) {
- (*it)->setActive(on_off);
+ for (const auto& it : fValueConverters) {
+ it->setActive(on_off);
}
}
int getCurve() { return fCurve; }
};
-class ZoneReader
+class FAUST_API ZoneReader
{
private:
FAUSTFLOAT* fZone;
@@ -1039,6 +1326,8 @@ class ZoneReader
#endif
/************************** END ValueConverter.h **************************/
+typedef unsigned int uint;
+
class APIUI
: public PathBuilder
, public Meta
@@ -1054,22 +1343,42 @@ class APIUI
kHBargraph,
kVBargraph
};
+ enum Type { kAcc = 0, kGyr = 1, kNoType };
protected:
- enum { kLin = 0, kLog = 1, kExp = 2 };
-
- int fNumParameters;
- std::vector<std::string> fPaths;
- std::vector<std::string> fLabels;
- std::map<std::string, int> fPathMap;
- std::map<std::string, int> fLabelMap;
- std::vector<ValueConverter*> fConversion;
- std::vector<FAUSTFLOAT*> fZone;
- std::vector<FAUSTFLOAT> fInit;
- std::vector<FAUSTFLOAT> fMin;
- std::vector<FAUSTFLOAT> fMax;
- std::vector<FAUSTFLOAT> fStep;
- std::vector<ItemType> fItemType;
+ enum Mapping { kLin = 0, kLog = 1, kExp = 2 };
+
+ struct Item {
+ std::string fLabel;
+ std::string fShortname;
+ std::string fPath;
+ ValueConverter* fConversion;
+ FAUSTFLOAT* fZone;
+ FAUSTFLOAT fInit;
+ FAUSTFLOAT fMin;
+ FAUSTFLOAT fMax;
+ FAUSTFLOAT fStep;
+ ItemType fItemType;
+
+ Item(const std::string& label, const std::string& short_name,
+ const std::string& path, ValueConverter* conversion, FAUSTFLOAT* zone,
+ FAUSTFLOAT init, FAUSTFLOAT min, FAUSTFLOAT max, FAUSTFLOAT step,
+ ItemType item_type)
+ : fLabel(label)
+ , fShortname(short_name)
+ , fPath(path)
+ , fConversion(conversion)
+ , fZone(zone)
+ , fInit(init)
+ , fMin(min)
+ , fMax(max)
+ , fStep(step)
+ , fItemType(item_type)
+ {
+ }
+ };
+ std::vector<Item> fItems;
+
std::vector<std::map<std::string, std::string> > fMetaData;
std::vector<ZoneControl*> fAcc[3];
std::vector<ZoneControl*> fGyr[3];
@@ -1096,33 +1405,31 @@ class APIUI
ItemType type)
{
std::string path = buildPath(label);
- fPathMap[path] = fLabelMap[label] = fNumParameters++;
- fPaths.push_back(path);
- fLabels.push_back(label);
- fZone.push_back(zone);
- fInit.push_back(init);
- fMin.push_back(min);
- fMax.push_back(max);
- fStep.push_back(step);
- fItemType.push_back(type);
+ fFullPaths.push_back(path);
// handle scale metadata
+ ValueConverter* converter = nullptr;
switch (fCurrentScale) {
case kLin:
- fConversion.push_back(new LinearValueConverter(0, 1, min, max));
+ converter = new LinearValueConverter(0, 1, min, max);
break;
case kLog:
- fConversion.push_back(new LogValueConverter(0, 1, min, max));
+ converter = new LogValueConverter(0, 1, min, max);
break;
case kExp:
- fConversion.push_back(new ExpValueConverter(0, 1, min, max));
+ converter = new ExpValueConverter(0, 1, min, max);
break;
}
fCurrentScale = kLin;
+ fItems.push_back(
+ Item(label, "", path, converter, zone, init, min, max, step, type));
+
if (fCurrentAcc.size() > 0 && fCurrentGyr.size() > 0) {
- std::cerr << "warning : 'acc' and 'gyr' metadata used for the same " << label
- << " parameter !!\n";
+ fprintf(
+ stderr,
+ "warning : 'acc' and 'gyr' metadata used for the same %s parameter !!\n",
+ label);
}
// handle acc metadata "...[acc : <axe> <curve> <amin> <amid> <amax>]..."
@@ -1137,7 +1444,7 @@ class APIUI
fAcc[axe].push_back(
new CurveZoneControl(zone, curve, amin, amid, amax, min, init, max));
} else {
- std::cerr << "incorrect acc metadata : " << fCurrentAcc << std::endl;
+ fprintf(stderr, "incorrect acc metadata : %s \n", fCurrentAcc.c_str());
}
fCurrentAcc = "";
}
@@ -1154,31 +1461,31 @@ class APIUI
fGyr[axe].push_back(
new CurveZoneControl(zone, curve, amin, amid, amax, min, init, max));
} else {
- std::cerr << "incorrect gyr metadata : " << fCurrentGyr << std::endl;
+ fprintf(stderr, "incorrect gyr metadata : %s \n", fCurrentGyr.c_str());
}
fCurrentGyr = "";
}
// handle screencolor metadata "...[screencolor:red|green|blue|white]..."
if (fCurrentColor.size() > 0) {
- if ((fCurrentColor == "red") && (fRedReader == 0)) {
+ if ((fCurrentColor == "red") && (fRedReader == nullptr)) {
fRedReader = new ZoneReader(zone, min, max);
fHasScreenControl = true;
- } else if ((fCurrentColor == "green") && (fGreenReader == 0)) {
+ } else if ((fCurrentColor == "green") && (fGreenReader == nullptr)) {
fGreenReader = new ZoneReader(zone, min, max);
fHasScreenControl = true;
- } else if ((fCurrentColor == "blue") && (fBlueReader == 0)) {
+ } else if ((fCurrentColor == "blue") && (fBlueReader == nullptr)) {
fBlueReader = new ZoneReader(zone, min, max);
fHasScreenControl = true;
- } else if ((fCurrentColor == "white") && (fRedReader == 0)
- && (fGreenReader == 0) && (fBlueReader == 0)) {
+ } else if ((fCurrentColor == "white") && (fRedReader == nullptr)
+ && (fGreenReader == nullptr) && (fBlueReader == nullptr)) {
fRedReader = new ZoneReader(zone, min, max);
fGreenReader = new ZoneReader(zone, min, max);
fBlueReader = new ZoneReader(zone, min, max);
fHasScreenControl = true;
} else {
- std::cerr << "incorrect screencolor metadata : " << fCurrentColor
- << std::endl;
+ fprintf(stderr, "incorrect screencolor metadata : %s \n",
+ fCurrentColor.c_str());
}
}
fCurrentColor = "";
@@ -1189,7 +1496,7 @@ class APIUI
int getZoneIndex(std::vector<ZoneControl*>* table, int p, int val)
{
- FAUSTFLOAT* zone = fZone[p];
+ FAUSTFLOAT* zone = fItems[uint(p)].fZone;
for (size_t i = 0; i < table[val].size(); i++) {
if (zone == table[val][i]->getZone())
return int(i);
@@ -1206,11 +1513,11 @@ class APIUI
// Deactivates everywhere..
if (id1 != -1)
- table[0][id1]->setActive(false);
+ table[0][uint(id1)]->setActive(false);
if (id2 != -1)
- table[1][id2]->setActive(false);
+ table[1][uint(id2)]->setActive(false);
if (id3 != -1)
- table[2][id3]->setActive(false);
+ table[2][uint(id3)]->setActive(false);
if (val == -1) { // Means: no more mapping...
// So stay all deactivated...
@@ -1218,14 +1525,16 @@ class APIUI
int id4 = getZoneIndex(table, p, val);
if (id4 != -1) {
// Reactivate the one we edit...
- table[val][id4]->setMappingValues(curve, amin, amid, amax, fMin[p],
- fInit[p], fMax[p]);
- table[val][id4]->setActive(true);
+ table[val][uint(id4)]->setMappingValues(
+ curve, amin, amid, amax, fItems[uint(p)].fMin, fItems[uint(p)].fInit,
+ fItems[uint(p)].fMax);
+ table[val][uint(id4)]->setActive(true);
} else {
// Allocate a new CurveZoneControl which is 'active' by default
- FAUSTFLOAT* zone = fZone[p];
- table[val].push_back(new CurveZoneControl(zone, curve, amin, amid, amax,
- fMin[p], fInit[p], fMax[p]));
+ FAUSTFLOAT* zone = fItems[uint(p)].fZone;
+ table[val].push_back(new CurveZoneControl(
+ zone, curve, amin, amid, amax, fItems[uint(p)].fMin,
+ fItems[uint(p)].fInit, fItems[uint(p)].fMax));
}
}
}
@@ -1239,16 +1548,16 @@ class APIUI
if (id1 != -1) {
val = 0;
- curve = table[val][id1]->getCurve();
- table[val][id1]->getMappingValues(amin, amid, amax);
+ curve = table[val][uint(id1)]->getCurve();
+ table[val][uint(id1)]->getMappingValues(amin, amid, amax);
} else if (id2 != -1) {
val = 1;
- curve = table[val][id2]->getCurve();
- table[val][id2]->getMappingValues(amin, amid, amax);
+ curve = table[val][uint(id2)]->getCurve();
+ table[val][uint(id2)]->getMappingValues(amin, amid, amax);
} else if (id3 != -1) {
val = 2;
- curve = table[val][id3]->getCurve();
- table[val][id3]->getMappingValues(amin, amid, amax);
+ curve = table[val][uint(id3)]->getCurve();
+ table[val][uint(id3)]->getMappingValues(amin, amid, amax);
} else {
val = -1; // No mapping
curve = 0;
@@ -1259,26 +1568,23 @@ class APIUI
}
public:
- enum Type { kAcc = 0, kGyr = 1, kNoType };
-
APIUI()
- : fNumParameters(0)
- , fHasScreenControl(false)
- , fRedReader(0)
- , fGreenReader(0)
- , fBlueReader(0)
+ : fHasScreenControl(false)
+ , fRedReader(nullptr)
+ , fGreenReader(nullptr)
+ , fBlueReader(nullptr)
, fCurrentScale(kLin)
{
}
virtual ~APIUI()
{
- for (auto& it : fConversion)
- delete it;
+ for (const auto& it : fItems)
+ delete it.fConversion;
for (int i = 0; i < 3; i++) {
- for (auto& it : fAcc[i])
+ for (const auto& it : fAcc[i])
delete it;
- for (auto& it : fGyr[i])
+ for (const auto& it : fGyr[i])
delete it;
}
delete fRedReader;
@@ -1291,7 +1597,18 @@ class APIUI
virtual void openTabBox(const char* label) { pushLabel(label); }
virtual void openHorizontalBox(const char* label) { pushLabel(label); }
virtual void openVerticalBox(const char* label) { pushLabel(label); }
- virtual void closeBox() { popLabel(); }
+ virtual void closeBox()
+ {
+ if (popLabel()) {
+ // Shortnames can be computed when all fullnames are known
+ computeShortNames();
+ // Fill 'shortname' field for each item
+ for (const auto& it : fFull2Short) {
+ int index = getParamIndex(it.first.c_str());
+ fItems[index].fShortname = it.second;
+ }
+ }
+ }
// -- active widgets
@@ -1328,25 +1645,25 @@ class APIUI
virtual void addHorizontalBargraph(const char* label, FAUSTFLOAT* zone,
FAUSTFLOAT min, FAUSTFLOAT max)
{
- addParameter(label, zone, min, min, max, (max - min) / 1000.0, kHBargraph);
+ addParameter(label, zone, min, min, max, (max - min) / 1000.0f, kHBargraph);
}
virtual void addVerticalBargraph(const char* label, FAUSTFLOAT* zone, FAUSTFLOAT min,
FAUSTFLOAT max)
{
- addParameter(label, zone, min, min, max, (max - min) / 1000.0, kVBargraph);
+ addParameter(label, zone, min, min, max, (max - min) / 1000.0f, kVBargraph);
}
// -- soundfiles
- virtual void addSoundfile(const char* label, const char* filename,
- Soundfile** sf_zone)
+ virtual void addSoundfile(const char* /*label*/, const char* /*filename*/,
+ Soundfile** /*sf_zone*/)
{
}
// -- metadata declarations
- virtual void declare(FAUSTFLOAT* zone, const char* key, const char* val)
+ virtual void declare(FAUSTFLOAT* /*zone*/, const char* key, const char* val)
{
// Keep metadata
fCurrentMetadata[key] = val;
@@ -1372,29 +1689,31 @@ class APIUI
}
}
- virtual void declare(const char* key, const char* val) {}
+ virtual void declare(const char* /*key*/, const char* /*val*/) {}
//-------------------------------------------------------------------------------
// Simple API part
//-------------------------------------------------------------------------------
- int getParamsCount() { return fNumParameters; }
- int getParamIndex(const char* path)
+ int getParamsCount() { return int(fItems.size()); }
+
+ int getParamIndex(const char* path_aux)
{
- if (fPathMap.find(path) != fPathMap.end()) {
- return fPathMap[path];
- } else if (fLabelMap.find(path) != fLabelMap.end()) {
- return fLabelMap[path];
- } else {
- return -1;
- }
+ std::string path = std::string(path_aux);
+ auto it = find_if(fItems.begin(), fItems.end(), [=](const Item& it) {
+ return (it.fLabel == path) || (it.fShortname == path) || (it.fPath == path);
+ });
+ return (it != fItems.end()) ? int(it - fItems.begin()) : -1;
}
- const char* getParamAddress(int p) { return fPaths[p].c_str(); }
- const char* getParamLabel(int p) { return fLabels[p].c_str(); }
+
+ const char* getParamLabel(int p) { return fItems[uint(p)].fLabel.c_str(); }
+ const char* getParamShortname(int p) { return fItems[uint(p)].fShortname.c_str(); }
+ const char* getParamAddress(int p) { return fItems[uint(p)].fPath.c_str(); }
+
std::map<const char*, const char*> getMetadata(int p)
{
std::map<const char*, const char*> res;
- std::map<std::string, std::string> metadata = fMetaData[p];
- for (auto it : metadata) {
+ std::map<std::string, std::string> metadata = fMetaData[uint(p)];
+ for (const auto& it : metadata) {
res[it.first.c_str()] = it.second.c_str();
}
return res;
@@ -1402,26 +1721,62 @@ class APIUI
const char* getMetadata(int p, const char* key)
{
- return (fMetaData[p].find(key) != fMetaData[p].end()) ? fMetaData[p][key].c_str()
- : "";
+ return (fMetaData[uint(p)].find(key) != fMetaData[uint(p)].end())
+ ? fMetaData[uint(p)][key].c_str()
+ : "";
+ }
+ FAUSTFLOAT getParamMin(int p) { return fItems[uint(p)].fMin; }
+ FAUSTFLOAT getParamMax(int p) { return fItems[uint(p)].fMax; }
+ FAUSTFLOAT getParamStep(int p) { return fItems[uint(p)].fStep; }
+ FAUSTFLOAT getParamInit(int p) { return fItems[uint(p)].fInit; }
+
+ FAUSTFLOAT* getParamZone(int p) { return fItems[uint(p)].fZone; }
+
+ FAUSTFLOAT getParamValue(int p) { return *fItems[uint(p)].fZone; }
+ FAUSTFLOAT getParamValue(const char* path)
+ {
+ int index = getParamIndex(path);
+ if (index >= 0) {
+ return getParamValue(index);
+ } else {
+ fprintf(stderr, "getParamValue : '%s' not found\n",
+ (path == nullptr ? "NULL" : path));
+ return FAUSTFLOAT(0);
+ }
}
- FAUSTFLOAT getParamMin(int p) { return fMin[p]; }
- FAUSTFLOAT getParamMax(int p) { return fMax[p]; }
- FAUSTFLOAT getParamStep(int p) { return fStep[p]; }
- FAUSTFLOAT getParamInit(int p) { return fInit[p]; }
- FAUSTFLOAT* getParamZone(int p) { return fZone[p]; }
- FAUSTFLOAT getParamValue(int p) { return *fZone[p]; }
- void setParamValue(int p, FAUSTFLOAT v) { *fZone[p] = v; }
+ void setParamValue(int p, FAUSTFLOAT v) { *fItems[uint(p)].fZone = v; }
+ void setParamValue(const char* path, FAUSTFLOAT v)
+ {
+ int index = getParamIndex(path);
+ if (index >= 0) {
+ setParamValue(index, v);
+ } else {
+ fprintf(stderr, "setParamValue : '%s' not found\n",
+ (path == nullptr ? "NULL" : path));
+ }
+ }
- double getParamRatio(int p) { return fConversion[p]->faust2ui(*fZone[p]); }
- void setParamRatio(int p, double r) { *fZone[p] = fConversion[p]->ui2faust(r); }
+ double getParamRatio(int p)
+ {
+ return fItems[uint(p)].fConversion->faust2ui(*fItems[uint(p)].fZone);
+ }
+ void setParamRatio(int p, double r)
+ {
+ *fItems[uint(p)].fZone = FAUSTFLOAT(fItems[uint(p)].fConversion->ui2faust(r));
+ }
- double value2ratio(int p, double r) { return fConversion[p]->faust2ui(r); }
- double ratio2value(int p, double r) { return fConversion[p]->ui2faust(r); }
+ double value2ratio(int p, double r)
+ {
+ return fItems[uint(p)].fConversion->faust2ui(r);
+ }
+ double ratio2value(int p, double r)
+ {
+ return fItems[uint(p)].fConversion->ui2faust(r);
+ }
/**
- * Return the control type (kAcc, kGyr, or -1) for a given parameter
+ * Return the control type (kAcc, kGyr, or -1) for a given parameter.
*
* @param p - the UI parameter index
*
@@ -1443,13 +1798,13 @@ class APIUI
/**
* Return the Item type (kButton = 0, kCheckButton, kVSlider, kHSlider, kNumEntry,
- * kHBargraph, kVBargraph) for a given parameter
+ * kHBargraph, kVBargraph) for a given parameter.
*
* @param p - the UI parameter index
*
* @return the Item type
*/
- ItemType getParamItemType(int p) { return fItemType[p]; }
+ ItemType getParamItemType(int p) { return fItems[uint(p)].fItemType; }
/**
* Set a new value coming from an accelerometer, propagate it to all relevant
@@ -1489,7 +1844,7 @@ class APIUI
* given UI parameter.
*
* @param p - the UI parameter index
- * @param acc - 0 for X gyroscope, 1 for Y gyroscope, 2 for Z gyroscope (-1 means "no
+ * @param gyr - 0 for X gyroscope, 1 for Y gyroscope, 2 for Z gyroscope (-1 means "no
* mapping")
* @param curve - between 0 and 3
* @param amin - mapping 'min' point
@@ -1554,7 +1909,7 @@ class APIUI
}
/**
- * Get the number of FAUSTFLOAT* zones controlled with the accelerometer
+ * Get the number of FAUSTFLOAT* zones controlled with the accelerometer.
*
* @param acc - 0 for X accelerometer, 1 for Y accelerometer, 2 for Z accelerometer
* @return the number of zones
@@ -1563,7 +1918,7 @@ class APIUI
int getAccCount(int acc) { return (acc >= 0 && acc < 3) ? int(fAcc[acc].size()) : 0; }
/**
- * Get the number of FAUSTFLOAT* zones controlled with the gyroscope
+ * Get the number of FAUSTFLOAT* zones controlled with the gyroscope.
*
* @param gyr - 0 for X gyroscope, 1 for Y gyroscope, 2 for Z gyroscope
* @param the number of zones
@@ -1600,13 +1955,11 @@ class APIUI
#define FAUSTFLOAT float
#endif
+#include <math.h>
+
#include <algorithm>
#include <cmath>
-
-static float zitarevmonodsp_faustpower2_f(float value)
-{
- return (value * value);
-}
+#include <cstdint>
#ifndef FAUSTCLASS
#define FAUSTCLASS zitarevmonodsp
@@ -1617,108 +1970,104 @@ static float zitarevmonodsp_faustpower2_f(float value)
#define exp10 __exp10
#endif
+#if defined(_WIN32)
+#define RESTRICT __restrict
+#else
+#define RESTRICT __restrict__
+#endif
+
+static float zitarevmonodsp_faustpower2_f(float value)
+{
+ return value * value;
+}
+
class zitarevmonodsp : public dsp
{
private:
- int IOTA;
+ int IOTA0;
float fVec0[16384];
+ int fSampleRate;
+ float fConst1;
FAUSTFLOAT fVslider0;
+ float fConst2;
float fRec0[2];
FAUSTFLOAT fVslider1;
float fRec1[2];
- int fSampleRate;
- float fConst0;
- float fConst1;
+ float fConst3;
FAUSTFLOAT fVslider2;
FAUSTFLOAT fVslider3;
FAUSTFLOAT fVslider4;
FAUSTFLOAT fVslider5;
- float fConst2;
- float fConst3;
+ float fConst5;
FAUSTFLOAT fVslider6;
FAUSTFLOAT fVslider7;
FAUSTFLOAT fVslider8;
- float fConst4;
+ float fConst6;
FAUSTFLOAT fVslider9;
float fRec15[2];
float fRec14[2];
float fVec1[32768];
- float fConst5;
- int iConst6;
- float fConst7;
+ int iConst8;
+ float fConst9;
FAUSTFLOAT fVslider10;
float fVec2[2048];
- int iConst8;
+ int iConst10;
float fRec12[2];
- float fConst9;
- float fConst10;
+ float fConst12;
float fRec19[2];
float fRec18[2];
float fVec3[32768];
- float fConst11;
- int iConst12;
+ int iConst14;
float fVec4[4096];
- int iConst13;
+ int iConst15;
float fRec16[2];
- float fConst14;
- float fConst15;
+ float fConst17;
float fRec23[2];
float fRec22[2];
float fVec5[16384];
- float fConst16;
- int iConst17;
+ int iConst19;
float fVec6[4096];
- int iConst18;
+ int iConst20;
float fRec20[2];
- float fConst19;
- float fConst20;
+ float fConst22;
float fRec27[2];
float fRec26[2];
float fVec7[32768];
- float fConst21;
- int iConst22;
+ int iConst24;
float fVec8[4096];
- int iConst23;
+ int iConst25;
float fRec24[2];
- float fConst24;
- float fConst25;
+ float fConst27;
float fRec31[2];
float fRec30[2];
float fVec9[16384];
- float fConst26;
- int iConst27;
+ int iConst29;
float fVec10[2048];
- int iConst28;
+ int iConst30;
float fRec28[2];
- float fConst29;
- float fConst30;
+ float fConst32;
float fRec35[2];
float fRec34[2];
float fVec11[16384];
- float fConst31;
- int iConst32;
+ int iConst34;
float fVec12[4096];
- int iConst33;
+ int iConst35;
float fRec32[2];
- float fConst34;
- float fConst35;
+ float fConst37;
float fRec39[2];
float fRec38[2];
float fVec13[16384];
- float fConst36;
- int iConst37;
+ int iConst39;
float fVec14[4096];
- int iConst38;
+ int iConst40;
float fRec36[2];
- float fConst39;
- float fConst40;
+ float fConst42;
float fRec43[2];
float fRec42[2];
float fVec15[16384];
- float fConst41;
- int iConst42;
+ int iConst44;
float fVec16[2048];
- int iConst43;
+ int iConst45;
float fRec40[2];
float fRec4[3];
float fRec5[3];
@@ -1737,7 +2086,10 @@ class zitarevmonodsp : public dsp
void metadata(Meta* m)
{
m->declare("basics.lib/name", "Faust Basic Element Library");
- m->declare("basics.lib/version", "0.1");
+ m->declare("basics.lib/version", "0.8");
+ m->declare("compile_options",
+ "-a faust2header.cpp -lang cpp -i -inpl -cn zitarevmonodsp -es 1 -mcd "
+ "16 -single -ftz 0");
m->declare("delays.lib/name", "Faust Delay Library");
m->declare("delays.lib/version", "0.1");
m->declare("filename", "zitarevmonodsp.dsp");
@@ -1784,119 +2136,87 @@ class zitarevmonodsp : public dsp
"filters.lib/tf2:copyright",
"Copyright (C) 2003-2019 by Julius O. Smith III <jos@ccrma.stanford.edu>");
m->declare("filters.lib/tf2:license", "MIT-style STK-4.3 license");
+ m->declare("filters.lib/version", "0.3");
m->declare("maths.lib/author", "GRAME");
m->declare("maths.lib/copyright", "GRAME");
m->declare("maths.lib/license", "LGPL with exception");
m->declare("maths.lib/name", "Faust Math Library");
- m->declare("maths.lib/version", "2.3");
+ m->declare("maths.lib/version", "2.5");
m->declare("name", "zitarevmonodsp");
m->declare("platform.lib/name", "Generic Platform Library");
- m->declare("platform.lib/version", "0.1");
+ m->declare("platform.lib/version", "0.2");
m->declare("reverbs.lib/name", "Faust Reverb Library");
- m->declare("reverbs.lib/version", "0.0");
+ m->declare("reverbs.lib/version", "0.2");
+ m->declare("routes.lib/hadamard:author", "Remy Muller, revised by Romain Michon");
m->declare("routes.lib/name", "Faust Signal Routing Library");
m->declare("routes.lib/version", "0.2");
m->declare("signals.lib/name", "Faust Signal Routing Library");
- m->declare("signals.lib/version", "0.0");
+ m->declare("signals.lib/version", "0.3");
}
virtual int getNumInputs() { return 1; }
virtual int getNumOutputs() { return 1; }
- virtual int getInputRate(int channel)
- {
- int rate;
- switch ((channel)) {
- case 0: {
- rate = 1;
- break;
- }
- default: {
- rate = -1;
- break;
- }
- }
- return rate;
- }
- virtual int getOutputRate(int channel)
- {
- int rate;
- switch ((channel)) {
- case 0: {
- rate = 1;
- break;
- }
- default: {
- rate = -1;
- break;
- }
- }
- return rate;
- }
static void classInit(int /*sample_rate*/) {}
virtual void instanceConstants(int sample_rate)
{
fSampleRate = sample_rate;
- fConst0 = std::min<float>(192000.0f, std::max<float>(1.0f, float(fSampleRate)));
- fConst1 = (6.28318548f / fConst0);
- fConst2 = std::floor(((0.219990999f * fConst0) + 0.5f));
- fConst3 = ((0.0f - (6.90775537f * fConst2)) / fConst0);
- fConst4 = (3.14159274f / fConst0);
- fConst5 = std::floor(((0.0191229992f * fConst0) + 0.5f));
- iConst6 =
- int(std::min<float>(16384.0f, std::max<float>(0.0f, (fConst2 - fConst5))));
- fConst7 = (0.00100000005f * fConst0);
- iConst8 = int(std::min<float>(1024.0f, std::max<float>(0.0f, (fConst5 + -1.0f))));
- fConst9 = std::floor(((0.256891012f * fConst0) + 0.5f));
- fConst10 = ((0.0f - (6.90775537f * fConst9)) / fConst0);
- fConst11 = std::floor(((0.0273330007f * fConst0) + 0.5f));
- iConst12 =
- int(std::min<float>(16384.0f, std::max<float>(0.0f, (fConst9 - fConst11))));
- iConst13 =
- int(std::min<float>(2048.0f, std::max<float>(0.0f, (fConst11 + -1.0f))));
- fConst14 = std::floor(((0.192303002f * fConst0) + 0.5f));
- fConst15 = ((0.0f - (6.90775537f * fConst14)) / fConst0);
- fConst16 = std::floor(((0.0292910002f * fConst0) + 0.5f));
- iConst17 =
- int(std::min<float>(8192.0f, std::max<float>(0.0f, (fConst14 - fConst16))));
- iConst18 =
- int(std::min<float>(2048.0f, std::max<float>(0.0f, (fConst16 + -1.0f))));
- fConst19 = std::floor(((0.210389003f * fConst0) + 0.5f));
- fConst20 = ((0.0f - (6.90775537f * fConst19)) / fConst0);
- fConst21 = std::floor(((0.0244210009f * fConst0) + 0.5f));
- iConst22 =
- int(std::min<float>(16384.0f, std::max<float>(0.0f, (fConst19 - fConst21))));
- iConst23 =
- int(std::min<float>(2048.0f, std::max<float>(0.0f, (fConst21 + -1.0f))));
- fConst24 = std::floor(((0.125f * fConst0) + 0.5f));
- fConst25 = ((0.0f - (6.90775537f * fConst24)) / fConst0);
- fConst26 = std::floor(((0.0134579996f * fConst0) + 0.5f));
- iConst27 =
- int(std::min<float>(8192.0f, std::max<float>(0.0f, (fConst24 - fConst26))));
- iConst28 =
- int(std::min<float>(1024.0f, std::max<float>(0.0f, (fConst26 + -1.0f))));
- fConst29 = std::floor(((0.127837002f * fConst0) + 0.5f));
- fConst30 = ((0.0f - (6.90775537f * fConst29)) / fConst0);
- fConst31 = std::floor(((0.0316039994f * fConst0) + 0.5f));
- iConst32 =
- int(std::min<float>(8192.0f, std::max<float>(0.0f, (fConst29 - fConst31))));
- iConst33 =
- int(std::min<float>(2048.0f, std::max<float>(0.0f, (fConst31 + -1.0f))));
- fConst34 = std::floor(((0.174713001f * fConst0) + 0.5f));
- fConst35 = ((0.0f - (6.90775537f * fConst34)) / fConst0);
- fConst36 = std::floor(((0.0229039993f * fConst0) + 0.5f));
- iConst37 =
- int(std::min<float>(8192.0f, std::max<float>(0.0f, (fConst34 - fConst36))));
- iConst38 =
- int(std::min<float>(2048.0f, std::max<float>(0.0f, (fConst36 + -1.0f))));
- fConst39 = std::floor(((0.153128996f * fConst0) + 0.5f));
- fConst40 = ((0.0f - (6.90775537f * fConst39)) / fConst0);
- fConst41 = std::floor(((0.0203460008f * fConst0) + 0.5f));
- iConst42 =
- int(std::min<float>(8192.0f, std::max<float>(0.0f, (fConst39 - fConst41))));
- iConst43 =
- int(std::min<float>(1024.0f, std::max<float>(0.0f, (fConst41 + -1.0f))));
+ float fConst0 =
+ std::min<float>(192000.0f, std::max<float>(1.0f, float(fSampleRate)));
+ fConst1 = 44.0999985f / fConst0;
+ fConst2 = 1.0f - fConst1;
+ fConst3 = 6.28318548f / fConst0;
+ float fConst4 = std::floor(0.219990999f * fConst0 + 0.5f);
+ fConst5 = (0.0f - 6.90775537f * fConst4) / fConst0;
+ fConst6 = 3.14159274f / fConst0;
+ float fConst7 = std::floor(0.0191229992f * fConst0 + 0.5f);
+ iConst8 =
+ int(std::min<float>(16384.0f, std::max<float>(0.0f, fConst4 - fConst7)));
+ fConst9 = 0.00100000005f * fConst0;
+ iConst10 = int(std::min<float>(1024.0f, std::max<float>(0.0f, fConst7 + -1.0f)));
+ float fConst11 = std::floor(0.256891012f * fConst0 + 0.5f);
+ fConst12 = (0.0f - 6.90775537f * fConst11) / fConst0;
+ float fConst13 = std::floor(0.0273330007f * fConst0 + 0.5f);
+ iConst14 =
+ int(std::min<float>(16384.0f, std::max<float>(0.0f, fConst11 - fConst13)));
+ iConst15 = int(std::min<float>(2048.0f, std::max<float>(0.0f, fConst13 + -1.0f)));
+ float fConst16 = std::floor(0.192303002f * fConst0 + 0.5f);
+ fConst17 = (0.0f - 6.90775537f * fConst16) / fConst0;
+ float fConst18 = std::floor(0.0292910002f * fConst0 + 0.5f);
+ iConst19 =
+ int(std::min<float>(8192.0f, std::max<float>(0.0f, fConst16 - fConst18)));
+ iConst20 = int(std::min<float>(2048.0f, std::max<float>(0.0f, fConst18 + -1.0f)));
+ float fConst21 = std::floor(0.210389003f * fConst0 + 0.5f);
+ fConst22 = (0.0f - 6.90775537f * fConst21) / fConst0;
+ float fConst23 = std::floor(0.0244210009f * fConst0 + 0.5f);
+ iConst24 =
+ int(std::min<float>(16384.0f, std::max<float>(0.0f, fConst21 - fConst23)));
+ iConst25 = int(std::min<float>(2048.0f, std::max<float>(0.0f, fConst23 + -1.0f)));
+ float fConst26 = std::floor(0.125f * fConst0 + 0.5f);
+ fConst27 = (0.0f - 6.90775537f * fConst26) / fConst0;
+ float fConst28 = std::floor(0.0134579996f * fConst0 + 0.5f);
+ iConst29 =
+ int(std::min<float>(8192.0f, std::max<float>(0.0f, fConst26 - fConst28)));
+ iConst30 = int(std::min<float>(1024.0f, std::max<float>(0.0f, fConst28 + -1.0f)));
+ float fConst31 = std::floor(0.127837002f * fConst0 + 0.5f);
+ fConst32 = (0.0f - 6.90775537f * fConst31) / fConst0;
+ float fConst33 = std::floor(0.0316039994f * fConst0 + 0.5f);
+ iConst34 =
+ int(std::min<float>(8192.0f, std::max<float>(0.0f, fConst31 - fConst33)));
+ iConst35 = int(std::min<float>(2048.0f, std::max<float>(0.0f, fConst33 + -1.0f)));
+ float fConst36 = std::floor(0.174713001f * fConst0 + 0.5f);
+ fConst37 = (0.0f - 6.90775537f * fConst36) / fConst0;
+ float fConst38 = std::floor(0.0229039993f * fConst0 + 0.5f);
+ iConst39 =
+ int(std::min<float>(8192.0f, std::max<float>(0.0f, fConst36 - fConst38)));
+ iConst40 = int(std::min<float>(2048.0f, std::max<float>(0.0f, fConst38 + -1.0f)));
+ float fConst41 = std::floor(0.153128996f * fConst0 + 0.5f);
+ fConst42 = (0.0f - 6.90775537f * fConst41) / fConst0;
+ float fConst43 = std::floor(0.0203460008f * fConst0 + 0.5f);
+ iConst44 =
+ int(std::min<float>(8192.0f, std::max<float>(0.0f, fConst41 - fConst43)));
+ iConst45 = int(std::min<float>(1024.0f, std::max<float>(0.0f, fConst43 + -1.0f)));
}
virtual void instanceResetUserInterface()
@@ -1916,170 +2236,170 @@ class zitarevmonodsp : public dsp
virtual void instanceClear()
{
- IOTA = 0;
- for (int l0 = 0; (l0 < 16384); l0 = (l0 + 1)) {
+ IOTA0 = 0;
+ for (int l0 = 0; l0 < 16384; l0 = l0 + 1) {
fVec0[l0] = 0.0f;
}
- for (int l1 = 0; (l1 < 2); l1 = (l1 + 1)) {
+ for (int l1 = 0; l1 < 2; l1 = l1 + 1) {
fRec0[l1] = 0.0f;
}
- for (int l2 = 0; (l2 < 2); l2 = (l2 + 1)) {
+ for (int l2 = 0; l2 < 2; l2 = l2 + 1) {
fRec1[l2] = 0.0f;
}
- for (int l3 = 0; (l3 < 2); l3 = (l3 + 1)) {
+ for (int l3 = 0; l3 < 2; l3 = l3 + 1) {
fRec15[l3] = 0.0f;
}
- for (int l4 = 0; (l4 < 2); l4 = (l4 + 1)) {
+ for (int l4 = 0; l4 < 2; l4 = l4 + 1) {
fRec14[l4] = 0.0f;
}
- for (int l5 = 0; (l5 < 32768); l5 = (l5 + 1)) {
+ for (int l5 = 0; l5 < 32768; l5 = l5 + 1) {
fVec1[l5] = 0.0f;
}
- for (int l6 = 0; (l6 < 2048); l6 = (l6 + 1)) {
+ for (int l6 = 0; l6 < 2048; l6 = l6 + 1) {
fVec2[l6] = 0.0f;
}
- for (int l7 = 0; (l7 < 2); l7 = (l7 + 1)) {
+ for (int l7 = 0; l7 < 2; l7 = l7 + 1) {
fRec12[l7] = 0.0f;
}
- for (int l8 = 0; (l8 < 2); l8 = (l8 + 1)) {
+ for (int l8 = 0; l8 < 2; l8 = l8 + 1) {
fRec19[l8] = 0.0f;
}
- for (int l9 = 0; (l9 < 2); l9 = (l9 + 1)) {
+ for (int l9 = 0; l9 < 2; l9 = l9 + 1) {
fRec18[l9] = 0.0f;
}
- for (int l10 = 0; (l10 < 32768); l10 = (l10 + 1)) {
+ for (int l10 = 0; l10 < 32768; l10 = l10 + 1) {
fVec3[l10] = 0.0f;
}
- for (int l11 = 0; (l11 < 4096); l11 = (l11 + 1)) {
+ for (int l11 = 0; l11 < 4096; l11 = l11 + 1) {
fVec4[l11] = 0.0f;
}
- for (int l12 = 0; (l12 < 2); l12 = (l12 + 1)) {
+ for (int l12 = 0; l12 < 2; l12 = l12 + 1) {
fRec16[l12] = 0.0f;
}
- for (int l13 = 0; (l13 < 2); l13 = (l13 + 1)) {
+ for (int l13 = 0; l13 < 2; l13 = l13 + 1) {
fRec23[l13] = 0.0f;
}
- for (int l14 = 0; (l14 < 2); l14 = (l14 + 1)) {
+ for (int l14 = 0; l14 < 2; l14 = l14 + 1) {
fRec22[l14] = 0.0f;
}
- for (int l15 = 0; (l15 < 16384); l15 = (l15 + 1)) {
+ for (int l15 = 0; l15 < 16384; l15 = l15 + 1) {
fVec5[l15] = 0.0f;
}
- for (int l16 = 0; (l16 < 4096); l16 = (l16 + 1)) {
+ for (int l16 = 0; l16 < 4096; l16 = l16 + 1) {
fVec6[l16] = 0.0f;
}
- for (int l17 = 0; (l17 < 2); l17 = (l17 + 1)) {
+ for (int l17 = 0; l17 < 2; l17 = l17 + 1) {
fRec20[l17] = 0.0f;
}
- for (int l18 = 0; (l18 < 2); l18 = (l18 + 1)) {
+ for (int l18 = 0; l18 < 2; l18 = l18 + 1) {
fRec27[l18] = 0.0f;
}
- for (int l19 = 0; (l19 < 2); l19 = (l19 + 1)) {
+ for (int l19 = 0; l19 < 2; l19 = l19 + 1) {
fRec26[l19] = 0.0f;
}
- for (int l20 = 0; (l20 < 32768); l20 = (l20 + 1)) {
+ for (int l20 = 0; l20 < 32768; l20 = l20 + 1) {
fVec7[l20] = 0.0f;
}
- for (int l21 = 0; (l21 < 4096); l21 = (l21 + 1)) {
+ for (int l21 = 0; l21 < 4096; l21 = l21 + 1) {
fVec8[l21] = 0.0f;
}
- for (int l22 = 0; (l22 < 2); l22 = (l22 + 1)) {
+ for (int l22 = 0; l22 < 2; l22 = l22 + 1) {
fRec24[l22] = 0.0f;
}
- for (int l23 = 0; (l23 < 2); l23 = (l23 + 1)) {
+ for (int l23 = 0; l23 < 2; l23 = l23 + 1) {
fRec31[l23] = 0.0f;
}
- for (int l24 = 0; (l24 < 2); l24 = (l24 + 1)) {
+ for (int l24 = 0; l24 < 2; l24 = l24 + 1) {
fRec30[l24] = 0.0f;
}
- for (int l25 = 0; (l25 < 16384); l25 = (l25 + 1)) {
+ for (int l25 = 0; l25 < 16384; l25 = l25 + 1) {
fVec9[l25] = 0.0f;
}
- for (int l26 = 0; (l26 < 2048); l26 = (l26 + 1)) {
+ for (int l26 = 0; l26 < 2048; l26 = l26 + 1) {
fVec10[l26] = 0.0f;
}
- for (int l27 = 0; (l27 < 2); l27 = (l27 + 1)) {
+ for (int l27 = 0; l27 < 2; l27 = l27 + 1) {
fRec28[l27] = 0.0f;
}
- for (int l28 = 0; (l28 < 2); l28 = (l28 + 1)) {
+ for (int l28 = 0; l28 < 2; l28 = l28 + 1) {
fRec35[l28] = 0.0f;
}
- for (int l29 = 0; (l29 < 2); l29 = (l29 + 1)) {
+ for (int l29 = 0; l29 < 2; l29 = l29 + 1) {
fRec34[l29] = 0.0f;
}
- for (int l30 = 0; (l30 < 16384); l30 = (l30 + 1)) {
+ for (int l30 = 0; l30 < 16384; l30 = l30 + 1) {
fVec11[l30] = 0.0f;
}
- for (int l31 = 0; (l31 < 4096); l31 = (l31 + 1)) {
+ for (int l31 = 0; l31 < 4096; l31 = l31 + 1) {
fVec12[l31] = 0.0f;
}
- for (int l32 = 0; (l32 < 2); l32 = (l32 + 1)) {
+ for (int l32 = 0; l32 < 2; l32 = l32 + 1) {
fRec32[l32] = 0.0f;
}
- for (int l33 = 0; (l33 < 2); l33 = (l33 + 1)) {
+ for (int l33 = 0; l33 < 2; l33 = l33 + 1) {
fRec39[l33] = 0.0f;
}
- for (int l34 = 0; (l34 < 2); l34 = (l34 + 1)) {
+ for (int l34 = 0; l34 < 2; l34 = l34 + 1) {
fRec38[l34] = 0.0f;
}
- for (int l35 = 0; (l35 < 16384); l35 = (l35 + 1)) {
+ for (int l35 = 0; l35 < 16384; l35 = l35 + 1) {
fVec13[l35] = 0.0f;
}
- for (int l36 = 0; (l36 < 4096); l36 = (l36 + 1)) {
+ for (int l36 = 0; l36 < 4096; l36 = l36 + 1) {
fVec14[l36] = 0.0f;
}
- for (int l37 = 0; (l37 < 2); l37 = (l37 + 1)) {
+ for (int l37 = 0; l37 < 2; l37 = l37 + 1) {
fRec36[l37] = 0.0f;
}
- for (int l38 = 0; (l38 < 2); l38 = (l38 + 1)) {
+ for (int l38 = 0; l38 < 2; l38 = l38 + 1) {
fRec43[l38] = 0.0f;
}
- for (int l39 = 0; (l39 < 2); l39 = (l39 + 1)) {
+ for (int l39 = 0; l39 < 2; l39 = l39 + 1) {
fRec42[l39] = 0.0f;
}
- for (int l40 = 0; (l40 < 16384); l40 = (l40 + 1)) {
+ for (int l40 = 0; l40 < 16384; l40 = l40 + 1) {
fVec15[l40] = 0.0f;
}
- for (int l41 = 0; (l41 < 2048); l41 = (l41 + 1)) {
+ for (int l41 = 0; l41 < 2048; l41 = l41 + 1) {
fVec16[l41] = 0.0f;
}
- for (int l42 = 0; (l42 < 2); l42 = (l42 + 1)) {
+ for (int l42 = 0; l42 < 2; l42 = l42 + 1) {
fRec40[l42] = 0.0f;
}
- for (int l43 = 0; (l43 < 3); l43 = (l43 + 1)) {
+ for (int l43 = 0; l43 < 3; l43 = l43 + 1) {
fRec4[l43] = 0.0f;
}
- for (int l44 = 0; (l44 < 3); l44 = (l44 + 1)) {
+ for (int l44 = 0; l44 < 3; l44 = l44 + 1) {
fRec5[l44] = 0.0f;
}
- for (int l45 = 0; (l45 < 3); l45 = (l45 + 1)) {
+ for (int l45 = 0; l45 < 3; l45 = l45 + 1) {
fRec6[l45] = 0.0f;
}
- for (int l46 = 0; (l46 < 3); l46 = (l46 + 1)) {
+ for (int l46 = 0; l46 < 3; l46 = l46 + 1) {
fRec7[l46] = 0.0f;
}
- for (int l47 = 0; (l47 < 3); l47 = (l47 + 1)) {
+ for (int l47 = 0; l47 < 3; l47 = l47 + 1) {
fRec8[l47] = 0.0f;
}
- for (int l48 = 0; (l48 < 3); l48 = (l48 + 1)) {
+ for (int l48 = 0; l48 < 3; l48 = l48 + 1) {
fRec9[l48] = 0.0f;
}
- for (int l49 = 0; (l49 < 3); l49 = (l49 + 1)) {
+ for (int l49 = 0; l49 < 3; l49 = l49 + 1) {
fRec10[l49] = 0.0f;
}
- for (int l50 = 0; (l50 < 3); l50 = (l50 + 1)) {
+ for (int l50 = 0; l50 < 3; l50 = l50 + 1) {
fRec11[l50] = 0.0f;
}
- for (int l51 = 0; (l51 < 3); l51 = (l51 + 1)) {
+ for (int l51 = 0; l51 < 3; l51 = l51 + 1) {
fRec3[l51] = 0.0f;
}
- for (int l52 = 0; (l52 < 3); l52 = (l52 + 1)) {
+ for (int l52 = 0; l52 < 3; l52 = l52 + 1) {
fRec2[l52] = 0.0f;
}
- for (int l53 = 0; (l53 < 3); l53 = (l53 + 1)) {
+ for (int l53 = 0; l53 < 3; l53 = l53 + 1) {
fRec45[l53] = 0.0f;
}
- for (int l54 = 0; (l54 < 3); l54 = (l54 + 1)) {
+ for (int l54 = 0; l54 < 3; l54 = l54 + 1) {
fRec44[l54] = 0.0f;
}
}
@@ -2115,8 +2435,9 @@ class zitarevmonodsp : public dsp
ui_interface->declare(&fVslider10, "tooltip",
"Delay in ms before reverberation begins");
ui_interface->declare(&fVslider10, "unit", "ms");
- ui_interface->addVerticalSlider("In Delay", &fVslider10, 60.0f, 20.0f, 100.0f,
- 1.0f);
+ ui_interface->addVerticalSlider("In Delay", &fVslider10, FAUSTFLOAT(60.0f),
+ FAUSTFLOAT(20.0f), FAUSTFLOAT(100.0f),
+ FAUSTFLOAT(1.0f));
ui_interface->closeBox();
ui_interface->declare(0, "2", "");
ui_interface->openHorizontalBox("Decay Times in Bands (see tooltips)");
@@ -2127,7 +2448,9 @@ class zitarevmonodsp : public dsp
&fVslider9, "tooltip",
"Crossover frequency (Hz) separating low and middle frequencies");
ui_interface->declare(&fVslider9, "unit", "Hz");
- ui_interface->addVerticalSlider("LF X", &fVslider9, 200.0f, 50.0f, 1000.0f, 1.0f);
+ ui_interface->addVerticalSlider("LF X", &fVslider9, FAUSTFLOAT(200.0f),
+ FAUSTFLOAT(50.0f), FAUSTFLOAT(1000.0f),
+ FAUSTFLOAT(1.0f));
ui_interface->declare(&fVslider8, "2", "");
ui_interface->declare(&fVslider8, "scale", "log");
ui_interface->declare(&fVslider8, "style", "knob");
@@ -2135,16 +2458,18 @@ class zitarevmonodsp : public dsp
&fVslider8, "tooltip",
"T60 = time (in seconds) to decay 60dB in low-frequency band");
ui_interface->declare(&fVslider8, "unit", "s");
- ui_interface->addVerticalSlider("Low RT60", &fVslider8, 3.0f, 1.0f, 8.0f,
- 0.100000001f);
+ ui_interface->addVerticalSlider("Low RT60", &fVslider8, FAUSTFLOAT(3.0f),
+ FAUSTFLOAT(1.0f), FAUSTFLOAT(8.0f),
+ FAUSTFLOAT(0.100000001f));
ui_interface->declare(&fVslider6, "3", "");
ui_interface->declare(&fVslider6, "scale", "log");
ui_interface->declare(&fVslider6, "style", "knob");
ui_interface->declare(&fVslider6, "tooltip",
"T60 = time (in seconds) to decay 60dB in middle band");
ui_interface->declare(&fVslider6, "unit", "s");
- ui_interface->addVerticalSlider("Mid RT60", &fVslider6, 2.0f, 1.0f, 8.0f,
- 0.100000001f);
+ ui_interface->addVerticalSlider("Mid RT60", &fVslider6, FAUSTFLOAT(2.0f),
+ FAUSTFLOAT(1.0f), FAUSTFLOAT(8.0f),
+ FAUSTFLOAT(0.100000001f));
ui_interface->declare(&fVslider7, "4", "");
ui_interface->declare(&fVslider7, "scale", "log");
ui_interface->declare(&fVslider7, "style", "knob");
@@ -2152,8 +2477,9 @@ class zitarevmonodsp : public dsp
"Frequency (Hz) at which the high-frequency T60 is half "
"the middle-band's T60");
ui_interface->declare(&fVslider7, "unit", "Hz");
- ui_interface->addVerticalSlider("HF Damping", &fVslider7, 6000.0f, 1500.0f,
- 23520.0f, 1.0f);
+ ui_interface->addVerticalSlider("HF Damping", &fVslider7, FAUSTFLOAT(6000.0f),
+ FAUSTFLOAT(1500.0f), FAUSTFLOAT(23520.0f),
+ FAUSTFLOAT(1.0f));
ui_interface->closeBox();
ui_interface->declare(0, "3", "");
ui_interface->openHorizontalBox("RM Peaking Equalizer 1");
@@ -2164,16 +2490,18 @@ class zitarevmonodsp : public dsp
&fVslider4, "tooltip",
"Center-frequency of second-order Regalia-Mitra peaking equalizer section 1");
ui_interface->declare(&fVslider4, "unit", "Hz");
- ui_interface->addVerticalSlider("Eq1 Freq", &fVslider4, 315.0f, 40.0f, 2500.0f,
- 1.0f);
+ ui_interface->addVerticalSlider("Eq1 Freq", &fVslider4, FAUSTFLOAT(315.0f),
+ FAUSTFLOAT(40.0f), FAUSTFLOAT(2500.0f),
+ FAUSTFLOAT(1.0f));
ui_interface->declare(&fVslider5, "2", "");
ui_interface->declare(&fVslider5, "style", "knob");
ui_interface->declare(&fVslider5, "tooltip",
"Peak level in dB of second-order Regalia-Mitra peaking "
"equalizer section 1");
ui_interface->declare(&fVslider5, "unit", "dB");
- ui_interface->addVerticalSlider("Eq1 Level", &fVslider5, 0.0f, -15.0f, 15.0f,
- 0.100000001f);
+ ui_interface->addVerticalSlider("Eq1 Level", &fVslider5, FAUSTFLOAT(0.0f),
+ FAUSTFLOAT(-15.0f), FAUSTFLOAT(15.0f),
+ FAUSTFLOAT(0.100000001f));
ui_interface->closeBox();
ui_interface->declare(0, "4", "");
ui_interface->openHorizontalBox("RM Peaking Equalizer 2");
@@ -2184,30 +2512,34 @@ class zitarevmonodsp : public dsp
&fVslider2, "tooltip",
"Center-frequency of second-order Regalia-Mitra peaking equalizer section 2");
ui_interface->declare(&fVslider2, "unit", "Hz");
- ui_interface->addVerticalSlider("Eq2 Freq", &fVslider2, 1500.0f, 160.0f, 10000.0f,
- 1.0f);
+ ui_interface->addVerticalSlider("Eq2 Freq", &fVslider2, FAUSTFLOAT(1500.0f),
+ FAUSTFLOAT(160.0f), FAUSTFLOAT(10000.0f),
+ FAUSTFLOAT(1.0f));
ui_interface->declare(&fVslider3, "2", "");
ui_interface->declare(&fVslider3, "style", "knob");
ui_interface->declare(&fVslider3, "tooltip",
"Peak level in dB of second-order Regalia-Mitra peaking "
"equalizer section 2");
ui_interface->declare(&fVslider3, "unit", "dB");
- ui_interface->addVerticalSlider("Eq2 Level", &fVslider3, 0.0f, -15.0f, 15.0f,
- 0.100000001f);
+ ui_interface->addVerticalSlider("Eq2 Level", &fVslider3, FAUSTFLOAT(0.0f),
+ FAUSTFLOAT(-15.0f), FAUSTFLOAT(15.0f),
+ FAUSTFLOAT(0.100000001f));
ui_interface->closeBox();
ui_interface->declare(0, "5", "");
ui_interface->openHorizontalBox("Output");
ui_interface->declare(&fVslider1, "1", "");
ui_interface->declare(&fVslider1, "style", "knob");
ui_interface->declare(&fVslider1, "tooltip", "Dry/Wet Mix: 0 = dry, 1 = wet");
- ui_interface->addVerticalSlider("Wet", &fVslider1, 0.0f, 0.0f, 1.0f,
- 0.00999999978f);
+ ui_interface->addVerticalSlider("Wet", &fVslider1, FAUSTFLOAT(0.0f),
+ FAUSTFLOAT(0.0f), FAUSTFLOAT(1.0f),
+ FAUSTFLOAT(0.00999999978f));
ui_interface->declare(&fVslider0, "2", "");
ui_interface->declare(&fVslider0, "style", "knob");
ui_interface->declare(&fVslider0, "tooltip", "Output scale factor");
ui_interface->declare(&fVslider0, "unit", "dB");
- ui_interface->addVerticalSlider("Level", &fVslider0, -3.0f, -70.0f, 20.0f,
- 0.100000001f);
+ ui_interface->addVerticalSlider("Level", &fVslider0, FAUSTFLOAT(-3.0f),
+ FAUSTFLOAT(-70.0f), FAUSTFLOAT(20.0f),
+ FAUSTFLOAT(0.100000001f));
ui_interface->closeBox();
ui_interface->closeBox();
}
@@ -2216,365 +2548,310 @@ class zitarevmonodsp : public dsp
{
FAUSTFLOAT* input0 = inputs[0];
FAUSTFLOAT* output0 = outputs[0];
- float fSlow0 =
- (0.00100000005f * std::pow(10.0f, (0.0500000007f * float(fVslider0))));
- float fSlow1 = (0.00100000005f * float(fVslider1));
- float fSlow2 = float(fVslider2);
- float fSlow3 = std::pow(10.0f, (0.0500000007f * float(fVslider3)));
- float fSlow4 = (fConst1 * (fSlow2 / std::sqrt(std::max<float>(0.0f, fSlow3))));
- float fSlow5 = ((1.0f - fSlow4) / (fSlow4 + 1.0f));
- float fSlow6 = float(fVslider4);
- float fSlow7 = std::pow(10.0f, (0.0500000007f * float(fVslider5)));
- float fSlow8 = (fConst1 * (fSlow6 / std::sqrt(std::max<float>(0.0f, fSlow7))));
- float fSlow9 = ((1.0f - fSlow8) / (fSlow8 + 1.0f));
- float fSlow10 = float(fVslider6);
- float fSlow11 = std::exp((fConst3 / fSlow10));
- float fSlow12 = zitarevmonodsp_faustpower2_f(fSlow11);
- float fSlow13 = std::cos((fConst1 * float(fVslider7)));
- float fSlow14 = (1.0f - (fSlow12 * fSlow13));
- float fSlow15 = (1.0f - fSlow12);
- float fSlow16 = (fSlow14 / fSlow15);
- float fSlow17 =
- std::sqrt(std::max<float>(0.0f, ((zitarevmonodsp_faustpower2_f(fSlow14)
- / zitarevmonodsp_faustpower2_f(fSlow15))
- + -1.0f)));
- float fSlow18 = (fSlow16 - fSlow17);
- float fSlow19 = (fSlow11 * (fSlow17 + (1.0f - fSlow16)));
- float fSlow20 = float(fVslider8);
- float fSlow21 = ((std::exp((fConst3 / fSlow20)) / fSlow11) + -1.0f);
- float fSlow22 = (1.0f / std::tan((fConst4 * float(fVslider9))));
- float fSlow23 = (1.0f / (fSlow22 + 1.0f));
- float fSlow24 = (1.0f - fSlow22);
- int iSlow25 = int(std::min<float>(
- 8192.0f, std::max<float>(0.0f, (fConst7 * float(fVslider10)))));
- float fSlow26 = std::exp((fConst10 / fSlow10));
+ float fSlow0 = fConst1 * std::pow(10.0f, 0.0500000007f * float(fVslider0));
+ float fSlow1 = fConst1 * float(fVslider1);
+ float fSlow2 = float(fVslider2);
+ float fSlow3 = std::pow(10.0f, 0.0500000007f * float(fVslider3));
+ float fSlow4 = fConst3 * fSlow2 / std::sqrt(std::max<float>(0.0f, fSlow3));
+ float fSlow5 = (1.0f - fSlow4) / (fSlow4 + 1.0f);
+ float fSlow6 = float(fVslider4);
+ float fSlow7 = std::pow(10.0f, 0.0500000007f * float(fVslider5));
+ float fSlow8 = fConst3 * fSlow6 / std::sqrt(std::max<float>(0.0f, fSlow7));
+ float fSlow9 = (1.0f - fSlow8) / (fSlow8 + 1.0f);
+ float fSlow10 = float(fVslider6);
+ float fSlow11 = std::exp(fConst5 / fSlow10);
+ float fSlow12 = zitarevmonodsp_faustpower2_f(fSlow11);
+ float fSlow13 = std::cos(fConst3 * float(fVslider7));
+ float fSlow14 = 1.0f - fSlow12 * fSlow13;
+ float fSlow15 = 1.0f - fSlow12;
+ float fSlow16 = std::sqrt(std::max<float>(
+ 0.0f,
+ zitarevmonodsp_faustpower2_f(fSlow14) / zitarevmonodsp_faustpower2_f(fSlow15)
+ + -1.0f));
+ float fSlow17 = fSlow14 / fSlow15;
+ float fSlow18 = fSlow11 * (fSlow16 + 1.0f - fSlow17);
+ float fSlow19 = float(fVslider8);
+ float fSlow20 = std::exp(fConst5 / fSlow19) / fSlow11 + -1.0f;
+ float fSlow21 = 1.0f / std::tan(fConst6 * float(fVslider9));
+ float fSlow22 = 1.0f / (fSlow21 + 1.0f);
+ float fSlow23 = 1.0f - fSlow21;
+ float fSlow24 = fSlow17 - fSlow16;
+ int iSlow25 = int(
+ std::min<float>(8192.0f, std::max<float>(0.0f, fConst9 * float(fVslider10))));
+ float fSlow26 = std::exp(fConst12 / fSlow10);
float fSlow27 = zitarevmonodsp_faustpower2_f(fSlow26);
- float fSlow28 = (1.0f - (fSlow27 * fSlow13));
- float fSlow29 = (1.0f - fSlow27);
- float fSlow30 = (fSlow28 / fSlow29);
- float fSlow31 =
- std::sqrt(std::max<float>(0.0f, ((zitarevmonodsp_faustpower2_f(fSlow28)
- / zitarevmonodsp_faustpower2_f(fSlow29))
- + -1.0f)));
- float fSlow32 = (fSlow30 - fSlow31);
- float fSlow33 = (fSlow26 * (fSlow31 + (1.0f - fSlow30)));
- float fSlow34 = ((std::exp((fConst10 / fSlow20)) / fSlow26) + -1.0f);
- float fSlow35 = std::exp((fConst15 / fSlow10));
+ float fSlow28 = 1.0f - fSlow27 * fSlow13;
+ float fSlow29 = 1.0f - fSlow27;
+ float fSlow30 = std::sqrt(std::max<float>(
+ 0.0f,
+ zitarevmonodsp_faustpower2_f(fSlow28) / zitarevmonodsp_faustpower2_f(fSlow29)
+ + -1.0f));
+ float fSlow31 = fSlow28 / fSlow29;
+ float fSlow32 = fSlow26 * (fSlow30 + 1.0f - fSlow31);
+ float fSlow33 = std::exp(fConst12 / fSlow19) / fSlow26 + -1.0f;
+ float fSlow34 = fSlow31 - fSlow30;
+ float fSlow35 = std::exp(fConst17 / fSlow10);
float fSlow36 = zitarevmonodsp_faustpower2_f(fSlow35);
- float fSlow37 = (1.0f - (fSlow36 * fSlow13));
- float fSlow38 = (1.0f - fSlow36);
- float fSlow39 = (fSlow37 / fSlow38);
- float fSlow40 =
- std::sqrt(std::max<float>(0.0f, ((zitarevmonodsp_faustpower2_f(fSlow37)
- / zitarevmonodsp_faustpower2_f(fSlow38))
- + -1.0f)));
- float fSlow41 = (fSlow39 - fSlow40);
- float fSlow42 = (fSlow35 * (fSlow40 + (1.0f - fSlow39)));
- float fSlow43 = ((std::exp((fConst15 / fSlow20)) / fSlow35) + -1.0f);
- float fSlow44 = std::exp((fConst20 / fSlow10));
+ float fSlow37 = 1.0f - fSlow36 * fSlow13;
+ float fSlow38 = 1.0f - fSlow36;
+ float fSlow39 = std::sqrt(std::max<float>(
+ 0.0f,
+ zitarevmonodsp_faustpower2_f(fSlow37) / zitarevmonodsp_faustpower2_f(fSlow38)
+ + -1.0f));
+ float fSlow40 = fSlow37 / fSlow38;
+ float fSlow41 = fSlow35 * (fSlow39 + 1.0f - fSlow40);
+ float fSlow42 = std::exp(fConst17 / fSlow19) / fSlow35 + -1.0f;
+ float fSlow43 = fSlow40 - fSlow39;
+ float fSlow44 = std::exp(fConst22 / fSlow10);
float fSlow45 = zitarevmonodsp_faustpower2_f(fSlow44);
- float fSlow46 = (1.0f - (fSlow45 * fSlow13));
- float fSlow47 = (1.0f - fSlow45);
- float fSlow48 = (fSlow46 / fSlow47);
- float fSlow49 =
- std::sqrt(std::max<float>(0.0f, ((zitarevmonodsp_faustpower2_f(fSlow46)
- / zitarevmonodsp_faustpower2_f(fSlow47))
- + -1.0f)));
- float fSlow50 = (fSlow48 - fSlow49);
- float fSlow51 = (fSlow44 * (fSlow49 + (1.0f - fSlow48)));
- float fSlow52 = ((std::exp((fConst20 / fSlow20)) / fSlow44) + -1.0f);
- float fSlow53 = std::exp((fConst25 / fSlow10));
+ float fSlow46 = 1.0f - fSlow45 * fSlow13;
+ float fSlow47 = 1.0f - fSlow45;
+ float fSlow48 = std::sqrt(std::max<float>(
+ 0.0f,
+ zitarevmonodsp_faustpower2_f(fSlow46) / zitarevmonodsp_faustpower2_f(fSlow47)
+ + -1.0f));
+ float fSlow49 = fSlow46 / fSlow47;
+ float fSlow50 = fSlow44 * (fSlow48 + 1.0f - fSlow49);
+ float fSlow51 = std::exp(fConst22 / fSlow19) / fSlow44 + -1.0f;
+ float fSlow52 = fSlow49 - fSlow48;
+ float fSlow53 = std::exp(fConst27 / fSlow10);
float fSlow54 = zitarevmonodsp_faustpower2_f(fSlow53);
- float fSlow55 = (1.0f - (fSlow54 * fSlow13));
- float fSlow56 = (1.0f - fSlow54);
- float fSlow57 = (fSlow55 / fSlow56);
- float fSlow58 =
- std::sqrt(std::max<float>(0.0f, ((zitarevmonodsp_faustpower2_f(fSlow55)
- / zitarevmonodsp_faustpower2_f(fSlow56))
- + -1.0f)));
- float fSlow59 = (fSlow57 - fSlow58);
- float fSlow60 = (fSlow53 * (fSlow58 + (1.0f - fSlow57)));
- float fSlow61 = ((std::exp((fConst25 / fSlow20)) / fSlow53) + -1.0f);
- float fSlow62 = std::exp((fConst30 / fSlow10));
+ float fSlow55 = 1.0f - fSlow54 * fSlow13;
+ float fSlow56 = 1.0f - fSlow54;
+ float fSlow57 = std::sqrt(std::max<float>(
+ 0.0f,
+ zitarevmonodsp_faustpower2_f(fSlow55) / zitarevmonodsp_faustpower2_f(fSlow56)
+ + -1.0f));
+ float fSlow58 = fSlow55 / fSlow56;
+ float fSlow59 = fSlow53 * (fSlow57 + 1.0f - fSlow58);
+ float fSlow60 = std::exp(fConst27 / fSlow19) / fSlow53 + -1.0f;
+ float fSlow61 = fSlow58 - fSlow57;
+ float fSlow62 = std::exp(fConst32 / fSlow10);
float fSlow63 = zitarevmonodsp_faustpower2_f(fSlow62);
- float fSlow64 = (1.0f - (fSlow63 * fSlow13));
- float fSlow65 = (1.0f - fSlow63);
- float fSlow66 = (fSlow64 / fSlow65);
- float fSlow67 =
- std::sqrt(std::max<float>(0.0f, ((zitarevmonodsp_faustpower2_f(fSlow64)
- / zitarevmonodsp_faustpower2_f(fSlow65))
- + -1.0f)));
- float fSlow68 = (fSlow66 - fSlow67);
- float fSlow69 = (fSlow62 * (fSlow67 + (1.0f - fSlow66)));
- float fSlow70 = ((std::exp((fConst30 / fSlow20)) / fSlow62) + -1.0f);
- float fSlow71 = std::exp((fConst35 / fSlow10));
+ float fSlow64 = 1.0f - fSlow63 * fSlow13;
+ float fSlow65 = 1.0f - fSlow63;
+ float fSlow66 = std::sqrt(std::max<float>(
+ 0.0f,
+ zitarevmonodsp_faustpower2_f(fSlow64) / zitarevmonodsp_faustpower2_f(fSlow65)
+ + -1.0f));
+ float fSlow67 = fSlow64 / fSlow65;
+ float fSlow68 = fSlow62 * (fSlow66 + 1.0f - fSlow67);
+ float fSlow69 = std::exp(fConst32 / fSlow19) / fSlow62 + -1.0f;
+ float fSlow70 = fSlow67 - fSlow66;
+ float fSlow71 = std::exp(fConst37 / fSlow10);
float fSlow72 = zitarevmonodsp_faustpower2_f(fSlow71);
- float fSlow73 = (1.0f - (fSlow72 * fSlow13));
- float fSlow74 = (1.0f - fSlow72);
- float fSlow75 = (fSlow73 / fSlow74);
- float fSlow76 =
- std::sqrt(std::max<float>(0.0f, ((zitarevmonodsp_faustpower2_f(fSlow73)
- / zitarevmonodsp_faustpower2_f(fSlow74))
- + -1.0f)));
- float fSlow77 = (fSlow75 - fSlow76);
- float fSlow78 = (fSlow71 * (fSlow76 + (1.0f - fSlow75)));
- float fSlow79 = ((std::exp((fConst35 / fSlow20)) / fSlow71) + -1.0f);
- float fSlow80 = std::exp((fConst40 / fSlow10));
+ float fSlow73 = 1.0f - fSlow72 * fSlow13;
+ float fSlow74 = 1.0f - fSlow72;
+ float fSlow75 = std::sqrt(std::max<float>(
+ 0.0f,
+ zitarevmonodsp_faustpower2_f(fSlow73) / zitarevmonodsp_faustpower2_f(fSlow74)
+ + -1.0f));
+ float fSlow76 = fSlow73 / fSlow74;
+ float fSlow77 = fSlow71 * (fSlow75 + 1.0f - fSlow76);
+ float fSlow78 = std::exp(fConst37 / fSlow19) / fSlow71 + -1.0f;
+ float fSlow79 = fSlow76 - fSlow75;
+ float fSlow80 = std::exp(fConst42 / fSlow10);
float fSlow81 = zitarevmonodsp_faustpower2_f(fSlow80);
- float fSlow82 = (1.0f - (fSlow81 * fSlow13));
- float fSlow83 = (1.0f - fSlow81);
- float fSlow84 = (fSlow82 / fSlow83);
- float fSlow85 =
- std::sqrt(std::max<float>(0.0f, ((zitarevmonodsp_faustpower2_f(fSlow82)
- / zitarevmonodsp_faustpower2_f(fSlow83))
- + -1.0f)));
- float fSlow86 = (fSlow84 - fSlow85);
- float fSlow87 = (fSlow80 * (fSlow85 + (1.0f - fSlow84)));
- float fSlow88 = ((std::exp((fConst40 / fSlow20)) / fSlow80) + -1.0f);
- float fSlow89 = (0.0f - (std::cos((fConst1 * fSlow6)) * (fSlow9 + 1.0f)));
- float fSlow90 = (0.0f - (std::cos((fConst1 * fSlow2)) * (fSlow5 + 1.0f)));
- for (int i = 0; (i < count); i = (i + 1)) {
- float fTemp0 = float(input0[i]);
- fVec0[(IOTA & 16383)] = fTemp0;
- fRec0[0] = (fSlow0 + (0.999000013f * fRec0[1]));
- fRec1[0] = (fSlow1 + (0.999000013f * fRec1[1]));
- fRec15[0] =
- (0.0f - (fSlow23 * ((fSlow24 * fRec15[1]) - (fRec11[1] + fRec11[2]))));
- fRec14[0] =
- ((fSlow18 * fRec14[1]) + (fSlow19 * (fRec11[1] + (fSlow21 * fRec15[0]))));
- fVec1[(IOTA & 32767)] = ((0.353553385f * fRec14[0]) + 9.99999968e-21f);
- float fTemp1 = (0.300000012f * fVec0[((IOTA - iSlow25) & 16383)]);
+ float fSlow82 = 1.0f - fSlow81 * fSlow13;
+ float fSlow83 = 1.0f - fSlow81;
+ float fSlow84 = std::sqrt(std::max<float>(
+ 0.0f,
+ zitarevmonodsp_faustpower2_f(fSlow82) / zitarevmonodsp_faustpower2_f(fSlow83)
+ + -1.0f));
+ float fSlow85 = fSlow82 / fSlow83;
+ float fSlow86 = fSlow80 * (fSlow84 + 1.0f - fSlow85);
+ float fSlow87 = std::exp(fConst42 / fSlow19) / fSlow80 + -1.0f;
+ float fSlow88 = fSlow85 - fSlow84;
+ float fSlow89 = 0.0f - std::cos(fConst3 * fSlow6) * (fSlow9 + 1.0f);
+ float fSlow90 = 0.0f - std::cos(fConst3 * fSlow2) * (fSlow5 + 1.0f);
+ for (int i0 = 0; i0 < count; i0 = i0 + 1) {
+ float fTemp0 = float(input0[i0]);
+ fVec0[IOTA0 & 16383] = fTemp0;
+ fRec0[0] = fSlow0 + fConst2 * fRec0[1];
+ fRec1[0] = fSlow1 + fConst2 * fRec1[1];
+ fRec15[0] = 0.0f - fSlow22 * (fSlow23 * fRec15[1] - (fRec11[1] + fRec11[2]));
+ fRec14[0] = fSlow18 * (fRec11[1] + fSlow20 * fRec15[0]) + fSlow24 * fRec14[1];
+ fVec1[IOTA0 & 32767] = 0.353553385f * fRec14[0] + 9.99999968e-21f;
+ float fTemp1 = 0.300000012f * fVec0[(IOTA0 - iSlow25) & 16383];
float fTemp2 =
- (((0.600000024f * fRec12[1]) + fVec1[((IOTA - iConst6) & 32767)])
- - fTemp1);
- fVec2[(IOTA & 2047)] = fTemp2;
- fRec12[0] = fVec2[((IOTA - iConst8) & 2047)];
- float fRec13 = (0.0f - (0.600000024f * fTemp2));
- fRec19[0] =
- (0.0f - (fSlow23 * ((fSlow24 * fRec19[1]) - (fRec7[1] + fRec7[2]))));
- fRec18[0] =
- ((fSlow32 * fRec18[1]) + (fSlow33 * (fRec7[1] + (fSlow34 * fRec19[0]))));
- fVec3[(IOTA & 32767)] = ((0.353553385f * fRec18[0]) + 9.99999968e-21f);
+ (0.600000024f * fRec12[1] + fVec1[(IOTA0 - iConst8) & 32767]) - fTemp1;
+ fVec2[IOTA0 & 2047] = fTemp2;
+ fRec12[0] = fVec2[(IOTA0 - iConst10) & 2047];
+ float fRec13 = 0.0f - 0.600000024f * fTemp2;
+ fRec19[0] = 0.0f - fSlow22 * (fSlow23 * fRec19[1] - (fRec7[1] + fRec7[2]));
+ fRec18[0] = fSlow32 * (fRec7[1] + fSlow33 * fRec19[0]) + fSlow34 * fRec18[1];
+ fVec3[IOTA0 & 32767] = 0.353553385f * fRec18[0] + 9.99999968e-21f;
float fTemp3 =
- (((0.600000024f * fRec16[1]) + fVec3[((IOTA - iConst12) & 32767)])
- - fTemp1);
- fVec4[(IOTA & 4095)] = fTemp3;
- fRec16[0] = fVec4[((IOTA - iConst13) & 4095)];
- float fRec17 = (0.0f - (0.600000024f * fTemp3));
- fRec23[0] =
- (0.0f - (fSlow23 * ((fSlow24 * fRec23[1]) - (fRec9[1] + fRec9[2]))));
- fRec22[0] =
- ((fSlow41 * fRec22[1]) + (fSlow42 * (fRec9[1] + (fSlow43 * fRec23[0]))));
- fVec5[(IOTA & 16383)] = ((0.353553385f * fRec22[0]) + 9.99999968e-21f);
- float fTemp4 = (fVec5[((IOTA - iConst17) & 16383)]
- + (fTemp1 + (0.600000024f * fRec20[1])));
- fVec6[(IOTA & 4095)] = fTemp4;
- fRec20[0] = fVec6[((IOTA - iConst18) & 4095)];
- float fRec21 = (0.0f - (0.600000024f * fTemp4));
- fRec27[0] =
- (0.0f - (fSlow23 * ((fSlow24 * fRec27[1]) - (fRec5[1] + fRec5[2]))));
- fRec26[0] =
- ((fSlow50 * fRec26[1]) + (fSlow51 * (fRec5[1] + (fSlow52 * fRec27[0]))));
- fVec7[(IOTA & 32767)] = ((0.353553385f * fRec26[0]) + 9.99999968e-21f);
- float fTemp5 = (fVec7[((IOTA - iConst22) & 32767)]
- + (fTemp1 + (0.600000024f * fRec24[1])));
- fVec8[(IOTA & 4095)] = fTemp5;
- fRec24[0] = fVec8[((IOTA - iConst23) & 4095)];
- float fRec25 = (0.0f - (0.600000024f * fTemp5));
- fRec31[0] =
- (0.0f - (fSlow23 * ((fSlow24 * fRec31[1]) - (fRec10[1] + fRec10[2]))));
- fRec30[0] =
- ((fSlow59 * fRec30[1]) + (fSlow60 * (fRec10[1] + (fSlow61 * fRec31[0]))));
- fVec9[(IOTA & 16383)] = ((0.353553385f * fRec30[0]) + 9.99999968e-21f);
- float fTemp6 = (fVec9[((IOTA - iConst27) & 16383)]
- - (fTemp1 + (0.600000024f * fRec28[1])));
- fVec10[(IOTA & 2047)] = fTemp6;
- fRec28[0] = fVec10[((IOTA - iConst28) & 2047)];
- float fRec29 = (0.600000024f * fTemp6);
- fRec35[0] =
- (0.0f - (fSlow23 * ((fSlow24 * fRec35[1]) - (fRec6[1] + fRec6[2]))));
- fRec34[0] =
- ((fSlow68 * fRec34[1]) + (fSlow69 * (fRec6[1] + (fSlow70 * fRec35[0]))));
- fVec11[(IOTA & 16383)] = ((0.353553385f * fRec34[0]) + 9.99999968e-21f);
- float fTemp7 = (fVec11[((IOTA - iConst32) & 16383)]
- - (fTemp1 + (0.600000024f * fRec32[1])));
- fVec12[(IOTA & 4095)] = fTemp7;
- fRec32[0] = fVec12[((IOTA - iConst33) & 4095)];
- float fRec33 = (0.600000024f * fTemp7);
- fRec39[0] =
- (0.0f - (fSlow23 * ((fSlow24 * fRec39[1]) - (fRec8[1] + fRec8[2]))));
- fRec38[0] =
- ((fSlow77 * fRec38[1]) + (fSlow78 * (fRec8[1] + (fSlow79 * fRec39[0]))));
- fVec13[(IOTA & 16383)] = ((0.353553385f * fRec38[0]) + 9.99999968e-21f);
- float fTemp8 = ((fTemp1 + fVec13[((IOTA - iConst37) & 16383)])
- - (0.600000024f * fRec36[1]));
- fVec14[(IOTA & 4095)] = fTemp8;
- fRec36[0] = fVec14[((IOTA - iConst38) & 4095)];
- float fRec37 = (0.600000024f * fTemp8);
- fRec43[0] =
- (0.0f - (fSlow23 * ((fSlow24 * fRec43[1]) - (fRec4[1] + fRec4[2]))));
- fRec42[0] =
- ((fSlow86 * fRec42[1]) + (fSlow87 * (fRec4[1] + (fSlow88 * fRec43[0]))));
- fVec15[(IOTA & 16383)] = ((0.353553385f * fRec42[0]) + 9.99999968e-21f);
- float fTemp9 = ((fVec15[((IOTA - iConst42) & 16383)] + fTemp1)
- - (0.600000024f * fRec40[1]));
- fVec16[(IOTA & 2047)] = fTemp9;
- fRec40[0] = fVec16[((IOTA - iConst43) & 2047)];
- float fRec41 = (0.600000024f * fTemp9);
- float fTemp10 = (fRec41 + fRec37);
- float fTemp11 = (fRec29 + (fRec33 + fTemp10));
- fRec4[0] =
- (fRec12[1]
- + (fRec16[1]
- + (fRec20[1]
- + (fRec24[1]
- + (fRec28[1]
- + (fRec32[1]
- + (fRec36[1]
- + (fRec40[1]
- + (fRec13
- + (fRec17
- + (fRec21 + (fRec25 + fTemp11))))))))))));
- fRec5[0] =
- ((fRec28[1] + (fRec32[1] + (fRec36[1] + (fRec40[1] + fTemp11))))
- - (fRec12[1]
- + (fRec16[1]
- + (fRec20[1]
- + (fRec24[1] + (fRec13 + (fRec17 + (fRec25 + fRec21))))))));
- float fTemp12 = (fRec33 + fRec29);
- fRec6[0] =
- ((fRec20[1]
- + (fRec24[1]
- + (fRec36[1] + (fRec40[1] + (fRec21 + (fRec25 + fTemp10))))))
- - (fRec12[1]
- + (fRec16[1]
- + (fRec28[1] + (fRec32[1] + (fRec13 + (fRec17 + fTemp12)))))));
- fRec7[0] =
- ((fRec12[1]
- + (fRec16[1]
- + (fRec36[1] + (fRec40[1] + (fRec13 + (fRec17 + fTemp10))))))
- - (fRec20[1]
- + (fRec24[1]
- + (fRec28[1] + (fRec32[1] + (fRec21 + (fRec25 + fTemp12)))))));
- float fTemp13 = (fRec41 + fRec33);
- float fTemp14 = (fRec37 + fRec29);
- fRec8[0] =
- ((fRec16[1]
- + (fRec24[1]
- + (fRec32[1] + (fRec40[1] + (fRec17 + (fRec25 + fTemp13))))))
- - (fRec12[1]
- + (fRec20[1]
- + (fRec28[1] + (fRec36[1] + (fRec13 + (fRec21 + fTemp14)))))));
- fRec9[0] =
- ((fRec12[1]
- + (fRec20[1]
- + (fRec32[1] + (fRec40[1] + (fRec13 + (fRec21 + fTemp13))))))
- - (fRec16[1]
- + (fRec24[1]
- + (fRec28[1] + (fRec36[1] + (fRec17 + (fRec25 + fTemp14)))))));
- float fTemp15 = (fRec41 + fRec29);
- float fTemp16 = (fRec37 + fRec33);
- fRec10[0] =
- ((fRec12[1]
- + (fRec24[1]
- + (fRec28[1] + (fRec40[1] + (fRec13 + (fRec25 + fTemp15))))))
- - (fRec16[1]
- + (fRec20[1]
- + (fRec32[1] + (fRec36[1] + (fRec17 + (fRec21 + fTemp16)))))));
- fRec11[0] =
- ((fRec16[1]
- + (fRec20[1]
- + (fRec28[1] + (fRec40[1] + (fRec17 + (fRec21 + fTemp15))))))
- - (fRec12[1]
- + (fRec24[1]
- + (fRec32[1] + (fRec36[1] + (fRec13 + (fRec25 + fTemp16)))))));
- float fTemp17 = (0.370000005f * (fRec5[0] + fRec6[0]));
- float fTemp18 = (fSlow89 * fRec3[1]);
- fRec3[0] = (fTemp17 - (fTemp18 + (fSlow9 * fRec3[2])));
- float fTemp19 = (fSlow9 * fRec3[0]);
- float fTemp20 =
- (0.5f
- * ((fTemp19 + (fRec3[2] + (fTemp17 + fTemp18)))
- + (fSlow7 * ((fTemp19 + (fTemp18 + fRec3[2])) - fTemp17))));
- float fTemp21 = (fSlow90 * fRec2[1]);
- fRec2[0] = (fTemp20 - (fTemp21 + (fSlow5 * fRec2[2])));
- float fTemp22 = (fSlow5 * fRec2[0]);
- float fTemp23 = (fTemp0 * (1.0f - fRec1[0]));
- float fTemp24 = (0.370000005f * (fRec5[0] - fRec6[0]));
- float fTemp25 = (fSlow89 * fRec45[1]);
- fRec45[0] = (fTemp24 - (fTemp25 + (fSlow9 * fRec45[2])));
- float fTemp26 = (fSlow9 * fRec45[0]);
- float fTemp27 =
- (0.5f
- * ((fTemp26 + (fRec45[2] + (fTemp24 + fTemp25)))
- + (fSlow7 * ((fTemp26 + (fTemp25 + fRec45[2])) - fTemp24))));
- float fTemp28 = (fSlow90 * fRec44[1]);
- fRec44[0] = (fTemp27 - (fTemp28 + (fSlow5 * fRec44[2])));
- float fTemp29 = (fSlow5 * fRec44[0]);
- output0[i] = FAUSTFLOAT((
- fRec0[0]
- * (((0.5f
- * (fRec1[0]
- * ((fTemp22 + (fRec2[2] + (fTemp20 + fTemp21)))
- + (fSlow3 * ((fTemp22 + (fTemp21 + fRec2[2])) - fTemp20)))))
- + fTemp23)
- + (fTemp23
- + (0.5f
- * (fRec1[0]
- * ((fTemp29 + (fRec44[2] + (fTemp27 + fTemp28)))
- + (fSlow3
- * ((fTemp29 + (fTemp28 + fRec44[2])) - fTemp27)))))))));
- IOTA = (IOTA + 1);
- fRec0[1] = fRec0[0];
- fRec1[1] = fRec1[0];
- fRec15[1] = fRec15[0];
- fRec14[1] = fRec14[0];
- fRec12[1] = fRec12[0];
- fRec19[1] = fRec19[0];
- fRec18[1] = fRec18[0];
- fRec16[1] = fRec16[0];
- fRec23[1] = fRec23[0];
- fRec22[1] = fRec22[0];
- fRec20[1] = fRec20[0];
- fRec27[1] = fRec27[0];
- fRec26[1] = fRec26[0];
- fRec24[1] = fRec24[0];
- fRec31[1] = fRec31[0];
- fRec30[1] = fRec30[0];
- fRec28[1] = fRec28[0];
- fRec35[1] = fRec35[0];
- fRec34[1] = fRec34[0];
- fRec32[1] = fRec32[0];
- fRec39[1] = fRec39[0];
- fRec38[1] = fRec38[0];
- fRec36[1] = fRec36[0];
- fRec43[1] = fRec43[0];
- fRec42[1] = fRec42[0];
- fRec40[1] = fRec40[0];
- fRec4[2] = fRec4[1];
- fRec4[1] = fRec4[0];
- fRec5[2] = fRec5[1];
- fRec5[1] = fRec5[0];
- fRec6[2] = fRec6[1];
- fRec6[1] = fRec6[0];
- fRec7[2] = fRec7[1];
- fRec7[1] = fRec7[0];
- fRec8[2] = fRec8[1];
- fRec8[1] = fRec8[0];
- fRec9[2] = fRec9[1];
- fRec9[1] = fRec9[0];
- fRec10[2] = fRec10[1];
- fRec10[1] = fRec10[0];
- fRec11[2] = fRec11[1];
- fRec11[1] = fRec11[0];
- fRec3[2] = fRec3[1];
- fRec3[1] = fRec3[0];
- fRec2[2] = fRec2[1];
- fRec2[1] = fRec2[0];
- fRec45[2] = fRec45[1];
- fRec45[1] = fRec45[0];
- fRec44[2] = fRec44[1];
- fRec44[1] = fRec44[0];
+ (0.600000024f * fRec16[1] + fVec3[(IOTA0 - iConst14) & 32767]) - fTemp1;
+ fVec4[IOTA0 & 4095] = fTemp3;
+ fRec16[0] = fVec4[(IOTA0 - iConst15) & 4095];
+ float fRec17 = 0.0f - 0.600000024f * fTemp3;
+ fRec23[0] = 0.0f - fSlow22 * (fSlow23 * fRec23[1] - (fRec9[1] + fRec9[2]));
+ fRec22[0] = fSlow41 * (fRec9[1] + fSlow42 * fRec23[0]) + fSlow43 * fRec22[1];
+ fVec5[IOTA0 & 16383] = 0.353553385f * fRec22[0] + 9.99999968e-21f;
+ float fTemp4 =
+ fVec5[(IOTA0 - iConst19) & 16383] + fTemp1 + 0.600000024f * fRec20[1];
+ fVec6[IOTA0 & 4095] = fTemp4;
+ fRec20[0] = fVec6[(IOTA0 - iConst20) & 4095];
+ float fRec21 = 0.0f - 0.600000024f * fTemp4;
+ fRec27[0] = 0.0f - fSlow22 * (fSlow23 * fRec27[1] - (fRec5[1] + fRec5[2]));
+ fRec26[0] = fSlow50 * (fRec5[1] + fSlow51 * fRec27[0]) + fSlow52 * fRec26[1];
+ fVec7[IOTA0 & 32767] = 0.353553385f * fRec26[0] + 9.99999968e-21f;
+ float fTemp5 =
+ fVec7[(IOTA0 - iConst24) & 32767] + fTemp1 + 0.600000024f * fRec24[1];
+ fVec8[IOTA0 & 4095] = fTemp5;
+ fRec24[0] = fVec8[(IOTA0 - iConst25) & 4095];
+ float fRec25 = 0.0f - 0.600000024f * fTemp5;
+ fRec31[0] = 0.0f - fSlow22 * (fSlow23 * fRec31[1] - (fRec10[1] + fRec10[2]));
+ fRec30[0] = fSlow59 * (fRec10[1] + fSlow60 * fRec31[0]) + fSlow61 * fRec30[1];
+ fVec9[IOTA0 & 16383] = 0.353553385f * fRec30[0] + 9.99999968e-21f;
+ float fTemp6 =
+ fVec9[(IOTA0 - iConst29) & 16383] - (fTemp1 + 0.600000024f * fRec28[1]);
+ fVec10[IOTA0 & 2047] = fTemp6;
+ fRec28[0] = fVec10[(IOTA0 - iConst30) & 2047];
+ float fRec29 = 0.600000024f * fTemp6;
+ fRec35[0] = 0.0f - fSlow22 * (fSlow23 * fRec35[1] - (fRec6[1] + fRec6[2]));
+ fRec34[0] = fSlow68 * (fRec6[1] + fSlow69 * fRec35[0]) + fSlow70 * fRec34[1];
+ fVec11[IOTA0 & 16383] = 0.353553385f * fRec34[0] + 9.99999968e-21f;
+ float fTemp7 =
+ fVec11[(IOTA0 - iConst34) & 16383] - (fTemp1 + 0.600000024f * fRec32[1]);
+ fVec12[IOTA0 & 4095] = fTemp7;
+ fRec32[0] = fVec12[(IOTA0 - iConst35) & 4095];
+ float fRec33 = 0.600000024f * fTemp7;
+ fRec39[0] = 0.0f - fSlow22 * (fSlow23 * fRec39[1] - (fRec8[1] + fRec8[2]));
+ fRec38[0] = fSlow77 * (fRec8[1] + fSlow78 * fRec39[0]) + fSlow79 * fRec38[1];
+ fVec13[IOTA0 & 16383] = 0.353553385f * fRec38[0] + 9.99999968e-21f;
+ float fTemp8 =
+ (fTemp1 + fVec13[(IOTA0 - iConst39) & 16383]) - 0.600000024f * fRec36[1];
+ fVec14[IOTA0 & 4095] = fTemp8;
+ fRec36[0] = fVec14[(IOTA0 - iConst40) & 4095];
+ float fRec37 = 0.600000024f * fTemp8;
+ fRec43[0] = 0.0f - fSlow22 * (fSlow23 * fRec43[1] - (fRec4[1] + fRec4[2]));
+ fRec42[0] = fSlow86 * (fRec4[1] + fSlow87 * fRec43[0]) + fSlow88 * fRec42[1];
+ fVec15[IOTA0 & 16383] = 0.353553385f * fRec42[0] + 9.99999968e-21f;
+ float fTemp9 =
+ (fVec15[(IOTA0 - iConst44) & 16383] + fTemp1) - 0.600000024f * fRec40[1];
+ fVec16[IOTA0 & 2047] = fTemp9;
+ fRec40[0] = fVec16[(IOTA0 - iConst45) & 2047];
+ float fRec41 = 0.600000024f * fTemp9;
+ float fTemp10 = fRec41 + fRec37;
+ float fTemp11 = fRec29 + fRec33 + fTemp10;
+ fRec4[0] = fRec12[1] + fRec16[1] + fRec20[1] + fRec24[1] + fRec28[1]
+ + fRec32[1] + fRec36[1] + fRec40[1] + fRec13 + fRec17 + fRec21
+ + fRec25 + fTemp11;
+ fRec5[0] = (fRec28[1] + fRec32[1] + fRec36[1] + fRec40[1] + fTemp11)
+ - (fRec12[1] + fRec16[1] + fRec20[1] + fRec24[1] + fRec13 + fRec17
+ + fRec25 + fRec21);
+ float fTemp12 = fRec33 + fRec29;
+ fRec6[0] = (fRec20[1] + fRec24[1] + fRec36[1] + fRec40[1] + fRec21 + fRec25
+ + fTemp10)
+ - (fRec12[1] + fRec16[1] + fRec28[1] + fRec32[1] + fRec13 + fRec17
+ + fTemp12);
+ fRec7[0] = (fRec12[1] + fRec16[1] + fRec36[1] + fRec40[1] + fRec13 + fRec17
+ + fTemp10)
+ - (fRec20[1] + fRec24[1] + fRec28[1] + fRec32[1] + fRec21 + fRec25
+ + fTemp12);
+ float fTemp13 = fRec41 + fRec33;
+ float fTemp14 = fRec37 + fRec29;
+ fRec8[0] = (fRec16[1] + fRec24[1] + fRec32[1] + fRec40[1] + fRec17 + fRec25
+ + fTemp13)
+ - (fRec12[1] + fRec20[1] + fRec28[1] + fRec36[1] + fRec13 + fRec21
+ + fTemp14);
+ fRec9[0] = (fRec12[1] + fRec20[1] + fRec32[1] + fRec40[1] + fRec13 + fRec21
+ + fTemp13)
+ - (fRec16[1] + fRec24[1] + fRec28[1] + fRec36[1] + fRec17 + fRec25
+ + fTemp14);
+ float fTemp15 = fRec41 + fRec29;
+ float fTemp16 = fRec37 + fRec33;
+ fRec10[0] = (fRec12[1] + fRec24[1] + fRec28[1] + fRec40[1] + fRec13 + fRec25
+ + fTemp15)
+ - (fRec16[1] + fRec20[1] + fRec32[1] + fRec36[1] + fRec17 + fRec21
+ + fTemp16);
+ fRec11[0] = (fRec16[1] + fRec20[1] + fRec28[1] + fRec40[1] + fRec17 + fRec21
+ + fTemp15)
+ - (fRec12[1] + fRec24[1] + fRec32[1] + fRec36[1] + fRec13 + fRec25
+ + fTemp16);
+ float fTemp17 = 0.370000005f * (fRec5[0] + fRec6[0]);
+ float fTemp18 = fSlow89 * fRec3[1];
+ fRec3[0] = fTemp17 - (fTemp18 + fSlow9 * fRec3[2]);
+ float fTemp19 = fSlow9 * fRec3[0];
+ float fTemp20 = 0.5f
+ * (fTemp19 + fRec3[2] + fTemp17 + fTemp18
+ + fSlow7 * ((fTemp19 + fTemp18 + fRec3[2]) - fTemp17));
+ float fTemp21 = fSlow90 * fRec2[1];
+ fRec2[0] = fTemp20 - (fTemp21 + fSlow5 * fRec2[2]);
+ float fTemp22 = fSlow5 * fRec2[0];
+ float fTemp23 = fTemp0 * (1.0f - fRec1[0]);
+ float fTemp24 = 0.370000005f * (fRec5[0] - fRec6[0]);
+ float fTemp25 = fSlow89 * fRec45[1];
+ fRec45[0] = fTemp24 - (fTemp25 + fSlow9 * fRec45[2]);
+ float fTemp26 = fSlow9 * fRec45[0];
+ float fTemp27 = 0.5f
+ * (fTemp26 + fRec45[2] + fTemp24 + fTemp25
+ + fSlow7 * ((fTemp26 + fTemp25 + fRec45[2]) - fTemp24));
+ float fTemp28 = fSlow90 * fRec44[1];
+ fRec44[0] = fTemp27 - (fTemp28 + fSlow5 * fRec44[2]);
+ float fTemp29 = fSlow5 * fRec44[0];
+ output0[i0] = FAUSTFLOAT(
+ fRec0[0]
+ * (0.5f * fRec1[0]
+ * (fTemp22 + fRec2[2] + fTemp20 + fTemp21
+ + fSlow3 * ((fTemp22 + fTemp21 + fRec2[2]) - fTemp20))
+ + fTemp23 + fTemp23
+ + 0.5f * fRec1[0]
+ * (fTemp29 + fRec44[2] + fTemp27 + fTemp28
+ + fSlow3 * ((fTemp29 + fTemp28 + fRec44[2]) - fTemp27))));
+ IOTA0 = IOTA0 + 1;
+ fRec0[1] = fRec0[0];
+ fRec1[1] = fRec1[0];
+ fRec15[1] = fRec15[0];
+ fRec14[1] = fRec14[0];
+ fRec12[1] = fRec12[0];
+ fRec19[1] = fRec19[0];
+ fRec18[1] = fRec18[0];
+ fRec16[1] = fRec16[0];
+ fRec23[1] = fRec23[0];
+ fRec22[1] = fRec22[0];
+ fRec20[1] = fRec20[0];
+ fRec27[1] = fRec27[0];
+ fRec26[1] = fRec26[0];
+ fRec24[1] = fRec24[0];
+ fRec31[1] = fRec31[0];
+ fRec30[1] = fRec30[0];
+ fRec28[1] = fRec28[0];
+ fRec35[1] = fRec35[0];
+ fRec34[1] = fRec34[0];
+ fRec32[1] = fRec32[0];
+ fRec39[1] = fRec39[0];
+ fRec38[1] = fRec38[0];
+ fRec36[1] = fRec36[0];
+ fRec43[1] = fRec43[0];
+ fRec42[1] = fRec42[0];
+ fRec40[1] = fRec40[0];
+ fRec4[2] = fRec4[1];
+ fRec4[1] = fRec4[0];
+ fRec5[2] = fRec5[1];
+ fRec5[1] = fRec5[0];
+ fRec6[2] = fRec6[1];
+ fRec6[1] = fRec6[0];
+ fRec7[2] = fRec7[1];
+ fRec7[1] = fRec7[0];
+ fRec8[2] = fRec8[1];
+ fRec8[1] = fRec8[0];
+ fRec9[2] = fRec9[1];
+ fRec9[1] = fRec9[0];
+ fRec10[2] = fRec10[1];
+ fRec10[1] = fRec10[0];
+ fRec11[2] = fRec11[1];
+ fRec11[1] = fRec11[0];
+ fRec3[2] = fRec3[1];
+ fRec3[1] = fRec3[0];
+ fRec2[2] = fRec2[1];
+ fRec2[1] = fRec2[0];
+ fRec45[2] = fRec45[1];
+ fRec45[1] = fRec45[0];
+ fRec44[2] = fRec44[1];
+ fRec44[1] = fRec44[0];
}
}
};
diff --git a/win/build_installer.bat b/win/build_installer.bat
index 71a5340..06d5f2e 100755
--- a/win/build_installer.bat
+++ b/win/build_installer.bat
@@ -1,15 +1,19 @@
@echo off
setlocal EnableDelayedExpansion
+set QTVERSION="5"
+
if not defined QTBINPATH (
- for /f "delims=" %%a in ('dir /b C:\Qt\5*') do set QTVERSION=%%a
- for /f "delims=" %%a in ('dir /b C:\Qt\!QTVERSION!\min*') do set QTBINPATH=%%a
- set QTBINPATH=C:\Qt\!QTVERSION!\!QTBINPATH!\bin
+ for /f "delims=" %%a in ('dir /b C:\Qt\%QTVERSION%.*') do set QTFULLVERSION=%%a
+ for /f "delims=" %%a in ('dir /b C:\Qt\!QTFULLVERSION!\mingw*') do set QTBINPATH=%%a
+ set QTBINPATH=C:\Qt\!QTFULLVERSION!\!QTBINPATH!\bin
)
+echo Using Qt Version %QTFULLVERSION%
if not defined QTLIBPATH (
- for /f "delims=" %%a in ('dir /b C:\Qt\Tools\min*') do set QTLIBPATH=%%a
+ for /f "delims=" %%a in ('dir /b C:\Qt\Tools\mingw*') do set QTLIBPATH=%%a
set QTLIBPATH=C:\Qt\Tools\!QTLIBPATH!\bin
)
+echo Using mingw libraries from %QTLIBPATH%
if not defined WIXPATH (
for /f "delims=" %%a in ('dir /b "C:\Program Files (x86)\Wix Toolset*"') do set WIXPATH=%%a
set WIXPATH=C:\Program Files ^(x86^)\!WIXPATH!\bin
@@ -36,16 +40,24 @@ for %%f in (..\LICENSE.md ..\LICENSES\MIT.txt ..\LICENSES\GPL-3.0.txt ..\LICENSE
)
echo }>>%LICENSEPATH%
-copy dialog.bmp deploy\
+if "%~1"=="/q" (
+ copy dialog_alt.bmp deploy\dialog.bmp
+) else (
+ copy dialog.bmp deploy\
+)
if exist ..\builddir\release\jacktrip.exe (set JACKTRIP=..\builddir\release\jacktrip.exe) else (set JACKTRIP=..\builddir\jacktrip.exe)
copy %JACKTRIP% deploy\
cd deploy
set "WIXDEFINES="
-for /f "tokens=*" %%a in ('%QTLIBPATH%\objdump -p jacktrip.exe ^| findstr Qt5Core.dll') do set DYNAMIC_QT=%%a
+for /f "tokens=*" %%a in ('%QTLIBPATH%\objdump -p jacktrip.exe ^| findstr Qt%QTVERSION%Core.dll') do set DYNAMIC_QT=%%a
if defined DYNAMIC_QT (
echo Including Qt Files
- for /f "tokens=*" %%a in ('%QTLIBPATH%\objdump -p jacktrip.exe ^| findstr Qt5Qml.dll') do set VS=%%a
+ for /f "tokens=*" %%a in ('%QTLIBPATH%\objdump -p jacktrip.exe ^| findstr Qt%QTVERSION%Qml.dll') do set VS=%%a
if defined VS (
+ if %QTVERSION%=="6" (
+ echo The installer is not designed to handle dynamic Virtual Studio builds using Qt6 yet.
+ exit /b 1
+ )
%QTBINPATH%\windeployqt --qmldir ..\..\src\gui jacktrip.exe
set WIXDEFINES=%WIXDEFINES% -dvs
) else (
@@ -64,6 +76,7 @@ if defined RTAUDIO (
copy %RTAUDIOLIB% .\
set WIXDEFINES=%WIXDEFINES% -drtaudio
)
+set WIXDEFINES=%WIXDEFINES% -dqt%QTVERSION%
copy ..\jacktrip.wxs .\
copy ..\files.wxs .\
@@ -76,6 +89,6 @@ rem Get our version number
for /f "tokens=*" %%a in ('.\jacktrip -v ^| findstr VERSION') do for %%b in (%%~a) do set VERSION=%%b
for /f "tokens=1 delims=-" %%a in ("%VERSION%") do set VERSION=%%a
echo Version=%VERSION%
-candle.exe -ext WixUIExtension -ext WixUtilExtension -dVersion=%VERSION%%WIXDEFINES% jacktrip.wxs files.wxs
+candle.exe -arch x64 -ext WixUIExtension -ext WixUtilExtension -dVersion=%VERSION%%WIXDEFINES% jacktrip.wxs files.wxs
light.exe -ext WixUIExtension -ext WixUtilExtension -o JackTrip.msi jacktrip.wixobj files.wixobj
endlocal
diff --git a/win/dialog_alt.bmp b/win/dialog_alt.bmp
new file mode 100644
index 0000000..5d6e642
--- /dev/null
+++ b/win/dialog_alt.bmp
Binary files differ
diff --git a/win/files.wxs b/win/files.wxs
index 00e2c1e..cda2140 100644
--- a/win/files.wxs
+++ b/win/files.wxs
@@ -30,18 +30,20 @@
<Component Id="cmpF83098612A5B11C5398DBA3894ED590A" Guid="6A0A67A9-3318-4CFB-BC07-5AF3FF7B7E87">
<File Id="fil526FA994C1850220CFA7BD7FCD995C32" KeyPath="yes" Source="SourceDir\D3Dcompiler_47.dll" />
</Component>
- <Component Id="cmpB60B52D038613C3F20F84A0E1C83D4D4" Guid="62E3CBE5-9787-4A5C-B6CD-B867781773EE">
- <File Id="fil09D765981E2E493119D2DBD2DA179B9D" KeyPath="yes" Source="SourceDir\libcrypto-1_1-x64.dll" />
- </Component>
+<?ifdef qt5?>
<Component Id="cmp5DDCF0CE56D406D1B8B1F93E988AED6B" Guid="4346C308-2912-4CAF-B01B-1FB85781DAD0">
<File Id="fil0F4CD3729AF07C1C460E292E0F081D0A" KeyPath="yes" Source="SourceDir\libEGL.dll" />
</Component>
- <Component Id="cmpDEFDDDBEBEA7255D07EE4400F2CDA2FF" Guid="904EB309-B381-443D-A064-4C2669E8E66E">
- <File Id="fil2ECEB8B8BE6121A2C5659BA0F64D92FC" KeyPath="yes" Source="SourceDir\libgcc_s_seh-1.dll" />
- </Component>
<Component Id="cmpB0CFEB9FF932521D6A75B6BE6F8D644F" Guid="73A8C873-FBDB-4BC5-BB74-2F82619DC3EC">
<File Id="fil736048FE57EC840EA5DCE88625C38E8D" KeyPath="yes" Source="SourceDir\libGLESv2.dll" />
</Component>
+<?endif?>
+ <Component Id="cmpB60B52D038613C3F20F84A0E1C83D4D4" Guid="62E3CBE5-9787-4A5C-B6CD-B867781773EE">
+ <File Id="fil09D765981E2E493119D2DBD2DA179B9D" KeyPath="yes" Source="SourceDir\libcrypto-1_1-x64.dll" />
+ </Component>
+ <Component Id="cmpDEFDDDBEBEA7255D07EE4400F2CDA2FF" Guid="904EB309-B381-443D-A064-4C2669E8E66E">
+ <File Id="fil2ECEB8B8BE6121A2C5659BA0F64D92FC" KeyPath="yes" Source="SourceDir\libgcc_s_seh-1.dll" />
+ </Component>
<Component Id="cmp809509D62BD9EA848EF243F03D83758F" Guid="FE4AFCE9-7DE1-4A82-A96E-42C8B93E04C7">
<File Id="filCE00A8B273087E758109FEC2AC699195" KeyPath="yes" Source="SourceDir\libssl-1_1-x64.dll" />
</Component>
@@ -54,6 +56,7 @@
<Component Id="cmpEA16414E09FD1D5068139520966B49EB" Guid="9B14A007-CA41-4C45-BE9E-0B1067DD5311">
<File Id="filFC8C908E3AD35E8090AFF39C9B0FB744" KeyPath="yes" Source="SourceDir\opengl32sw.dll" />
</Component>
+<?ifdef qt5?>
<Component Id="cmp01229088A6F1DEA1BE391E6E7CC3D3EE" Guid="9A610B9C-6322-4045-9C4B-910FFBA38502">
<File Id="filAD80F4724AAE3D8B0682F5982CC2548D" KeyPath="yes" Source="SourceDir\Qt5Core.dll" />
</Component>
@@ -74,6 +77,24 @@
<File Id="fil94C33B546082B4DF43813FFB7569FBF6" KeyPath="yes" Source="SourceDir\bearer\qgenericbearer.dll" />
</Component>
</Directory>
+<?endif?>
+<?ifdef qt6?>
+ <Component Id="cmp9147A534CD8EDAB4BA7FDEAEEFE9C511" Guid="{8D05F121-517E-4A1F-86FE-26A735F23F1C}">
+ <File Id="fil88DECE330C4A1F60E0198BE9EAD7F35B" KeyPath="yes" Source="SourceDir\Qt6Core.dll" />
+ </Component>
+ <Component Id="cmp52AB384603E096D6B6A1E1FC66B089D4" Guid="{FA746517-7C88-4473-9162-22E9A8CF6507}">
+ <File Id="fil93995D4EFFB081D1CEF92B0D38526E04" KeyPath="yes" Source="SourceDir\Qt6Gui.dll" />
+ </Component>
+ <Component Id="cmp0E8605D5C55843FCDFE809B5EE8DFDFA" Guid="{499C045E-88C6-43A6-B567-6C3438CA5FFD}">
+ <File Id="fil63F02A7FFBCDAAB6EAB6E65E642AC7B0" KeyPath="yes" Source="SourceDir\Qt6Network.dll" />
+ </Component>
+ <Component Id="cmp5D904885C8104A4049616BBAA95F34A3" Guid="{B47BE8F9-D9B5-4345-A232-F2EE8B6D4931}">
+ <File Id="fil30A776C0F63064A6AF65369FF23FDB8C" KeyPath="yes" Source="SourceDir\Qt6Svg.dll" />
+ </Component>
+ <Component Id="cmpCAE694BB34A9EC66AEA9D10D697F1EAA" Guid="{C1A11A59-3BF3-4562-92C6-304A80B93DAE}">
+ <File Id="fil43665A392379256FF1D68CF38B97EA38" KeyPath="yes" Source="SourceDir\Qt6Widgets.dll" />
+ </Component>
+<?endif qt6?>
<Directory Id="dirB4D909CA5877E8EBEB32B83B2D15F595" Name="iconengines">
<Component Id="cmp1AAFF160C8E04AD945D74CA884667ABC" Guid="F9CAC368-2789-40F4-ADB8-0EDF377306DF">
<File Id="filB4B2363760DE489E24EBDBD0BC837FDE" KeyPath="yes" Source="SourceDir\iconengines\qsvgicon.dll" />
@@ -118,6 +139,19 @@
<File Id="fil84E6446D9ECFA487C5A2EC4752E07F04" KeyPath="yes" Source="SourceDir\styles\qwindowsvistastyle.dll" />
</Component>
</Directory>
+<?ifdef qt6?>
+ <Directory Id="dir65521F18679A6D14A7BDE5A8612E8C69" Name="tls">
+ <Component Id="cmp83139013FA2C9A99CF2772FD54090FAA" Guid="{60DFDBBA-4832-44FD-B14A-C67EBD4D8119}">
+ <File Id="fil737932C7578FEA0392CDEFB7540D7E44" KeyPath="yes" Source="SourceDir\tls\qcertonlybackend.dll" />
+ </Component>
+ <Component Id="cmp6E4460E3D6226693FEA5DBBF500895C7" Guid="{CBF26A3F-BA32-4017-BAEF-014AA3C51653}">
+ <File Id="fil02E5C4A93CDAD6084E6372A2EE1F7ABA" KeyPath="yes" Source="SourceDir\tls\qopensslbackend.dll" />
+ </Component>
+ <Component Id="cmp53306F84AD30BD49CF0C1A68007F9531" Guid="{47907844-2DC3-4E99-B1C9-B9C716E59407}">
+ <File Id="filD182E98DFB41D91EC2F2A531F6CAF918" KeyPath="yes" Source="SourceDir\tls\qschannelbackend.dll" />
+ </Component>
+ </Directory>
+<?endif qt6?>
<Directory Id="dirF1C5FA08924D46D2A43D5134DF70C0A8" Name="translations">
<Component Id="cmpBCDC6995284E75B9A24E4646E6117744" Guid="51A3610B-4AE8-4020-926E-80B77B650E52">
<File Id="fil694FD3DFB9C088844BF9929014423509" KeyPath="yes" Source="SourceDir\translations\qt_ar.qm" />
@@ -188,8 +222,27 @@
<Component Id="cmpFDB70117D8E46EB188997470A3793B5D" Guid="EA2F54B9-EE49-4426-A2EF-EDDF3CAC83FD">
<File Id="fil9085627E4E33630ABCDB62A5CC05B794" KeyPath="yes" Source="SourceDir\translations\qt_zh_TW.qm" />
</Component>
- </Directory>
+<?ifdef qt6?>
+ <Component Id="cmpF0099CF54A0669D87CC17418C3911422" Guid="{3405A05E-CB26-47D2-9C70-C52167AB8FDC}">
+ <File Id="fil71B9851F396CBCC25B18299EDCBF5FF5" KeyPath="yes" Source="SourceDir\translations\qt_fa.qm" />
+ </Component>
+ <Component Id="cmpE89BF9966FD9EC39B16BC14B5586E0FA" Guid="{818D0415-1B0D-4C20-A21B-634467D7ABED}">
+ <File Id="filB4B324E9728AE54A2B57A18E91814BC1" KeyPath="yes" Source="SourceDir\translations\qt_hr.qm" />
+ </Component>
+ <Component Id="cmp7F6AC80CE7E39EEDC9A962EAFADD113B" Guid="{E7491B72-07BC-4811-9AA2-9C90EA586475}">
+ <File Id="filAB0862690AA36917007DE3C425A282CD" KeyPath="yes" Source="SourceDir\translations\qt_nl.qm" />
+ </Component>
+ <Component Id="cmp9EB4F508A604A4AD35BC558C456111DD" Guid="{035418D9-E833-45B1-B33E-15B8C6EA4E03}">
+ <File Id="filA89B168478D587343A282C54242055A0" KeyPath="yes" Source="SourceDir\translations\qt_nn.qm" />
+ </Component>
+ <Component Id="cmp09D69EFDCF1B331A37D028C962FE6147" Guid="{BBD6ABD9-DDF9-4AC2-B8C1-FB4CB547B14F}">
+ <File Id="fil3DBA8083389C96E9A47E27507D39EA05" KeyPath="yes" Source="SourceDir\translations\qt_pt_BR.qm" />
+ </Component>
+ <Component Id="cmpA23046CBC7F8B7E62AF4843CBB72DEC9" Guid="{FE5DC38D-3ABF-406D-8FB7-258119E76380}">
+ <File Id="filCAF43146A9F7B1727B4975BB51D0A045" KeyPath="yes" Source="SourceDir\translations\qt_zh_CN.qm" />
+ </Component>
<?endif?>
+ </Directory>
<?ifdef vs?>
<Component Id="cmp26187F331810660B2B23AB9501BE69AF" Guid="{B9D40CBB-9764-4DAA-9121-B74B8EADE326}">
<File Id="fil548462476B423A98BF378EB6B7FED697" KeyPath="yes" Source="SourceDir\Qt5NetworkAuth.dll" />
@@ -1345,6 +1398,7 @@
</Component>
</Directory>
<?endif?>
+<?endif?>
</DirectoryRef>
</Fragment>
<Fragment>
@@ -1359,20 +1413,31 @@
<?endif?>
<?ifdef dynamic?>
<ComponentRef Id="cmpF83098612A5B11C5398DBA3894ED590A" />
- <ComponentRef Id="cmpB60B52D038613C3F20F84A0E1C83D4D4" />
+<?ifdef qt5?>
<ComponentRef Id="cmp5DDCF0CE56D406D1B8B1F93E988AED6B" />
- <ComponentRef Id="cmpDEFDDDBEBEA7255D07EE4400F2CDA2FF" />
<ComponentRef Id="cmpB0CFEB9FF932521D6A75B6BE6F8D644F" />
+<?endif?>
+ <ComponentRef Id="cmpB60B52D038613C3F20F84A0E1C83D4D4" />
+ <ComponentRef Id="cmpDEFDDDBEBEA7255D07EE4400F2CDA2FF" />
<ComponentRef Id="cmp809509D62BD9EA848EF243F03D83758F" />
<ComponentRef Id="cmp57DDA83E372188A5B760684B961DE685" />
<ComponentRef Id="cmpF76D0CD1138260DB167395B86D0011CF" />
<ComponentRef Id="cmpEA16414E09FD1D5068139520966B49EB" />
+<?ifdef qt5?>
<ComponentRef Id="cmp01229088A6F1DEA1BE391E6E7CC3D3EE" />
<ComponentRef Id="cmp1658AEC83DA2CDD0D93D5BAAABBEAD46" />
<ComponentRef Id="cmp2DE804C107C75B0C71470A93647D09B5" />
<ComponentRef Id="cmp82912105030EA0D2D7550CF8AC5677F6" />
<ComponentRef Id="cmp975651B71289ACA70B3EB154C08A27F0" />
<ComponentRef Id="cmp3CE5AF7CB2F8B2689D2096769883BC56" />
+<?endif?>
+<?ifdef qt6?>
+ <ComponentRef Id="cmp9147A534CD8EDAB4BA7FDEAEEFE9C511" />
+ <ComponentRef Id="cmp52AB384603E096D6B6A1E1FC66B089D4" />
+ <ComponentRef Id="cmp0E8605D5C55843FCDFE809B5EE8DFDFA" />
+ <ComponentRef Id="cmp5D904885C8104A4049616BBAA95F34A3" />
+ <ComponentRef Id="cmpCAE694BB34A9EC66AEA9D10D697F1EAA" />
+<?endif?>
<ComponentRef Id="cmp1AAFF160C8E04AD945D74CA884667ABC" />
<ComponentRef Id="cmp02252B1C1976959CFEE7FA11B6E36C4C" />
<ComponentRef Id="cmp62CBFF830BF239A4E376FAE29937AFAB" />
@@ -1385,6 +1450,11 @@
<ComponentRef Id="cmpE6323C810986405043F219CECD6B6C10" />
<ComponentRef Id="cmp9132FD413972F732967B8BC075BC2781" />
<ComponentRef Id="cmp52840D209B2AC1DC45A29A6BA5A75FF8" />
+<?ifdef qt6?>
+ <ComponentRef Id="cmp83139013FA2C9A99CF2772FD54090FAA" />
+ <ComponentRef Id="cmp6E4460E3D6226693FEA5DBBF500895C7" />
+ <ComponentRef Id="cmp53306F84AD30BD49CF0C1A68007F9531" />
+<?endif?>
<ComponentRef Id="cmpBCDC6995284E75B9A24E4646E6117744" />
<ComponentRef Id="cmp3B3D2ADEE08668758CB9FDB1D243AA11" />
<ComponentRef Id="cmpDAE87E8CC29C30A200A5D17D81DF1DE7" />
@@ -1408,6 +1478,13 @@
<ComponentRef Id="cmp8DAF13208A863A841AEE7A46E79FB87C" />
<ComponentRef Id="cmpA214B663A372012F5DCBA6A5CDAE421D" />
<ComponentRef Id="cmpFDB70117D8E46EB188997470A3793B5D" />
+<?ifdef qt6?>
+ <ComponentRef Id="cmpF0099CF54A0669D87CC17418C3911422" />
+ <ComponentRef Id="cmpE89BF9966FD9EC39B16BC14B5586E0FA" />
+ <ComponentRef Id="cmp7F6AC80CE7E39EEDC9A962EAFADD113B" />
+ <ComponentRef Id="cmp9EB4F508A604A4AD35BC558C456111DD" />
+ <ComponentRef Id="cmp09D69EFDCF1B331A37D028C962FE6147" />
+ <ComponentRef Id="cmpA23046CBC7F8B7E62AF4843CBB72DEC9" />
<?endif?>
<?ifdef vs?>
<ComponentRef Id="cmp26187F331810660B2B23AB9501BE69AF" />
@@ -1784,6 +1861,7 @@
<ComponentRef Id="cmp65C97B5A564AB844DB2F02FFA5B163A4" />
<ComponentRef Id="cmp4A028D7062688CA7458F90092B47AAAC" />
<?endif?>
+<?endif?>
</ComponentGroup>
</Fragment>
</Wix>
diff --git a/win/getCsv.sh b/win/getCsv.sh
new file mode 100755
index 0000000..f19f830
--- /dev/null
+++ b/win/getCsv.sh
@@ -0,0 +1,2 @@
+#!/bin/sh
+cat files.wxs | awk '/<Component Id/{ printf "%s ", $2; getline; print $4; }' | sed -E 's/Id="(.*)" Source="SourceDir\\(.*)"/\1,\2/'
diff --git a/win/jacktrip.wxs b/win/jacktrip.wxs
index d6901b8..7617489 100644
--- a/win/jacktrip.wxs
+++ b/win/jacktrip.wxs
@@ -7,14 +7,14 @@
<Package Id='*' Keywords='Installer' Description='JackTrip Installer'
Comments='Developed by SoundWIRE Group at CCRMA, Stanford' Manufacturer='JackTrip'
- InstallerVersion='100' Languages='1033' Compressed='yes' SummaryCodepage='1252' />
+ InstallerVersion='200' Languages='1033' Compressed='yes' SummaryCodepage='1252' />
<Media Id='1' Cabinet='JackTrip.cab' EmbedCab='yes' DiskPrompt='Disk 1' />
<Property Id='DiskPrompt' Value='JackTrip Installer File' />
<MajorUpgrade AllowDowngrades="no" DowngradeErrorMessage="A newer version is already installed."
AllowSameVersionUpgrades="no" />
<Directory Id='TARGETDIR' Name='SourceDir'>
- <Directory Id='ProgramFilesFolder' Name='PFiles'>
+ <Directory Id='ProgramFiles64Folder' Name='PFiles'>
<Directory Id='INSTALLDIR' Name='JackTrip'>
</Directory>
</Directory>
diff --git a/win/jacktrip_alt.ico b/win/jacktrip_alt.ico
new file mode 100644
index 0000000..1fdf3e0
--- /dev/null
+++ b/win/jacktrip_alt.ico
Binary files differ