Subject: [bug#58572] gnu: Add bespokesynth

From: Sughosha <[email-masked]>
Date: Sun, 16 Oct 2022 19:23:56 +0000

Empty Message

From f5faeab2060204a0afb22574acc0b72d430fee18 Mon Sep 17 00:00:00 2001
From: Sughosha <[email-masked]>
Date: Sun, 16 Oct 2022 16:01:53 +0200
Subject: [PATCH 1/4] gnu: Add juce

* gnu/packages/music.scm (juce): New variable.
---
 gnu/packages/music.scm | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/gnu/packages/music.scm b/gnu/packages/music.scm
index 6b37c79389..0662ec272d 100644
--- a/gnu/packages/music.scm
+++ b/gnu/packages/music.scm
@@ -1875,6 +1875,38 @@ (define-public tascam-gtk
 device supports.")
       (license license:expat))))
 
+(define-public juce
+  (package
+    (name "juce")
+    (version "7.0.2")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/juce-framework/JUCE")
+                    (commit version)))
+              (sha256
+               (base32
+                "0sswn2c9bm8nzcfwba2i3827pbrzi9syihg90kfhay7m5nizb78v"))))
+    (build-system cmake-build-system)
+    ;; TODO: Use installed packages instead of bundled dependencies.
+    (arguments
+     (list #:tests? #f)) ;no test suite
+    (native-inputs (list pkg-config))
+    (inputs (list alsa-lib
+                  curl
+                  freetype
+                  jack-1
+                  libx11
+                  python
+                  webkitgtk-with-libsoup2))
+    (home-page "https://juce.com")
+    (synopsis "Cross-platform C++ application framework")
+    (description
+     "JUCE is a cross-platform C++ application framework for creating
+applications including VST, VST3, AU, AUv3, AAX and LV2 audio plug-ins and
+plug-in hosts.")
+    (license (list license:gpl3 license:isc))))
+
 (define-public bsequencer
   (package
     (name "bsequencer")
-- 
2.38.0

From 787aac424c777d01937713da3aaab39fd7d7039e Mon Sep 17 00:00:00 2001
From: Sughosha <[email-masked]>
Date: Sun, 16 Oct 2022 16:02:24 +0200
Subject: [PATCH 2/4] gnu: Add tuning-library

* gnu/packages/music.scm (tuning-library): New variable.
---
 gnu/packages/music.scm | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/gnu/packages/music.scm b/gnu/packages/music.scm
index 0662ec272d..7619721b04 100644
--- a/gnu/packages/music.scm
+++ b/gnu/packages/music.scm
@@ -1907,6 +1907,44 @@ (define-public juce
 plug-in hosts.")
     (license (list license:gpl3 license:isc))))
 
+(define-public tuning-library
+  (package
+    (name "tuning-library")
+    (version "1.1.0")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/surge-synthesizer/tuning-library")
+                    (commit (string-append "release_" version))))
+              (file-name (git-file-name name version))
+              (patches (search-patches
+                        "tuning-library-1.1.0-fix_missing_include.patch"))
+              (sha256
+               (base32
+                "0f7915xn61sqbdla1zamjd2nkbvdzlm162dmqap2j40yhra73q65"))))
+    (build-system cmake-build-system)
+    (arguments
+     (list #:phases #~(modify-phases %standard-phases
+                        (replace 'check
+                          (lambda _
+                            (invoke "make" "run-all-tests")))
+                        (replace 'install
+                          (lambda _
+                            (install-file (string-append #$source
+                                                         "/include/Tunings.h")
+                                          (string-append #$output
+                                                         "/include"))
+                            (install-file (string-append
+                                           #$source "/include/TuningsImpl.h")
+                                          (string-append #$output
+                                                         "/include")))))))
+    (home-page "https://surge-synth-team.org/tuning-library/")
+    (synopsis "C++ Library for micro-tuning and frequency finding")
+    (description
+     "Tuning Library is a header-only C++ library for micro-tuning format
+parsing and frequency finding.")
+    (license license:expat)))
+
 (define-public bsequencer
   (package
     (name "bsequencer")
-- 
2.38.0

From db060b722592071d350c4fdb0198b05864ad4819 Mon Sep 17 00:00:00 2001
From: Sughosha <[email-masked]>
Date: Sun, 16 Oct 2022 16:02:52 +0200
Subject: [PATCH 3/4] gnu: Add readerwriterqueue

* gnu/packages/music.scm (readerwriterqueue): New variable.
---
 gnu/packages/music.scm | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/gnu/packages/music.scm b/gnu/packages/music.scm
index 7619721b04..96892bb746 100644
--- a/gnu/packages/music.scm
+++ b/gnu/packages/music.scm
@@ -1945,6 +1945,36 @@ (define-public tuning-library
 parsing and frequency finding.")
     (license license:expat)))
 
+(define-public readerwriterqueue
+  (package
+    (name "readerwriterqueue")
+    (version "1.0.6")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                     (url "https://github.com/cameron314/readerwriterqueue")
+                     (commit (string-append "v" version))))
+              (sha256
+               (base32
+                "15yqw51lfmib03rj81vnizpnyf2fi11qk4zfvsq6br158znmgcw3"))))
+    (build-system cmake-build-system)
+    (arguments
+     (list #:tests? #f ;no test suite
+           #:phases
+            #~(modify-phases %standard-phases
+                ;; Exclude license file from include folder
+                (add-after 'unpack 'exclude-license-file
+                 (lambda _
+                   (substitute* "CMakeLists.txt"
+                     (("LICENSE.md ") "")))))))
+    (home-page "https://github.com/cameron314/readerwriterqueue")
+    (synopsis "Single-producer, single-consumer lock-free queue for C++")
+    (description
+     "readerwriterqueue is a Single-producer, single-consumer lock-free queue
+for C++.  It only supports a two-thread use case (one consuming, and one
+producing).")
+    (license license:bsd-2)))
+
 (define-public bsequencer
   (package
     (name "bsequencer")
-- 
2.38.0

From a37d658780866fb72148dac40ac7b7ad6a6ec034 Mon Sep 17 00:00:00 2001
From: Sughosha <[email-masked]>
Date: Sun, 16 Oct 2022 16:04:58 +0200
Subject: [PATCH 4/4] gnu: Add bespokesynth

* gnu/packages/music.scm (bespokesynth): New variable.
                         (mts-esp): New variable.
---
 gnu/packages/music.scm | 89 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 89 insertions(+)

diff --git a/gnu/packages/music.scm b/gnu/packages/music.scm
index 96892bb746..53a76cde64 100644
--- a/gnu/packages/music.scm
+++ b/gnu/packages/music.scm
@@ -1974,6 +1974,96 @@ (define-public readerwriterqueue
 producing).")
     (license license:bsd-2)))
 
