build-windows-zig.sh 49 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581
  1. #!/usr/bin/env bash
  2. # Cross build of LYNX.exe (Windows x64) from Linux/WSL using Zig (clang + MinGW-w64).
  3. # Needs neither Visual Studio nor CMake. The official build is still CMakeLists.txt.
  4. #
  5. # Variables: ZIG (path to zig), JUCE_DIR (JUCE 8 checkout), OUT (output folder), JOBS
  6. set -euo pipefail
  7. cd "$(dirname "$0")/.."
  8. ZIG="${ZIG:-$HOME/opt/zig-x86_64-linux-0.14.1/zig}"
  9. JUCE_DIR="${JUCE_DIR:-$HOME/opt/juce-8.0.4}"
  10. OUT="${OUT:-build-win}"
  11. JOBS="${JOBS:-$(nproc)}"
  12. TARGET=x86_64-windows-gnu
  13. # Single version source: project(LYNX VERSION x.y.z[.r]) in CMakeLists.txt (r: a hotfix, e.g. 0.1.31.1)
  14. VERSION="$(sed -n 's/^project(LYNX VERSION \([0-9]*\.[0-9]*\.[0-9]*\(\.[0-9]*\)\{0,1\}\).*/\1/p' CMakeLists.txt)"
  15. [[ -n "$VERSION" ]] || { echo "could not read the version from CMakeLists.txt" >&2; exit 1; }
  16. mkdir -p "$OUT/juce" "$OUT/app" "$OUT/shim"
  17. # MinGW headers are lowercase; JUCE includes some with capitals (on Windows it does not matter).
  18. echo '#include <dbghelp.h>' > "$OUT/shim/Dbghelp.h"
  19. # Ableton Link (third_party/link, unmodified) includes Windows headers by their SDK capitals (round 190gl)
  20. echo '#include <ws2tcpip.h>' > "$OUT/shim/WS2tcpip.h"
  21. echo '#include <winsock2.h>' > "$OUT/shim/WinSock2.h"
  22. echo '#include <windows.h>' > "$OUT/shim/Windows.h"
  23. MODULES=(juce_core juce_data_structures juce_events juce_graphics juce_gui_basics juce_gui_extra
  24. juce_audio_basics juce_audio_devices juce_audio_formats juce_audio_processors juce_audio_utils juce_dsp juce_opengl)
  25. {
  26. echo '#pragma once'
  27. echo '#define JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED 1'
  28. echo '#define JUCE_STANDALONE_APPLICATION 1'
  29. echo '#define JUCE_USE_CURL 0'
  30. echo '#define JUCE_WEB_BROWSER 0'
  31. echo '#define JUCE_USE_WINDOWS_MEDIA_FORMAT 0'
  32. echo '#define JUCE_PLUGINHOST_VST3 1'
  33. echo '#define JUCE_PLUGINHOST_ARA 1' # ARA 2 hosting (round 190kx; Celemony's ARA SDK headers in third_party/ara)
  34. echo '#define JUCE_ASIO 1'
  35. echo '#define JUCE_USE_MP3AUDIOFORMAT 0' # MP3: src/engine/Mp3Format (minimp3), round 157b
  36. echo '#define JUCE_APPLICATION_NAME_STRING "LYNX"'
  37. echo "#define JUCE_APPLICATION_VERSION_STRING \"$VERSION\""
  38. for m in "${MODULES[@]}"; do echo "#define JUCE_MODULE_AVAILABLE_$m 1"; done
  39. } > "$OUT/JuceConfig.h.new"
  40. # only replace the file if it changed, so the module cache is not invalidated
  41. cmp -s "$OUT/JuceConfig.h.new" "$OUT/JuceConfig.h" 2>/dev/null && rm "$OUT/JuceConfig.h.new" || mv "$OUT/JuceConfig.h.new" "$OUT/JuceConfig.h"
  42. # Release optimisation (round toolchain190gt; numbers in docs/PLATFORMS.md "Release optimisation"):
  43. # LYNX_WIN_OPT the optimisation flags of LYNX's and JUCE's C++, default -O2. (zig gives -O3 the same code as -O2; a
  44. # real -O3 is "-O2 -Xclang -O3". -fno-math-errno gained nothing on Windows (-3..0 %) and on MinGW
  45. # it turns sin + cos of one value into a call of the C runtime's sincos. )
  46. # LYNX_WIN_LTO thin = ThinLTO for LYNX's own objects (JUCE's modules stay out), default 0: measured on Windows it gained
  47. # 0-14 % (streaming most) but made the FL Harmless engine 1.5x slower (fixed by keeping Harmless.cpp
  48. # out of it), for a 15-25 minute link. Default off (local and round builds); the release (release.yml,
  49. # round 190kz) builds with LYNX_WIN_OPT="-O2 -Xclang -O3" LYNX_WIN_LTO=thin: about 8 more minutes on
  50. # a 4-thread CI runner, nothing slower beyond the noise (table in docs/PLATFORMS.md).
  51. # LYNX_WIN_GC 1 = the link drops unreferenced code and folds identical functions (see "Linking" below), default 1.
  52. # -ffp-contract=off always, as CMakeLists.txt does for Linux and macOS: no fused multiply-add, so the FL-exact engines keep
  53. # their operation order whatever CPU the code is built for (baseline x86-64 has no FMA, so today it changes nothing).
  54. LYNX_WIN_OPT="${LYNX_WIN_OPT:--O2}"
  55. LYNX_WIN_LTO="${LYNX_WIN_LTO:-0}"
  56. LYNX_WIN_GC="${LYNX_WIN_GC:-1}"
  57. read -ra WIN_OPT <<< "$LYNX_WIN_OPT"
  58. WIN_LTO=(); [[ "$LYNX_WIN_LTO" == thin ]] && WIN_LTO=(-flto=thin)
  59. COMMON=(-target "$TARGET" -std=c++20 "${WIN_OPT[@]}" "${WIN_LTO[@]}" -ffp-contract=off -DNDEBUG=1 -fno-sanitize=undefined
  60. -include "$OUT/JuceConfig.h" -include cmake/mingw/mingw_compat.h
  61. -I"$OUT/shim" -I"$JUCE_DIR/modules" -I"$JUCE_DIR/modules/juce_audio_processors/format_types/VST3_SDK" -Ithird_party/ara -Ithird_party/clap/include -Ithird_party/wavpack/include -Ithird_party/vorbis/include -Ithird_party/lame/include -Ithird_party/asiosdk/common -Ithird_party/sse2neon -Ithird_party/pocketpy -Ithird_party/monocypher -Ithird_party/onnxruntime -Ithird_party/ysfx/include -DYSFX_API= -Isrc)
  62. # The plugins (LYNX_BUILD_PLUGINS=1 below) link these objects with --gc-sections: with a section per function and per
  63. # datum the linker drops what a plugin never reaches (round 180b measured 32 % on Linux). Plugin builds only, so the app's
  64. # objects and their cache entries stay as they are (LYNX_PLUGIN_SECTIONS=0 turns it off).
  65. if [[ "$LYNX_WIN_GC" == 1 || ( "${LYNX_BUILD_PLUGINS:-0}" == 1 && "${LYNX_PLUGIN_SECTIONS:-1}" == 1 ) ]]; then
  66. COMMON+=(-ffunction-sections -fdata-sections -faddrsig)
  67. fi
  68. # juce_gui_basics, juce_audio_processors, juce_graphics and juce_events are compiled from patched copies
  69. # (cmake/LynxPatchJuce.cmake: issue #11 drag & drop and menu fixes; issue #70 VST3 note ids; issue #63 VST3 note
  70. # tuning; round 174e2 Direct2D image readback; issue #32 the message dispatch hook of the plugin window crash guard;
  71. # juce_audio_devices: issue #134 the Windows Audio channel probe), so
  72. # the JUCE checkout itself is never modified. The copies are only replaced when their patched sources change (module cache).
  73. GUI_BASICS_SRC="$JUCE_DIR/modules/juce_gui_basics"
  74. AUDIO_PROCESSORS_SRC="$JUCE_DIR/modules/juce_audio_processors"
  75. GRAPHICS_SRC="$JUCE_DIR/modules/juce_graphics"
  76. EVENTS_SRC="$JUCE_DIR/modules/juce_events"
  77. AUDIO_DEVICES_SRC="$JUCE_DIR/modules/juce_audio_devices"
  78. CORE_SRC="$JUCE_DIR/modules/juce_core" # (round 190la: fix 44, the timed waits)
  79. CMAKE="${CMAKE:-$(command -v cmake || ls "$HOME"/opt/cmake-*/bin/cmake 2>/dev/null | head -n 1)}"
  80. if [[ -n "$CMAKE" ]]; then
  81. rm -rf "$OUT/juce-patched.new"
  82. mkdir -p "$OUT/juce-patched.new/modules"
  83. cp -r "$JUCE_DIR/modules/juce_gui_basics" "$JUCE_DIR/modules/juce_audio_processors" "$JUCE_DIR/modules/juce_graphics" "$JUCE_DIR/modules/juce_events" "$JUCE_DIR/modules/juce_audio_devices" "$JUCE_DIR/modules/juce_core" "$OUT/juce-patched.new/modules/"
  84. "$CMAKE" -DJUCE_DIR="$OUT/juce-patched.new" -P cmake/LynxPatchJuce.cmake
  85. if diff -rq "$OUT/juce-patched.new" "$OUT/juce-patched" >/dev/null 2>&1; then
  86. rm -rf "$OUT/juce-patched.new"
  87. else
  88. rm -rf "$OUT/juce-patched" && mv "$OUT/juce-patched.new" "$OUT/juce-patched"
  89. rm -f "$OUT/juce/juce_gui_basics.o" "$OUT/juce/juce_audio_processors.o" "$OUT/juce/juce_graphics.o" "$OUT/juce/juce_events.o" "$OUT/juce/juce_audio_devices.o" "$OUT/juce/juce_core.o"
  90. fi
  91. GUI_BASICS_SRC="$OUT/juce-patched/modules/juce_gui_basics"
  92. AUDIO_PROCESSORS_SRC="$OUT/juce-patched/modules/juce_audio_processors"
  93. GRAPHICS_SRC="$OUT/juce-patched/modules/juce_graphics"
  94. EVENTS_SRC="$OUT/juce-patched/modules/juce_events"
  95. AUDIO_DEVICES_SRC="$OUT/juce-patched/modules/juce_audio_devices"
  96. CORE_SRC="$OUT/juce-patched/modules/juce_core"
  97. else
  98. echo "warning: cmake not found; JUCE's drag & drop fixes (cmake/LynxPatchJuce.cmake) are not applied" >&2
  99. fi
  100. # Shared object cache (2026-11-02): JUCE and the third-party C libraries are the same in every worktree, so each object
  101. # is compiled once per key into $LYNX_OBJ_CACHE (default ~/.cache/lynx-objcache) and copied from there by every other
  102. # build. The key hashes the zig version, the target, the whole compile command (with $OUT normalised), JuceConfig.h,
  103. # mingw_compat.h, the patched juce_gui_basics and the third-party sources. Concurrent builds: one compiles a key under
  104. # its flock, the others wait and copy; objects enter the cache by an atomic rename. LYNX_OBJ_CACHE=off disables it.
  105. OBJ_CACHE="${LYNX_OBJ_CACHE:-$HOME/.cache/lynx-objcache}"
  106. ZIG_VERSION="$("$ZIG" version)"
  107. tree_hash() { (cd "$1" && find . -type f | LC_ALL=C sort | xargs -d '\n' sha256sum | sha256sum | cut -c1-64); }
  108. # cached <obj> <key material...> -- <compile command writing <obj>...>
  109. cached() {
  110. local obj="$1" parts=()
  111. shift
  112. while [[ "$1" != -- ]]; do parts+=("$1"); shift; done
  113. shift
  114. if [[ "$OBJ_CACHE" == off ]]; then "$@"; return; fi
  115. local cmd="$*" key name
  116. key="$(printf '%s\n' "$ZIG_VERSION" "$TARGET" "${parts[@]}" "${cmd//$OUT/@OUT@}" | sha256sum | cut -c1-32)"
  117. name="$(basename "$obj" .o)-$key"
  118. mkdir -p "$OBJ_CACHE"
  119. # a hit replays the compiler's warnings and refreshes the entry's date (entries unused for 10 days are pruned)
  120. # (-s, not -f: an empty object left by a crash or a full disk is not a hit; it is compiled again and replaced)
  121. if [[ -s "$OBJ_CACHE/$name.o" ]] && cp "$OBJ_CACHE/$name.o" "$obj.tmp$$" && mv "$obj.tmp$$" "$obj"; then
  122. touch "$OBJ_CACHE/$name.o"; cat "$OBJ_CACHE/$name.err" 2>/dev/null >&2 || true; return 0
  123. fi
  124. (
  125. flock 9
  126. if [[ -s "$OBJ_CACHE/$name.o" ]]; then cp "$OBJ_CACHE/$name.o" "$obj.tmp$$" && mv "$obj.tmp$$" "$obj" && { cat "$OBJ_CACHE/$name.err" 2>/dev/null >&2 || true; }; exit; fi
  127. "$@" 2> "$obj.err$$"; rc=$?
  128. cat "$obj.err$$" >&2
  129. [[ $rc == 0 ]] || { rm -f "$obj.err$$"; exit $rc; }
  130. [[ -s "$obj" ]] || { rm -f "$obj.err$$"; echo "error: $obj is empty after a successful compile (disk full?)" >&2; exit 1; }
  131. mv "$obj.err$$" "$OBJ_CACHE/$name.err"
  132. cp "$obj" "$OBJ_CACHE/.$name.$$" && mv "$OBJ_CACHE/.$name.$$" "$OBJ_CACHE/$name.o"
  133. ) 9> "$OBJ_CACHE/$name.lock"
  134. }
  135. # cached_pp <obj> -- <compile command>: for the app sources, keyed by the preprocessed source (-E -P: every header it
  136. # includes, every macro), so an unchanged file is copied from the cache in any worktree and a header change recompiles
  137. # exactly the files that see it. (zig does not cache -c compiles: before this, every Windows build recompiled ~260 files.)
  138. cached_pp() {
  139. local obj="$1" pp=() skip=0 a h
  140. shift 2
  141. if [[ "$OBJ_CACHE" == off ]]; then "$@"; return; fi
  142. for a in "$@"; do
  143. if [[ $skip == 1 ]]; then skip=0; continue; fi
  144. case "$a" in -c) ;; -o) skip=1 ;; *) pp+=("$a") ;; esac
  145. done
  146. h="$("${pp[@]}" -E -P -w -o - 2>/dev/null | sha256sum | cut -c1-64)"
  147. # (no output: the preprocessor failed, let the compiler report it)
  148. [[ -n "$h" && "$h" != e3b0c44298fc1c14* ]] || { "$@"; return; }
  149. cached "$obj" "pp=$h" -- "$@"
  150. }
  151. JUCE_KEY="$JUCE_DIR $(cat "$OUT/JuceConfig.h" cmake/mingw/mingw_compat.h "$OUT/shim/Dbghelp.h" "$JUCE_DIR/modules/juce_core/system/juce_StandardHeader.h" | sha256sum | cut -c1-64)"
  152. GUI_BASICS_KEY="$(tree_hash "$GUI_BASICS_SRC")"
  153. AUDIO_PROCESSORS_KEY="$(tree_hash "$AUDIO_PROCESSORS_SRC")"
  154. GRAPHICS_KEY="$(tree_hash "$GRAPHICS_SRC")"
  155. EVENTS_KEY="$(tree_hash "$EVENTS_SRC")"
  156. AUDIO_DEVICES_KEY="$(tree_hash "$AUDIO_DEVICES_SRC")"
  157. CORE_KEY="$(tree_hash "$CORE_SRC")"
  158. export ZIG OUT JUCE_DIR TARGET GUI_BASICS_SRC AUDIO_PROCESSORS_SRC GRAPHICS_SRC EVENTS_SRC AUDIO_DEVICES_SRC CORE_SRC OBJ_CACHE ZIG_VERSION JUCE_KEY GUI_BASICS_KEY AUDIO_PROCESSORS_KEY GRAPHICS_KEY EVENTS_KEY AUDIO_DEVICES_KEY CORE_KEY
  159. export -f cached cached_pp
  160. mkdir -p "$OBJ_CACHE" && find "$OBJ_CACHE" -maxdepth 1 -type f -mtime +10 -delete 2>/dev/null || true
  161. export COMMON_STR="${COMMON[*]}"
  162. # JUCE's modules without LTO (round toolchain190gt): LYNX's audio code is in LYNX's own objects, and the big unity modules
  163. # made the ThinLTO link several times longer for UI code
  164. JUCE_COMMON=(); for a in "${COMMON[@]}"; do [[ "$a" == -flto* ]] || JUCE_COMMON+=("$a"); done
  165. export JUCE_COMMON_STR="${JUCE_COMMON[*]}"
  166. export NOLTO_COMMON_STR="$JUCE_COMMON_STR"
  167. # LYNX_WIN_LTO_SKIP: LYNX sources compiled outside ThinLTO (plain objects in the same link), space-separated.
  168. # LYNX_WIN_LTO_SCOPE: all = every LYNX source in ThinLTO; core = only the engine's (src/core, src/flp: the audio code),
  169. # the UI and the rest as plain objects: the link's LTO back end then has about half the code to optimise.
  170. export LYNX_WIN_LTO_SKIP="${LYNX_WIN_LTO_SKIP-src/core/Harmless.cpp}"
  171. export LYNX_WIN_LTO_SCOPE="${LYNX_WIN_LTO_SCOPE:-all}"
  172. echo "Compiling JUCE modules (cached)..."
  173. # the modules and the extra units JUCE's CMake compiles along with them, in one parallel pool
  174. for m in "${MODULES[@]}" juce_core_CompilationTime juce_graphics_Harfbuzz juce_graphics_Sheenbidi juce_audio_processors_ara; do echo "$m"; done | xargs -P "$JOBS" -I{} bash -c '
  175. m={}; obj="$OUT/juce/$m.o"
  176. if [[ ! -f "$obj" || ( "$OUT/JuceConfig.h" -nt "$obj" && "$m" != juce_graphics_Sheenbidi ) ]]; then
  177. echo " JUCE $m"
  178. extra=""
  179. # JUCE ASIO uses MSVC __try/__except: clang accepts it with -fms-extensions, but on MinGW it does not catch
  180. # (a driver crashing while being opened/closed is not contained in this build; the MSVC build keeps the guard)
  181. [[ "$m" == juce_audio_devices ]] && extra="-fms-extensions -DJUCE_DONT_AUTOLINK_TO_WIN32_LIBRARIES=1"
  182. src="$JUCE_DIR/modules/$m/$m.cpp"
  183. key="$JUCE_KEY"
  184. [[ "$m" == juce_gui_basics ]] && src="$GUI_BASICS_SRC/$m.cpp" && key="$JUCE_KEY $GUI_BASICS_KEY"
  185. [[ "$m" == juce_audio_processors ]] && src="$AUDIO_PROCESSORS_SRC/$m.cpp" && key="$JUCE_KEY $AUDIO_PROCESSORS_KEY"
  186. [[ "$m" == juce_graphics ]] && src="$GRAPHICS_SRC/$m.cpp" && key="$JUCE_KEY $GRAPHICS_KEY"
  187. [[ "$m" == juce_events ]] && src="$EVENTS_SRC/$m.cpp" && key="$JUCE_KEY $EVENTS_KEY"
  188. [[ "$m" == juce_audio_devices ]] && src="$AUDIO_DEVICES_SRC/$m.cpp" && key="$JUCE_KEY $AUDIO_DEVICES_KEY"
  189. [[ "$m" == juce_core ]] && src="$CORE_SRC/$m.cpp" && key="$JUCE_KEY $CORE_KEY"
  190. case "$m" in
  191. juce_core_CompilationTime) src="$JUCE_DIR/modules/juce_core/$m.cpp" ;;
  192. juce_graphics_Harfbuzz) src="$JUCE_DIR/modules/juce_graphics/$m.cpp" ;;
  193. juce_audio_processors_ara) src="$AUDIO_PROCESSORS_SRC/$m.cpp"; key="$JUCE_KEY $AUDIO_PROCESSORS_KEY" ;; # (ARA hosting, round 190kx)
  194. esac
  195. if [[ "$m" == juce_graphics_Sheenbidi ]]; then
  196. cached "$obj" "$JUCE_DIR" -- "$ZIG" cc -target "$TARGET" -O2 -w -DJUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1 -I"$JUCE_DIR/modules" -c "$JUCE_DIR/modules/juce_graphics/juce_graphics_Sheenbidi.c" -o "$obj"
  197. else
  198. cached "$obj" "$key" -- $ZIG c++ $JUCE_COMMON_STR $extra -w -c "$src" -o "$obj"
  199. fi
  200. fi'
  201. APP_SOURCES=(src/Main.cpp
  202. src/engine/RemotePatternControl.cpp src/engine/RemoteControl.cpp src/engine/RemoteProjectControl.cpp src/engine/RemoteProjectDocument.cpp
  203. src/engine/RemotePluginControl.cpp src/engine/RemoteInstrumentControl.cpp src/engine/RemotePlaylistControl.cpp
  204. src/engine/GeneratorCatalog.cpp src/ui/RemoteControlSettings.cpp
  205. src/engine/AudioEngine.cpp src/engine/AudioEngineSession.cpp src/engine/ChannelRackProcessor.cpp src/engine/Metronome.cpp
  206. src/engine/SampleLibrary.cpp src/engine/WavPackFormat.cpp src/engine/Mp3Format.cpp src/engine/ProjectFile.cpp src/engine/ProjectDowngrade.cpp src/engine/ProjectPackage.cpp src/engine/PluginHost.cpp src/engine/AraHost.cpp src/engine/AraTest.cpp src/engine/PluginSandbox.cpp src/engine/SandboxWorker.cpp src/engine/Bridge32Test.cpp src/engine/Exporter.cpp src/engine/AacEncoder.cpp src/engine/AacEncoderWindows.cpp src/engine/FlStudioExport.cpp src/engine/StreamPrefetcher.cpp src/engine/DllAsioDevice.cpp src/engine/PipeWireDevice.cpp src/platform/LinuxRealtime.cpp src/engine/ClapFormat.cpp src/engine/Vst2Format.cpp src/engine/JsfxFormat.cpp src/ui/JsfxPanel.cpp src/core/Jsfx.cpp src/engine/MidiFileIo.cpp src/engine/AudioLogger.cpp src/engine/PreviewPlayer.cpp
  207. src/ui/MainComponent.cpp src/ui/PluginKeysTest.cpp src/ui/ZOrder191Test.cpp src/ui/ChannelRackComponent.cpp src/ui/PianoRollComponent.cpp src/ui/PlaylistComponent.cpp src/ui/AraMenu.cpp src/ui/LoopInfo.cpp src/ui/PatternBlocksView.cpp src/ui/MixerRowsView.cpp src/ui/RoutingCablesView.cpp src/ui/MacMenuBar.cpp src/ui/ClipGridComponent.cpp src/ui/GroovePoolComponent.cpp src/ui/DetailView.cpp src/ui/ClipAudioPanel.cpp src/ui/SessionMixer.cpp src/ui/MapMode.cpp src/ui/MidiToolsPanel.cpp src/ui/MixerComponent.cpp src/ui/QuickPick.cpp src/ui/PluginWindow.cpp src/ui/PluginPresetMenu.cpp src/ui/GeneratorPresetMenu.cpp src/ui/ProjectLoading.cpp src/ui/WindowOwner.cpp src/ui/ParametricEqEditor.cpp src/ui/FacetEqEditor.cpp src/ui/ProEditors.cpp src/ui/PluginHeader.cpp src/ui/PluginSkin.cpp src/ui/ExportDialog.cpp src/ui/FlStudioExportDialog.cpp src/ui/AlsExportDialog.cpp src/ui/DawProjectExport.cpp src/ui/FlmExportDialog.cpp src/ui/StemExtract.cpp src/ui/AudioToMidi.cpp src/ui/AutoSamplerDialog.cpp src/ui/AutomationUi.cpp src/ui/ChannelSettings.cpp src/ui/ChordHelper.cpp src/ui/BrowserComponent.cpp src/ui/SampleProperties.cpp src/ui/Theme.cpp src/ui/Icons.cpp src/ui/I18n.cpp src/ui/EditorTools.cpp src/ui/WorkflowExtras.cpp src/ui/KeyFocus.cpp src/ui/TouchInput.cpp
  208. src/core/RollingAudioLog.cpp src/core/ChordReadout.cpp src/core/CacheCheck.cpp src/core/Song.cpp src/core/MarkerPlan.cpp src/core/Scheduler.cpp src/core/ClipLauncher.cpp src/core/SessionOps.cpp src/core/DrawMode.cpp src/core/AutoPointEdit.cpp src/core/RemoteMap.cpp src/core/Groove.cpp src/core/Performance.cpp src/core/Patcherize.cpp src/core/Instruments.cpp src/core/RackRenderer.cpp src/core/LoadTrace.cpp src/core/ModuleWarmup.cpp src/core/RenderAhead.cpp
  209. src/core/FlpImport.cpp src/core/FlpExport.cpp src/core/XmlLite.cpp src/core/Gzip.cpp src/core/AlsImport.cpp src/core/AlsDevices.cpp src/core/AlsDevicesLot2.cpp src/core/AlsDevicesLot3.cpp src/core/AlsDevicesLot4.cpp src/core/AlsDevicesLot5.cpp src/core/AlsExport.cpp src/core/FlmFormat.cpp src/core/FlmImport.cpp src/core/FlmExport.cpp src/core/ModulatorExport.cpp src/core/BandFormat.cpp src/core/BandImport.cpp src/core/FlmEffects.cpp src/core/FlmNoteFx.cpp src/core/FlmDwSampler.cpp src/core/FlmSlicer.cpp src/flp/FlpWrite.cpp src/core/Effects.cpp src/core/NoteEdit.cpp src/core/Recorder.cpp src/core/TakeRecording.cpp src/core/Comping.cpp src/core/Pdc.cpp src/core/WorkerPool.cpp src/core/OverloadGuard.cpp src/core/TimeStretch.cpp src/core/WarpEngines.cpp src/core/Arpeggiator.cpp src/core/SynthPresets.cpp src/core/Slicer.cpp src/core/AudioToMidi.cpp src/core/Templates.cpp src/core/FlWrapper.cpp src/core/FlEffects.cpp src/core/Effector.cpp src/core/VintagePhaser.cpp src/core/EmphasizerFx.cpp src/core/EmphasisFx.cpp src/core/TransporterFl.cpp src/core/EmphasisEngine.cpp src/core/FreqShifterFl.cpp src/core/LowLifterFl.cpp src/core/FlLegacyFx.cpp src/core/PocketFx.cpp src/core/PocketMultiFx.cpp src/core/PocketFxC.cpp src/core/PocketFxD.cpp src/core/PocketFxE.cpp src/core/PocketReverb.cpp src/core/PocketFxB.cpp src/core/PocketFxA.cpp src/core/Reeverb2.cpp src/core/LuxeVerb.cpp src/core/IldspMath.cpp src/core/ConvolverFx.cpp src/core/EquoFx.cpp src/core/PitchShifterFl.cpp src/core/SimSynth.cpp src/core/Wasp.cpp src/core/Granulizer.cpp src/core/Drumaxx.cpp src/core/FruityFilters.cpp src/core/NewtoneFx.cpp src/core/EdisonFx.cpp src/core/VocalPitch.cpp src/core/LynxTune.cpp src/core/LynxVerbs.cpp src/core/NebulaCloud.cpp src/core/MixSuite.cpp src/core/VoiceMatch.cpp src/core/EchoSuite.cpp src/core/LovePhilter.cpp src/core/DistructorFx.cpp src/core/MultibandDelayFx.cpp src/core/FrequencySplitter.cpp src/core/Slayer.cpp src/core/FlangusFastDist.cpp src/core/FruityPhaser.cpp src/core/FruityDelayBank.cpp src/core/FruityMultiband.cpp src/core/Vocodex.cpp src/core/FruityVocoder.cpp src/core/DelphiMath.cpp src/core/MaximusFx.cpp src/core/ParametricEqFl.cpp src/core/ParametricEqLinear.cpp src/core/FruityBasicFx.cpp src/core/TransistorBass.cpp src/core/GrossBeat.cpp src/core/StereoFx.cpp src/core/FruityDelay.cpp src/core/FruityShapers.cpp src/core/ChorusFx.cpp src/core/FruityDynamics.cpp src/core/FlSamplers.cpp src/core/FlSynths.cpp src/core/FlSytrus.cpp src/core/FlGenerators.cpp src/core/PhysicalModels.cpp src/core/DrumSynthLive.cpp src/core/SytrusEngine.cpp src/core/Harmless.cpp src/core/HarmlessFx.cpp src/core/Harmor.cpp src/core/Gms.cpp src/core/Morphine.cpp src/core/Ogun.cpp src/core/Toxic.cpp src/core/ToxicFx.cpp src/core/FruitKick.cpp src/core/BassDrum.cpp src/core/MiniSynth.cpp src/core/Dx10.cpp src/core/Kepler.cpp src/core/PoiZone.cpp src/core/FlPatcher.cpp src/core/Patcher.cpp src/core/Vfx.cpp src/core/VfxSequencer.cpp src/core/Inflate.cpp src/core/WavPack.cpp src/flp/Flp.cpp src/core/EmberClassic.cpp src/core/RhythmPan.cpp src/core/VoxStrip.cpp src/core/Rack.cpp src/core/Fpc.cpp src/core/FpcInstrument.cpp src/core/FpcEnvelope.cpp src/core/BlxImport.cpp src/core/RegionLoop.cpp src/core/SmartControls.cpp src/core/FactoryContent.cpp src/core/LoopKeywords.cpp src/core/SampleProps.cpp src/core/EdisonView.cpp src/core/HarmorResynth.cpp
  210. src/platform/MingwFixes.cpp)
  211. # workflow shell: core (key map, workspace layout, rack operations) and UI (workspace desktop, control contract)
  212. APP_SOURCES+=(src/core/DrumControls.cpp src/core/BankStates.cpp src/core/DrumBanks.cpp src/core/LynxDrums.cpp)
  213. APP_SOURCES+=(src/core/KeyMap.cpp src/core/PresetCycle.cpp src/core/Sfz.cpp src/core/Workspace.cpp src/core/RackOps.cpp src/core/PlaylistTrackOps.cpp src/core/ChannelMiscFx.cpp src/core/MidiImport.cpp src/ui/Workspace.cpp src/ui/NativeChild.cpp src/ui/DockPaintCheck.cpp src/ui/MotionOverlay.cpp src/ui/ExternalDrag.cpp src/ui/ExternalDragX11.cpp src/ui/ValueControl.cpp src/ui/Dialogs.cpp)
  214. # Wave Traveller (round 167f)
  215. APP_SOURCES+=(src/core/WaveTraveller.cpp src/ui/WaveTravellerEditor.cpp)
  216. APP_SOURCES+=(src/core/PolyEdit.cpp src/ui/PolyEditor.cpp third_party/pitchnet-poly/PolyEngine.cpp third_party/pitchnet-poly/PolyExtraction.cpp third_party/pitchnet-poly/PolyPurifier.cpp third_party/pitchnet-poly/PolyRenderer.cpp third_party/pitchnet-poly/PolySoundModel.cpp third_party/pitchnet-poly/PolySpectral.cpp third_party/pitchnet-poly/PolyLazy.cpp) # polyphonic note editor (round 190lk)
  217. APP_SOURCES+=(src/core/DawProject.cpp src/core/ZipLite.cpp) # DAWproject import / export (round 190jf, B22)
  218. APP_SOURCES+=(src/core/FruitySlicer.cpp src/ui/FruitySlicerEditor.cpp)
  219. # FL's Envelope / instrument settings page of the plugin voice processor (round 190f)
  220. APP_SOURCES+=(src/ui/FlVoicePanel.cpp)
  221. APP_SOURCES+=(src/core/Slicex.cpp src/core/SlicexEngine.cpp)
  222. APP_SOURCES+=(src/core/SlicexInstrument.cpp)
  223. APP_SOURCES+=(src/ui/SlicexEditor.cpp)
  224. APP_SOURCES+=(src/ui/FpcEditor.cpp) # round 190q
  225. APP_SOURCES+=(src/ui/TetraEditor.cpp) # round 190hs
  226. APP_SOURCES+=(src/ui/LynxModelEditor.cpp) # round 190ni
  227. APP_SOURCES+=(src/ui/DirectWaveEditor.cpp) # round 190hz
  228. APP_SOURCES+=(src/ui/HelixEditor.cpp) # round 190ja
  229. APP_SOURCES+=(src/ui/ActionSearch.cpp) # round 190nq (#228)
  230. APP_SOURCES+=(src/ui/Onboarding.cpp src/ui/MainOnboarding.cpp src/ui/DemoMode.cpp) # round 190np (first-run onboarding, --demo)
  231. # Windows file association (.lynx) and its icon
  232. APP_SOURCES+=(src/platform/FileTypes.cpp src/platform/Paths.cpp src/platform/Package.cpp src/platform/NativeEmbed.cpp)
  233. # SEH guard around calls into hosted plugins (round 111): the only unit built with -fms-extensions (__try / __except)
  234. APP_SOURCES+=(src/platform/CrashGuard.cpp)
  235. # workflow P2: core (note tools, mixer operations, history labels, browser search)
  236. APP_SOURCES+=(src/core/NoteTools.cpp src/core/MidiTools.cpp src/core/MidiGenerate.cpp src/core/PianoRollTools.cpp src/core/EventEdit.cpp src/core/AudioEdit.cpp src/core/AudioEditTools.cpp src/core/FlAutoSlicer.cpp src/core/MixerOps.cpp src/core/History.cpp src/core/SearchQuery.cpp src/core/SearchIndex.cpp src/core/SearchService.cpp src/core/BrowserView.cpp src/core/EffectPresets.cpp src/core/PluginPresets.cpp src/core/GeneratorPresets.cpp src/core/ParamHelp.cpp)
  237. # workflow P2: UI (note tool dialogs, tool windows, undo history, quick-add palette)
  238. APP_SOURCES+=(src/ui/NoteToolDialogs.cpp src/ui/PianoRollScripts.cpp src/ui/MidiClipboard.cpp src/ui/AudioClipboard.cpp src/ui/EventEditor.cpp src/ui/AudioEditor.cpp src/ui/AudioEditorTools.cpp src/ui/ArticulatorTools.cpp src/ui/ToolWindow.cpp src/ui/DeleteFade.cpp src/ui/StartPage.cpp src/ui/TempoTapper.cpp src/ui/TempoDetectionDialog.cpp src/ui/HistoryPanel.cpp src/ui/VersionsPanel.cpp src/ui/PluginsOffPanel.cpp src/ui/QuickAddPalette.cpp src/ui/PluginPickerView.cpp src/ui/PickerLook.cpp src/ui/ProjectPickerView.cpp src/ui/PluginThumbs.cpp)
  239. # start-up: splash screen and its procedurally synthesised sound
  240. APP_SOURCES+=(src/core/StartupSound.cpp src/core/Speech.cpp src/core/SpeechRules.cpp src/ui/Splash.cpp src/ui/SpeechDialog.cpp)
  241. # main window chrome: hint bar and toolbar widgets
  242. APP_SOURCES+=(src/ui/HintBar.cpp src/ui/Toolbar.cpp)
  243. # FL's 3x Osc engine (REA round 47)
  244. APP_SOURCES+=(src/core/ThreeOsc.cpp)
  245. # FL Studio Mobile's GMSynth (round 190ab)
  246. APP_SOURCES+=(src/core/GmsMobile.cpp)
  247. APP_SOURCES+=(src/core/PocketSuperSaw.cpp)
  248. # Tetra: LYNX's own FM synth and the import of Live's Operator onto it (round 190hs)
  249. APP_SOURCES+=(src/core/FmSynth.cpp src/core/AlsDevicesFm.cpp)
  250. # LYNX Model: LYNX's own physical-modelling instrument, mallets on a modal core (round 190ni)
  251. APP_SOURCES+=(src/core/physmod/ModalBank.cpp src/core/physmod/LynxModel.cpp src/core/LynxModelBank.cpp)
  252. # Track clips: "Clips own their notes" on FL's instrument tracks (round 190ne)
  253. APP_SOURCES+=(src/core/TrackClips.cpp)
  254. # The tracker editor and the module import (round 190nw)
  255. APP_SOURCES+=(src/core/TrackerGrid.cpp src/core/ModuleImport.cpp src/ui/TrackerComponent.cpp)
  256. # Copy and paste between LYNX SHARE windows, the Window menu and the audio device hand-over (round 190nz, #232 stage 2)
  257. APP_SOURCES+=(src/core/CrossPaste.cpp src/engine/CrossClipboard.cpp src/ui/WindowClipboard.cpp src/ui/LynxWindows.cpp src/ui/WindowAudio.cpp)
  258. # Track versions and the import of tracks from another project (round 190pe, research190oe P20 / P11)
  259. APP_SOURCES+=(src/core/TrackVersions.cpp src/core/TrackImport.cpp src/ui/TrackImportDialog.cpp)
  260. # Automatic colours and icons by name (round 190od, #239)
  261. APP_SOURCES+=(src/ui/AutoLookEditor.cpp)
  262. # Helix: LYNX's own wavetable synth and the import of Live's Wavetable onto it (round 190ja)
  263. APP_SOURCES+=(src/core/WavetableSynth.cpp src/core/WavetableTables.cpp src/core/WavetableUser.cpp src/core/AlsDevicesWt.cpp)
  264. # Braid (Live's Meld) and the spectral effects' import, round 190ko
  265. APP_SOURCES+=(src/core/Braid.cpp src/core/BraidParams.cpp src/core/AlsDevicesLot6.cpp)
  266. # onboarding: FL Studio integration (plugin database, sample relocation), background scan, setup wizard
  267. APP_SOURCES+=(src/core/FlPluginDb.cpp src/engine/FlStudio.cpp src/ui/SetupWizard.cpp)
  268. APP_SOURCES+=(src/core/PluginCatalog.cpp src/ui/PluginPicker.cpp)
  269. APP_SOURCES+=(src/core/PluginDbFolder.cpp)
  270. APP_SOURCES+=(src/core/FolderWatcher.cpp)
  271. APP_SOURCES+=(src/core/MissingFiles.cpp src/core/ProjectSafety.cpp src/ui/MissingFilesDialog.cpp src/ui/SettingsDialog.cpp)
  272. # Online Sessions P1: stable ids, parts, stand-ins, packages and their dialogs (round 168a)
  273. APP_SOURCES+=(src/core/SessionIds.cpp src/core/SessionParts.cpp src/core/StandIns.cpp src/engine/SessionPack.cpp src/ui/SessionDialogs.cpp)
  274. # Online Sessions P2: live sessions over the relay (round 169b)
  275. APP_SOURCES+=(src/core/LiveSession.cpp src/core/LiveCrypto.cpp src/engine/LiveLink.cpp src/engine/LiveSessions.cpp src/engine/MediaPack.cpp src/ui/LiveChat.cpp src/engine/LiveTest.cpp src/ui/LiveSessionUi.cpp)
  276. # Online Sessions P5-A1: remote plugins (round 190ai)
  277. APP_SOURCES+=(src/core/RemotePlugins.cpp src/engine/LiveRemotePlugins.cpp src/ui/LiveRemoteUi.cpp)
  278. # round 190c: the device-change and short-export self-tests (issues #134, #138)
  279. APP_SOURCES+=(src/engine/DeviceChangeTest.cpp src/engine/ShortExportTest.cpp)
  280. APP_SOURCES+=(src/engine/ExportParityTest.cpp src/engine/MidiHotplugTest.cpp src/engine/MidiOutPortTest.cpp src/engine/PadRecordTest.cpp src/engine/ShareMemoryTest.cpp)
  281. # round 190rp: the crash-recovery round trip and the sample-0 start with latency (--selftest "stab190rp", --recoverytest)
  282. APP_SOURCES+=(src/engine/RecoveryTest.cpp src/engine/SampleZeroTest.cpp src/engine/DeviceGuard.cpp)
  283. # round 190az: a CLAP plugin deleted on another thread while the message thread is blocked
  284. APP_SOURCES+=(src/engine/ClapTeardownTest.cpp)
  285. APP_SOURCES+=(src/engine/RenderAgainTest.cpp) # round 190ou: offline renders made again (--renderagaintest, --selftest)
  286. APP_SOURCES+=(src/engine/Determinism190poTest.cpp) # round 190po: one render on any threads (--determinismtest190po, --selftest)
  287. APP_SOURCES+=(src/ui/ModRing.cpp src/engine/Modulators190oxTest.cpp) # round 190ox: modulation rings, --selftest modulators190ox (rollup 0.1.31 step 6)
  288. APP_SOURCES+=(src/engine/HostingTests.cpp) # (round 190jg: --sandboxgrouptest, --sandboxbench, --clapext, --automationtimingtest)
  289. # LYNX substitutes for missing third-party plugins (round 98)
  290. APP_SOURCES+=(src/core/PluginSubstitutes.cpp)
  291. # settings pages (General/Audio/MIDI), plugin manager, shortcut manager (round 82)
  292. APP_SOURCES+=(src/core/ThemePalette.cpp src/ui/ThemeSettings.cpp src/ui/ColourPicker.cpp src/ui/TrackIcons.cpp)
  293. # Loop Starter, local (round 168b)
  294. APP_SOURCES+=(src/core/LoopStarter.cpp src/ui/LoopStarterWindow.cpp)
  295. APP_SOURCES+=(src/core/SimpleTracks.cpp src/core/SimplePads.cpp src/core/SimpleSteps.cpp src/core/KeyFollow.cpp src/core/LoopAnalysis.cpp src/ui/SimpleWorkflow.cpp src/ui/FinishDock.cpp) # Simple workflow (rounds 184a, 189k)
  296. APP_SOURCES+=(src/core/GoalKnobs.cpp src/core/ChainPresets.cpp src/core/SoundLibrary.cpp src/ui/SimpleDock.cpp src/ui/SimpleTuner.cpp) # Simple dock: effects, sounds (round 190bu)
  297. APP_SOURCES+=(src/core/GamepadMap.cpp src/ui/GamepadInput.cpp) # game controller control (round 184a, S16)
  298. APP_SOURCES+=(src/core/ControllerProfile.cpp src/core/ControllerSession.cpp src/engine/ControllerIo.cpp src/ui/ControllerBridge.cpp) # MIDI controller profiles (round 190aw)
  299. APP_SOURCES+=(src/core/ExportBundle.cpp src/ui/OtherAppsExport.cpp) # Simple workflow: Export for other apps (round 184a, S9)
  300. APP_SOURCES+=(src/ui/LyricsPanel.cpp src/ui/ReferenceMatchPanel.cpp src/ui/StartFromPanel.cpp) # lyrics, reference match, start from (round 190ch)
  301. APP_SOURCES+=(src/ui/FirstSongTour.cpp) # the Simple workflow's Welcome screen and first-song tour (round 190dv)
  302. APP_SOURCES+=(src/ui/SupportLynx.cpp) # Help › Support LYNX SHARE..., the About button and the start-up support note (round 190fq)
  303. APP_SOURCES+=(src/core/Preferences.cpp src/core/MidiSync.cpp src/engine/MidiSyncIo.cpp src/ui/SettingsPages.cpp src/ui/Notices.cpp src/ui/HowTo.cpp src/ui/PluginManager.cpp src/ui/ShortcutManager.cpp)
  304. APP_SOURCES+=(src/engine/AbletonLink.cpp) # Ableton Link (round 190gl; third_party/link, its own include paths below)
  305. # spectral waveforms: band analysis, background cache and drawing
  306. APP_SOURCES+=(src/core/WaveAnalysis.cpp src/core/Spectrogram.cpp src/ui/WaveformView.cpp)
  307. # FL's Plucked!, Sawer and BeepMap engines (REA round 65)
  308. APP_SOURCES+=(src/core/Plucked.cpp src/core/BeepMap.cpp src/core/Sawer.cpp)
  309. # LYNX Soundfont: SF2 / SF3 player with a preset search (round 158, issue #6)
  310. APP_SOURCES+=(src/core/SoundFont.cpp src/core/SoundFontLoad.cpp src/core/SoundFontIndex.cpp src/ui/SoundFontEditor.cpp)
  311. # other samplers' instruments as DirectWave channels, NCW samples (round 190ii, issue #149)
  312. APP_SOURCES+=(src/core/SamplerImport.cpp src/core/GigFile.cpp src/core/Ncw.cpp src/core/KontaktFile.cpp src/core/SoundFontProgram.cpp src/engine/NcwFormat.cpp src/ui/SamplerImportUi.cpp)
  313. APP_SOURCES+=(src/ui/VfxEditors.cpp)
  314. # the Browser's "Find similar samples" (round 190as)
  315. APP_SOURCES+=(src/core/SampleSimilarity.cpp)
  316. # the embedded Python (pocketpy) and FL's VFX Script (round 165d)
  317. APP_SOURCES+=(src/core/Python.cpp src/core/VfxScript.cpp src/core/EdisonScript.cpp src/core/ScriptDialog.cpp src/core/PianoRollScript.cpp)
  318. # FL's sampler interpolation (REA round 69)
  319. APP_SOURCES+=(src/core/FlResampler.cpp src/core/FlKeys.cpp)
  320. # FL's Hardcore (REA round 71)
  321. APP_SOURCES+=(src/core/HardcoreFx.cpp)
  322. # LYNX's Facet EQ and Apex Limiter (round 99)
  323. APP_SOURCES+=(src/core/FacetEq.cpp src/core/ApexLimiter.cpp src/core/Mastering.cpp src/core/MasterLooks.cpp)
  324. # LYNX's dynamics suite and FabFilter state translation (round 108)
  325. APP_SOURCES+=(src/core/DynamicsSuite.cpp src/core/FabFilterStates.cpp src/ui/DynamicsDisplays.cpp)
  326. # LYNX's voice tools: Quell Denoiser, Gemini Doubler (round 119)
  327. APP_SOURCES+=(src/core/VoiceTools.cpp)
  328. # MIDI CC automation of hosted plugins, Formula Controller (round 133, issue #3)
  329. APP_SOURCES+=(src/core/MidiControls.cpp src/core/MidiOut.cpp src/core/FormulaController.cpp src/ui/ControllerEditors.cpp src/ui/MidiOutEditor.cpp)
  330. # controller links: Remote control settings window, mapping formula (round 190bt)
  331. APP_SOURCES+=(src/core/LinkFormula.cpp src/ui/RemoteControl.cpp)
  332. APP_SOURCES+=(src/core/VoiceShift.cpp)
  333. # FL engines usable in native projects (round 142, issue #5)
  334. APP_SOURCES+=(src/core/NativeEngines.cpp src/core/LynxBanks.cpp src/core/ModelParams.cpp src/core/FlInstall.cpp src/core/NativeData.cpp src/core/NativeDataSets.cpp src/core/TransistorBassBank.cpp src/core/MiniSynthBank.cpp src/core/SawerBank.cpp src/core/BassDrumBank.cpp src/core/NativeWavesGms.cpp src/core/GmsBank.cpp src/core/SytrusBank.cpp src/core/OgunBank.cpp src/core/MorphineBank.cpp src/core/NativeSlots.cpp src/core/NativeCabinets.cpp src/core/NativeKeys.cpp src/core/FlKeysBank.cpp src/core/KeplerBank.cpp src/core/SlayerBank.cpp src/core/HarmorBank.cpp src/core/ToxicBank.cpp src/core/PoiZoneBank.cpp src/core/ModelParamsSynths.cpp src/core/PluginLayoutSynths.cpp src/core/HarmlessBank.cpp src/core/Dx10Bank.cpp src/core/SimSynthBank.cpp src/core/BeepMapBank.cpp src/core/GranulizerBank.cpp src/core/HelixBank.cpp src/core/EngineLayouts.cpp src/ui/NewtoneEditor.cpp)
  335. APP_SOURCES+=(src/core/Layer.cpp src/ui/LayerEditor.cpp) # FL's Layer channel (round 164)
  336. APP_SOURCES+=(src/core/XyController.cpp src/core/FlCurve.cpp src/core/ControlSurface.cpp src/ui/Controllers164.cpp) # X-Y (-Z) Controller, Control Surface, Dashboard (round 164)
  337. APP_SOURCES+=(src/core/VoltageController.cpp src/ui/VoltageEditor.cpp) # Voltage Controller (round 164)
  338. # FL's DirectWave (REA round 72)
  339. APP_SOURCES+=(src/core/DirectWave.cpp)
  340. APP_SOURCES+=(src/core/DirectWaveState.cpp)
  341. # Ogg Vorbis decoding as FL does (REA round 77)
  342. APP_SOURCES+=(src/core/OggVorbis.cpp)
  343. # export options + MP3, plugin performance monitor, clip properties / arrangements, new project, touch keyboard (round 84)
  344. APP_SOURCES+=(src/core/ExportOptions.cpp src/core/Mp3Encoder.cpp src/core/Mp3Decoder.cpp src/core/PluginMonitor.cpp src/core/PlaylistOps.cpp src/core/QuickRender.cpp src/core/ProjectContents.cpp src/core/TempoDetect.cpp src/core/AutoWarp.cpp src/core/ScoreLog.cpp src/core/ChannelLoops.cpp src/core/PatternBlocks.cpp src/core/ChannelBurn.cpp src/core/AutoSampler.cpp)
  345. APP_SOURCES+=(src/ui/NewProjectDialog.cpp src/ui/ClipProperties.cpp src/ui/PluginMonitorWindow.cpp src/ui/TouchKeyboard.cpp)
  346. # native plugin editors in FL's arrangement (round 93)
  347. APP_SOURCES+=(src/core/PluginLayout.cpp src/core/StateParams.cpp src/ui/PluginEditors.cpp src/ui/PatcherEditor.cpp src/ui/RackEditor.cpp src/ui/DrumRackShot.cpp)
  348. # crash / freeze reports: consent, anonymiser, upload, GitHub form (round 159)
  349. APP_SOURCES+=(src/core/CrashReport.cpp src/ui/CrashReporter.cpp)
  350. # in-app update check + Update button (round 166b)
  351. APP_SOURCES+=(src/core/UpdateCheck.cpp src/ui/Updater.cpp)
  352. APP_SOURCES+=(src/core/AudioCheck.cpp src/ui/AudioCheck.cpp)
  353. # visual plugins: Wave Candy, Visualizer, video export (round 164c)
  354. APP_SOURCES+=(src/core/VisualFx.cpp src/ui/VisualEditors.cpp)
  355. # FL plugins LYNX lacked: Mute 2, Big Clock, Tuner, HTML NoteBook (round 165g)
  356. APP_SOURCES+=(src/core/FlExtraFx.cpp src/core/Scratcher.cpp src/core/Dvs.cpp src/core/Transmitter.cpp src/ui/FlExtraEditors.cpp src/core/VideoPlayer.cpp src/core/VideoTime.cpp src/core/VideoTrack.cpp src/core/Adr.cpp src/core/DialogueAlign.cpp src/ui/VideoPlayerView.cpp src/ui/VideoMedia.cpp src/ui/VideoMediaWindows.cpp src/ui/VideoTracks.cpp src/ui/AdrWindow.cpp)
  357. APP_SOURCES+=(src/core/VisualFx.cpp src/core/FruityDance.cpp src/ui/VisualEditors.cpp src/ui/VisualGl.cpp src/ui/DanceView.cpp)
  358. for lib in wavpack vorbis lame pocketpy monocypher; do declare "TP_KEY_$lib=$(tree_hash third_party/$lib)"; done
  359. TP_KEY_libxmp_lite="$(tree_hash third_party/libxmp-lite)"
  360. echo "WavPack (decoder, C)..."
  361. mkdir -p "$OUT/wavpack"
  362. for f in third_party/wavpack/src/*.c; do
  363. obj="$OUT/wavpack/$(basename "$f" .c).o"
  364. if [[ ! -f "$obj" || "$f" -nt "$obj" ]]; then
  365. cached "$obj" "$TP_KEY_wavpack" -- "$ZIG" cc -target "$TARGET" -O2 -w -DHAVE___BUILTIN_CLZ=1 -Ithird_party/wavpack/include -Ithird_party/wavpack/src -c "$f" -o "$obj"
  366. fi
  367. done
  368. echo "libogg + libvorbis (decoder, C)..."
  369. mkdir -p "$OUT/vorbis"
  370. for f in third_party/vorbis/src/*.c; do
  371. [[ "$(basename "$f")" == lookup.c ]] && continue # (included by lsp.c)
  372. obj="$OUT/vorbis/$(basename "$f" .c).o"
  373. if [[ ! -f "$obj" || "$f" -nt "$obj" ]]; then
  374. cached "$obj" "$TP_KEY_vorbis" -- "$ZIG" cc -target "$TARGET" -O2 -w -ffp-contract=off -include third_party/vorbis/include/lynx_vorbis_prefix.h -Ithird_party/vorbis/include -Ithird_party/vorbis/src -c "$f" -o "$obj"
  375. fi
  376. done
  377. echo "LAME libmp3lame (MP3 encoder, C)..."
  378. mkdir -p "$OUT/lame"
  379. for f in third_party/lame/src/*.c; do
  380. obj="$OUT/lame/$(basename "$f" .c).o"
  381. if [[ ! -f "$obj" || "$f" -nt "$obj" ]]; then
  382. cached "$obj" "$TP_KEY_lame" -- "$ZIG" cc -target "$TARGET" -O2 -w -DHAVE_CONFIG_H -Ithird_party/lame/include -Ithird_party/lame/src -c "$f" -o "$obj"
  383. fi
  384. done
  385. echo "pocketpy (embedded Python, C)..."
  386. mkdir -p "$OUT/pocketpy"
  387. obj="$OUT/pocketpy/pocketpy.o"
  388. if [[ ! -f "$obj" || third_party/pocketpy/pocketpy.c -nt "$obj" || third_party/pocketpy/pocketpy.h -nt "$obj" ]]; then
  389. cached "$obj" "$TP_KEY_pocketpy" -- "$ZIG" cc -target "$TARGET" -O2 -w -std=c11 -DPK_ENABLE_OS=0 -DPK_ENABLE_WATCHDOG=1 -Ithird_party/pocketpy -c third_party/pocketpy/pocketpy.c -o "$obj"
  390. fi
  391. echo "libxmp-lite (module reader, C)..."
  392. mkdir -p "$OUT/libxmp"
  393. for f in third_party/libxmp-lite/src/*.c third_party/libxmp-lite/src/loaders/*.c; do
  394. obj="$OUT/libxmp/$(basename "$f" .c).o"
  395. if [[ ! -f "$obj" || "$f" -nt "$obj" ]]; then
  396. cached "$obj" "$TP_KEY_libxmp_lite" -- "$ZIG" cc -target "$TARGET" -O2 -w -std=c99 -DLIBXMP_CORE_PLAYER -DLIBXMP_STATIC -Ithird_party/libxmp-lite/include/libxmp-lite -Ithird_party/libxmp-lite/src -c "$f" -o "$obj"
  397. fi
  398. done
  399. echo "ysfx + EEL2 (JSFX runtime, round 190pj)..."
  400. # (as CMakeLists.txt's lynx_ysfx: ysfx's cmake.wdl.txt / cmake.ysfx.txt flags, no @gfx; the GAS x86-64 code generator
  401. # serves the Win64 ABI too)
  402. TP_KEY_ysfx="$(tree_hash third_party/ysfx)"
  403. mkdir -p "$OUT/ysfx"
  404. YSFX_WDL=third_party/ysfx/thirdparty/WDL/source/WDL
  405. YSFX_DEFS=(-DYSFX_API= -DYSFX_NO_GFX -DWDL_FFT_REALSIZE=8 -DWDL_LINEPARSE_ATOF=ysfx_wdl_atof -DNSEEL_ATOF=ysfx_wdl_atof -DNOMINMAX -DYSFX_NO_FTS
  406. -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS -Ithird_party/ysfx/include -Ithird_party/ysfx/sources
  407. -Ithird_party/ysfx/thirdparty/WDL/source -Ithird_party/ysfx/thirdparty/dr_libs)
  408. for f in third_party/ysfx/sources/ysfx*.cpp "$YSFX_WDL"/fft.c "$YSFX_WDL"/win32_utf8.c "$YSFX_WDL"/eel2/nseel-*.c \
  409. third_party/ysfx/sources/eel2-gas/sources/asm-nseel-x64-sse.S; do
  410. name="$(basename "$f")"; obj="$OUT/ysfx/${name%.*}.o"
  411. if [[ ! -f "$obj" || "$f" -nt "$obj" ]]; then
  412. case "$f" in
  413. *.cpp) cached "$obj" "$TP_KEY_ysfx" -- "$ZIG" c++ -target "$TARGET" -O2 -w -std=c++17 -fsigned-char "${YSFX_DEFS[@]}" -c "$f" -o "$obj" ;;
  414. *.S) cached "$obj" "$TP_KEY_ysfx" -- "$ZIG" cc -target "$TARGET" -O2 -w "${YSFX_DEFS[@]}" -c "$f" -o "$obj" ;;
  415. *) cached "$obj" "$TP_KEY_ysfx" -- "$ZIG" cc -target "$TARGET" -O2 -w -std=c11 -fsigned-char "${YSFX_DEFS[@]}" -c "$f" -o "$obj" ;;
  416. esac
  417. fi
  418. done
  419. echo "Monocypher (live session encryption, C)..."
  420. mkdir -p "$OUT/monocypher"
  421. obj="$OUT/monocypher/monocypher.o"
  422. if [[ ! -f "$obj" || third_party/monocypher/monocypher.c -nt "$obj" || third_party/monocypher/monocypher.h -nt "$obj" ]]; then
  423. cached "$obj" "$TP_KEY_monocypher" -- "$ZIG" cc -target "$TARGET" -O2 -w -Ithird_party/monocypher -c third_party/monocypher/monocypher.c -o "$obj"
  424. fi
  425. # the commit the build comes from (crash reports name it)
  426. COMMIT="$(git rev-parse --short=10 HEAD 2>/dev/null || true)"
  427. [[ -n "$(git status --porcelain --untracked-files=no 2>/dev/null)" ]] && COMMIT="$COMMIT-dirty"
  428. printf '#pragma once\n#define LYNX_GIT_COMMIT "%s"\n' "$COMMIT" > "$OUT/lynx_build.h"
  429. # -Werror=return-type (round 190ci): a value-returning function or lambda that can end without a return is undefined
  430. # behaviour that clang compiles to "fall into the next function". A merge that dropped one `return` line shipped that
  431. # way in the 0.1.26 release candidate (the FPC editor's channel lookup: adding an FPC channel ended LYNX) with only a
  432. # warning in the log. It is an error in LYNX's own sources.
  433. echo "Compiling the app..."
  434. printf '%s\n' "${APP_SOURCES[@]}" | xargs -P "$JOBS" -I{} bash -c '
  435. src={}; obj="$OUT/app/$(echo "$src" | tr / _).o"
  436. extra=""; [[ "$src" == src/platform/CrashGuard.cpp ]] && extra="-fms-extensions"
  437. [[ "$src" == src/ui/CrashReporter.cpp ]] && extra="-iquote $OUT"
  438. [[ "$src" == src/engine/AbletonLink.cpp ]] && extra="-isystem third_party/link/include -isystem third_party/link/asio/include"
  439. common="$COMMON_STR"; [[ " $LYNX_WIN_LTO_SKIP " == *" $src "* ]] && common="$NOLTO_COMMON_STR"
  440. [[ "$LYNX_WIN_LTO_SCOPE" == core && "$src" != src/core/* && "$src" != src/flp/* ]] && common="$NOLTO_COMMON_STR"
  441. cached_pp "$obj" -- $ZIG c++ $common $extra -Wall -Wextra -Werror=return-type -c "$src" -o "$obj"'
  442. # 2026-11-04: an object whose source left APP_SOURCES (another branch's build in this folder) must not be linked
  443. # by the app/*.o glob below: it broke unrelated landings with undefined symbols.
  444. declare -A KEEP_OBJ=(); for src in "${APP_SOURCES[@]}"; do KEEP_OBJ["$OUT/app/$(echo "$src" | tr / _).o"]=1; done
  445. for obj in "$OUT"/app/*.o; do [[ -n "${KEEP_OBJ[$obj]:-}" ]] || { echo "removing stale object $obj"; rm -f "$obj"; }; done
  446. echo "Resources (manifest, icons, version $VERSION)..."
  447. OUT_ABS="$(cd "$OUT" && pwd)"
  448. IFS=. read -r VMAJ VMIN VPAT VREV <<< "$VERSION" # (VREV: a hotfix's fourth number, "0.1.31.1"; 0 when absent)
  449. {
  450. echo '#pragma once'
  451. echo "#define LYNX_VERSION_MAJOR $VMAJ"
  452. echo "#define LYNX_VERSION_MINOR $VMIN"
  453. echo "#define LYNX_VERSION_PATCH $VPAT"
  454. echo "#define LYNX_VERSION_REVISION ${VREV:-0}"
  455. echo "#define LYNX_VERSION_STR \"$VERSION\""
  456. } > "$OUT/lynx_version.h"
  457. ( cd resources && "$ZIG" rc /i "$OUT_ABS" /fo "$OUT_ABS/LYNX.res" LYNX.rc )
  458. echo "Linking..."
  459. # only the objects of this tree's sources: an object left in $OUT/app by a build of another branch (a merge-train
  460. # bisect step without that branch) must never be linked in
  461. APP_OBJECTS=()
  462. for src in "${APP_SOURCES[@]}"; do APP_OBJECTS+=("$OUT/app/$(echo "$src" | tr / _).o"); done
  463. # (one list: the plugins of LYNX_BUILD_PLUGINS=1 below link the same app objects, so they need the same libraries)
  464. APP_LIBS=(-lole32 -loleaut32 -luuid -lwinmm -lws2_32 -lshlwapi -lversion -lwininet -limm32 -lcomdlg32
  465. -lgdi32 -luser32 -lcomctl32 -lshell32 -ladvapi32 -lrpcrt4 -ldbghelp -lsetupapi -luxtheme -ldwmapi
  466. -ld2d1 -ldcomp -ldwrite -ldxgi -ld3d11 -ldxguid -lwsock32 -lopengl32 -lpropsys -lmfplat -lmfreadwrite -lmfuuid -lksuser -lavrt -lwinhttp -lbcrypt
  467. -liphlpapi) # (iphlpapi: Ableton Link's network interfaces, round 190gl)
  468. link_start=$(date +%s)
  469. LINK_INPUTS=("$OUT"/juce/*.o "${APP_OBJECTS[@]}" "$OUT"/wavpack/*.o "$OUT"/vorbis/*.o "$OUT"/lame/*.o "$OUT"/pocketpy/*.o "$OUT"/monocypher/*.o "$OUT"/libxmp/*.o "$OUT"/ysfx/*.o "$OUT/LYNX.res")
  470. plain_link() {
  471. "$ZIG" c++ -target "$TARGET" "${WIN_OPT[@]}" "${WIN_LTO[@]}" -o "$OUT/LYNX.exe" "${LINK_INPUTS[@]}" -Wl,--subsystem,windows "${APP_LIBS[@]}"
  472. }
  473. # LYNX_WIN_GC=1 (round toolchain190gt): zig links with -DEBUG (LYNX.pdb, for the crash reports) and passes no -OPT flag,
  474. # so lld keeps every function of every object (-opt:noref -opt:noicf), and zig refuses -Wl,--gc-sections / --icf for
  475. # COFF. So the link runs through zig's own lld-link with the command zig itself builds (taken from the link of a stub
  476. # object with the same flags and libraries: the C runtime, libc++, the import libraries), the stub replaced by LYNX's
  477. # objects, plus -OPT:REF (drop what nothing references) and -OPT:SAFEICF (fold identical functions whose address is never
  478. # taken, from the objects' address-significance tables, -faddrsig). One link, ThinLTO included. If that cannot be
  479. # done, the plain zig link runs instead.
  480. gc_link() {
  481. printf 'int main() { return 0; }\n' > "$OUT/linkstub.cpp"
  482. "$ZIG" c++ -target "$TARGET" -c "$OUT/linkstub.cpp" -o "$OUT/linkstub.o" || return 1
  483. local line args=() a
  484. line="$(ZIG_VERBOSE_LINK=1 "$ZIG" c++ -target "$TARGET" "${WIN_OPT[@]}" "${WIN_LTO[@]}" -o "$OUT/linkstub.exe" "$OUT/linkstub.o" \
  485. -Wl,--subsystem,windows "${APP_LIBS[@]}" 2>&1 > /dev/null | grep -m 1 '^lld-link ')" || return 1
  486. read -ra LINK_CMD <<< "$line"
  487. for a in "${LINK_CMD[@]:1}"; do
  488. case "$a" in
  489. "$OUT/linkstub.o") args+=("${LINK_INPUTS[@]}") ;;
  490. -OUT:*) args+=("-OUT:$OUT/LYNX.exe") ;;
  491. -PDB:*) args+=("-PDB:$OUT/LYNX.pdb") ;;
  492. -PDBALTPATH:*) args+=("-PDBALTPATH:LYNX.pdb") ;;
  493. -IMPLIB:*) ;;
  494. *) args+=("$a") ;;
  495. esac
  496. done
  497. [[ " ${args[*]} " == *" $OUT/LYNX.res "* ]] || return 1
  498. rm -f "$OUT/linkstub".*
  499. # ThinLTO: one backend job per build job (lld's default is the physical cores: 2 on a 4-thread CI runner), and a cache
  500. # so a relink after a small change recompiles only the modules that changed
  501. [[ ${#WIN_LTO[@]} -gt 0 ]] && args+=("-OPT:lldltojobs=$JOBS" "-lldltocache:$OUT/ltocache")
  502. "$ZIG" lld-link "${args[@]}" -OPT:REF -OPT:SAFEICF
  503. }
  504. if [[ "$LYNX_WIN_GC" == 1 ]]; then
  505. gc_link || { echo "warning: the -OPT:REF link did not run; plain link" >&2; plain_link; }
  506. else
  507. plain_link
  508. fi
  509. echo "link: $(( $(date +%s) - link_start )) s"
  510. ls -la "$OUT/LYNX.exe"
  511. # LYNX ASIO driver (REA round 97), shipped next to LYNX.exe
  512. OUT="$OUT" ZIG="$ZIG" scripts/build-lynx-asio.sh
  513. # the 32-bit plugin bridge (round 176a), shipped next to LYNX.exe; it reuses the patched JUCE copies and the object cache
  514. OUT="$OUT" ZIG="$ZIG" JUCE_DIR="$JUCE_DIR" JOBS="$JOBS" scripts/build-bridge32.sh
  515. # LYNX's own plugins as VST3 / CLAP (round 180b, docs/PLUGIN_EXPORT.md): only with LYNX_BUILD_PLUGINS=1; the normal build stops above
  516. if [[ "${LYNX_BUILD_PLUGINS:-0}" == 1 ]]; then
  517. PLUGIN_OBJECTS=()
  518. for src in "${APP_SOURCES[@]}"; do [[ "$src" == src/Main.cpp ]] || PLUGIN_OBJECTS+=("$OUT/app/$(echo "$src" | tr / _).o"); done
  519. mkdir -p "$OUT/plugin" "$OUT/plugins"
  520. PLUGIN_LIBS=("${APP_LIBS[@]}" -lpsapi)
  521. plugin_cxx() { # <obj> <source> [flags...]
  522. local obj="$1" source="$2"; shift 2
  523. cached_pp "$obj" -- $ZIG c++ $COMMON_STR -Isrc -DLYNX_EXPORT_VERSION="\"$VERSION\"" -DJUCE_MODULE_AVAILABLE_juce_audio_plugin_client=1 "$@" -c "$source" -o "$obj"
  524. }
  525. # (round 190sh: the plugin's own entry object goes last, so the shared engine before it is laid out the same way in the CLAP and
  526. # in every VST3, and the .7z's solid stream finds more of each VST3 in the files before it: 21.5 -> 20.2 MB locally. The zip
  527. # cannot use that: it packs every file alone)
  528. plugin_link() { # <output> <entry objects...>
  529. local output="$1"; shift
  530. "$ZIG" c++ -target "$TARGET" "${WIN_OPT[@]}" "${WIN_LTO[@]}" -shared -s -o "$output" "$OUT/plugin/ExportProcessor.o" "${PLUGIN_OBJECTS[@]}" "$OUT"/juce/*.o "$OUT"/wavpack/*.o "$OUT"/vorbis/*.o "$OUT"/lame/*.o "$OUT"/pocketpy/*.o "$OUT"/monocypher/*.o "$OUT"/libxmp/*.o "$OUT"/ysfx/*.o "$OUT/plugin/LynxPlugin.res" "$@" "${PLUGIN_LIBS[@]}" -Wl,--gc-sections
  531. rm -f "$(dirname "$output")"/*.lib "$(dirname "$output")"/*.pdb # (the linker's import library: not part of a plugin)
  532. }
  533. ( cd resources && "$ZIG" rc /fo "$OUT_ABS/plugin/LynxPlugin.res" LynxPlugin.rc )
  534. plugin_cxx "$OUT/plugin/ExportProcessor.o" src/plugin/ExportProcessor.cpp -Wall -Wextra
  535. plugin_cxx "$OUT/plugin/ClapEntry.o" src/plugin/ClapEntry.cpp -Wall -Wextra
  536. plugin_link "$OUT/plugins/LYNX Plugins.clap" "$OUT/plugin/ClapEntry.o"
  537. index=0 # (one table, src/plugin/plugins.def: every built entry; the index counts them, plugin/ExportCatalog.h)
  538. while IFS='~' read -r name synth code category built; do
  539. # built = 2: a VST3 of its own as well (1: in the CLAP only)
  540. [[ "$built" == 2 ]] || { index=$((index + 1)); continue; }
  541. dir="$OUT/plugins/$name.vst3/Contents/x86_64-win"
  542. mkdir -p "$dir"
  543. plugin_cxx "$OUT/plugin/Vst3Entry$index.o" src/plugin/Vst3Entry.cpp -w -DLYNX_EXPORT_INDEX=$index "-DJucePlugin_Name=\"$name\"" -DJucePlugin_IsSynth=$synth \
  544. -DJucePlugin_PluginCode=$code "-DJucePlugin_Vst3Category=\"$category\""
  545. plugin_link "$dir/$name.vst3" "$OUT/plugin/Vst3Entry$index.o"
  546. index=$((index + 1))
  547. done < <(sed -nE 's/^LYNX_PLUGIN \("([^"]+)", ([01]), [^,]+, [^,]+, "[^"]+", (0x[0-9a-f]+), "([^"]+)", ([12])\)$/\1~\2~\3~\4~\5/p' src/plugin/plugins.def)
  548. plugin_cxx "$OUT/plugin/plugexporttest.o" tools/plugexporttest.cpp -Wall -Wextra
  549. plugin_cxx_link=("$OUT/plugin/plugexporttest.o" "$OUT/plugin/ExportProcessor.o" "${PLUGIN_OBJECTS[@]}" "$OUT"/juce/*.o "$OUT"/wavpack/*.o "$OUT"/vorbis/*.o "$OUT"/lame/*.o "$OUT"/pocketpy/*.o "$OUT"/monocypher/*.o "$OUT"/libxmp/*.o "$OUT"/ysfx/*.o "$OUT/LYNX.res")
  550. "$ZIG" c++ -target "$TARGET" "${WIN_OPT[@]}" "${WIN_LTO[@]}" -o "$OUT/plugexporttest.exe" "${plugin_cxx_link[@]}" "${PLUGIN_LIBS[@]}"
  551. ls -la "$OUT"/plugins/*.clap "$OUT"/plugins/*/Contents/x86_64-win/*
  552. fi