+(define mts-esp
+  (origin
+    (method git-fetch)
+    (uri (git-reference
+           (url "https://github.com/ODDSound/MTS-ESP")
+           (commit "3eb56f2452244b343ce738efd067d1082b67f9b4")))
+    (sha256
+     (base32
+      "0qbyspn545cn7jp2j01vxv191nibdsiq12x2xdwlcz3npsflrpxh"))))
+
+(define-public bespokesynth
+  ;; Commit based on the current version of installed JUCE
+  (let ((commit "616ad67c9c7b693aeb4a5cb19d8811baff99854c")
+        (revision "162"))
+    (package
+      (name "bespokesynth")
+      (version (git-version "1.1.0" revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/BespokeSynth/BespokeSynth")
+                      (commit commit)))
+                (file-name (git-file-name name version))
+                (patches (search-patches
+                          "bespokesynth-1.1.0-devendor_ableton_link.patch"))
+                (sha256
+                 (base32
+                  "1h8cbgsls1qxk3c7wkd8grrvs7bnj6ijhrixxrfnv23198l9gd5q"))))
+      (build-system cmake-build-system)
+      (arguments
+       (list #:tests? #f ;no test suite
+             #:configure-flags #~(list "-DBESPOKE_SYSTEM_ABLETONLINK=ON"
+                                       "-DBESPOKE_SYSTEM_JSONCPP=ON"
+                                       "-DBESPOKE_SYSTEM_JUCE=ON"
+                                       "-DBESPOKE_SYSTEM_PYBIND11=ON"
+                                       "-DBESPOKE_SYSTEM_TUNING_LIBRARY=ON")
+             #:phases #~(modify-phases %standard-phases
+                          (add-after 'unpack 'use-installed-modules
+                            (lambda _
+                              (let ((mts "libs/oddsound-mts/MTS-ESP"))
+                                (rmdir mts)
+                                (symlink #$mts-esp mts)
+                                (substitute* "libs/CMakeLists.txt"
+                                  (("add_subdirectory\\(readerwriterqueue EXCLUDE_FROM_ALL\\)")
+                                   "#"))
+                                (substitute* "Source/CMakeLists.txt"
+                                  (("readerwriterqueue")
+                                   "#"))
+                                (substitute* "Source/NoteOutputQueue.h"
+                                  (("readerwriterqueue\\.h")
+                                   "readerwriterqueue/readerwriterqueue.h"))))))))
+      (native-inputs (list ableton-link
+                           pkg-config
+                           juce
+                           libxrandr
+                           pybind11
+                           readerwriterqueue
+                           tuning-library
+                           xcb-util
+                           xcb-util-keysyms
+                           xkbutils))
+      (inputs (list alsa-lib
+                    curl
+                    gtk+
+                    freetype
+                    hicolor-icon-theme
+                    jack-1
+                    jsoncpp
+                    libusb
+                    libxcb
+                    libxcursor
+                    libxinerama
+                    libxkbfile
+                    mesa
+                    python
+                    webkitgtk-with-libsoup2
+                    xcb-util-cursor))
+      (home-page "http://bespokesynth.com")
+      (synopsis "Modular digital audio workstation")
+      (description
+       "Beaspokesynth is a modular synth.
+The features include:
+@itemize
+@item Live-patchable environment
+@item VST hosting
+@item Python livecoding
+@item MIDI controller mapping
+@end itemize")
+      (license license:gpl3+))))
+
 (define-public bsequencer
   (package
     (name "bsequencer")
-- 
2.38.0