1;;;
2;;; Copyright (C) 2020-2021 Alexandros Theodotou <alex at zrythm dot org>
3;;; Copyright (C) 2020 Ryan Gonzalez <rymg19 at gmail dot com>
4;;;
5;;; This file is part of Zrythm.
6;;;
7;;; Zrythm is free software; you can redistribute it and/or modify it
8;;; under the terms of the GNU Affero General Public License as published by
9;;; the Free Software Foundation; either version 3 of the License, or (at
10;;; your option) any later version.
11;;;
12;;; Zrythm is distributed in the hope that it will be useful, but
13;;; WITHOUT ANY WARRANTY; without even the implied warranty of
14;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15;;; GNU Affero General Public License for more details.
16;;;
17;;; You should have received a copy of the GNU Affero General Public License
18;;; along with Zrythm.  If not, see <http://www.gnu.org/licenses/>.
19
20;;; This file generates the gsettings schema
21
22(add-to-load-path "@SCRIPTS_DIR@")
23
24(define-module (gen-gschema)
25  #:use-module (guile-utils)
26  #:use-module (ice-9 string-fun)
27  #:use-module (ice-9 format)
28  #:use-module (ice-9 match)
29  #:use-module (srfi srfi-1)
30  #:use-module (srfi srfi-9) ; records
31  #:use-module (sxml simple))
32
33(define top-id "org.zrythm.Zrythm")
34
35(define-record-type <schema-key>
36  (make-schema-key name type default summary
37                   description)
38  schema-key?
39  (name         schema-key-name)
40  (type         schema-key-type)
41  (default      schema-key-default)
42  (summary      schema-key-summary)
43  (description  schema-key-description)
44  (enum         schema-key-enum
45                set-schema-key-enum!)
46  (range-min    schema-key-range-min
47                set-schema-key-range-min!)
48  (range-max    schema-key-range-max
49                set-schema-key-range-max!))
50
51(define (make-schema-key-with-enum
52          name enum default summary description)
53  (let ((key (make-schema-key
54               name "" default summary description)))
55    (set-schema-key-enum! key enum)
56    key))
57
58(define (make-schema-key-with-range
59          name type range-min range-max default
60          summary description)
61  (let ((key (make-schema-key
62               name type default summary description)))
63    (set-schema-key-range-min! key range-min)
64    (set-schema-key-range-max! key range-max)
65    key))
66
67(define-record-type <schema>
68  (make-schema local-id keys)
69  schema?
70  ;; ID after "org.zrythm.Zrythm."
71  (local-id schema-local-id)
72  (keys     schema-keys)
73  (preferences-category
74    schema-preferences-category
75    set-schema-preferences-category!))
76
77(define (schema-id schema)
78  (string-append
79    top-id "."
80    (if (string?
81            (schema-preferences-category schema))
82      (string-append
83        "preferences."
84        (schema-preferences-category schema) ".")
85      "")
86    (schema-local-id schema)))
87
88(define (schema-path schema)
89  (string-append
90    "/"
91    (string-replace-substring
92      (schema-id schema) "." "/")
93    "/"))
94
95(define (schema-print schema)
96  ;; display header
97  (format #t "  <schema id=~s
98        path=~s>\n"
99        (schema-id schema)
100        (schema-path schema))
101  ;; display keys
102  (fold
103    (lambda (key keys)
104      (format #t
105        "    <key name=~s ~a=~s>~a
106      <default>~a</default>
107      <summary>~a</summary>
108      <description>~a</description>
109    </key>\n"
110        ; key name
111        (schema-key-name key)
112        ; either "enum" or "type"
113        (if (string? (schema-key-enum key))
114          "enum"
115          "type")
116        ; key type name or enum name
117        (if (string? (schema-key-enum key))
118          (string-append
119            top-id "." (schema-key-enum key) "-enum")
120          (schema-key-type key))
121        ; optional text
122        (if (string? (schema-key-range-min key))
123          (format #f "\n      <range min=~s max=~s />"
124                  (schema-key-range-min key)
125                  (schema-key-range-max key))
126          "")
127        ; <default> element
128        (if (or
129              (string? (schema-key-enum key))
130              (string=? (schema-key-type key) "s"))
131          (format #f "~s"
132                  (schema-key-default key))
133          (schema-key-default key))
134        ; summary
135        (schema-key-summary key)
136        ; description
137        (schema-key-description key)))
138    '()
139    (schema-keys schema))
140  ;; close
141  (display "  </schema>\n\n"))
142
143;; leave for reference
144(define (print-enum-using-sxml in-id nicks)
145  (display "  ")
146  (let* ((enum-id
147           (string-append top-id "."
148                          in-id "-enum"))
149         (nicks
150           (let loop ((nicks nicks)
151                      (idx 0)
152                      (res '()))
153             (match nicks
154               (() (reverse res))
155               ((nick . rest)
156                (loop
157                  rest (1+ idx)
158                  (cons `(value (@ (nick ,nick)
159                                   (value ,idx)))
160                        res))))))
161         (sxml `(enum (@ (id ,enum-id)) ,nicks)))
162    (display (sxml->xml sxml)))
163  (newline))
164
165(define (print-enum id nicks)
166  (display
167    (string-append
168      "  <enum id=\"" top-id "." id "-enum\">\n"))
169  (fold
170    (lambda (nick idx)
171      (format #t
172        "    <value nick=\"~a\" value=\"~d\"/>\n"
173        nick idx)
174      (1+ idx))
175    0
176    nicks)
177  (display "  </enum>\n"))
178
179(define-record-type <preferences-category>
180  (make-preferences-category name schemas)
181  preferences-category?
182  (name         preferences-category-name)
183  (schemas      preferences-category-schemas))
184
185(define (preferences-category-print category)
186  ;; display each schema in this preference category
187  (fold
188    (lambda (schema schemas)
189      (set-schema-preferences-category!
190        schema (preferences-category-name category))
191      (schema-print schema))
192    '()
193    (preferences-category-schemas category)))
194
195#!
196Args:
1971: output file
1982: top schema delimited by "."
199!#
200(define (main . args)
201
202  ;; verify number of args
203  (unless (eq? (length args) 3)
204    (display "Need 2 arguments")
205    (newline)
206    (exit -1))
207
208  ;; get args
209  (match args
210    ((this-program output-file in-top-id)
211
212     (set! top-id in-top-id)
213
214     ;; open file
215     (with-output-to-file output-file
216       (lambda ()
217
218         ;; print top
219         (display
220"<?xml version=\"1.0\" encoding=\"utf-8\"?>
221<!--
222
223  Copyright (C) 2018-2020 Alexandros Theodotou <alex at zrythm dot org>
224
225  This file is part of Zrythm
226
227  Zrythm is free software: you can redistribute it and/or modify
228  it under the terms of the GNU Affero General Public License as published by
229  the Free Software Foundation, either version 3 of the License, or
230  (at your option) any later version.
231
232  Zrythm is distributed in the hope that it will be useful,
233  but WITHOUT ANY WARRANTY; without even the implied warranty of
234  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
235  GNU Affero General Public License for more details.
236
237  You should have received a copy of the GNU Affero General Public License
238  along with Zrythm.  If not, see <https://www.gnu.org/licenses/>.
239
240-->
241
242<schemalist
243  gettext-domain=\"zrythm\">
244
245")
246
247         ;; print enums
248         (print-enum
249           "audio-backend"
250           '("none" "none-libsoundio" "alsa"
251             "alsa-libsoundio" "alsa-rtaudio" "jack"
252             "jack-libsoundio" "jack-rtaudio"
253             "pulseaudio"
254             "pulseaudio-libsoundio"
255             "pulseaudio-rtaudio"
256             "coreaudio-libsoundio" "coreaudio-rtaudio"
257             "sdl" "wasapi-libsoundio"
258             "wasapi-rtaudio" "asio-rtaudio"))
259         (print-enum
260           "midi-backend"
261           '("none" "alsa" "alsa-rtmidi" "jack"
262             "jack-rtmidi" "wmme" "wmme-rtmidi"
263             "coremidi-rtmidi"))
264         (print-enum
265           "language"
266           '(@LINGUAS@))
267         (print-enum
268           "export-time-range"
269           '("loop" "song" "custom"))
270         (print-enum
271           "export-format"
272           '("flac" "ogg-vorbis" "ogg-opus" "wav"
273             "mp3" "mid" "raw"))
274         (print-enum
275           "export-bit-depth"
276           '("16" "24" "32"))
277         (print-enum
278           "export-filename-pattern"
279           '("append-format"
280             "prepend-date-append-format"))
281         (print-enum
282           "note-length"
283           '("bar" "beat" "2/1" "1/1" "1/2" "1/4"
284             "1/8" "1/16" "1/32"  "1/64" "1/128"))
285         (print-enum
286           "note-type"
287           '("normal" "dotted" "triplet"))
288         (print-enum
289           "midi-modifier"
290           '("velocity" "aftertouch"))
291         (print-enum
292           "note-notation"
293           '("notes" "numbers"))
294         (print-enum
295           "plugin-browser-tab"
296           '("collection" "author" "category"
297             "protocol"))
298         (print-enum
299           "plugin-browser-filter"
300           '("none" "instrument" "effect" "modulator"
301             "midi-effect"))
302         (print-enum
303           "file-browser-filter"
304           '("none" "audio" "midi" "preset"))
305         (print-enum
306           "piano-roll-highlight"
307           '("none" "chord" "scale" "both"))
308         (print-enum
309           "pan-law"
310           '("zero-db" "minus-three-db"
311             "minus-six-db" ))
312         (print-enum
313           "pan-algorithm"
314           '("linear" "sqrt" "sine"))
315         (print-enum
316           "curve-algorithm"
317           '("exponent" "superellipse" "vital" "pulse" "logarithmic"))
318         (print-enum
319           "buffer-size"
320           '("16" "32" "64" "128" "256" "512" "1024"
321             "2048" "4096"))
322         (print-enum
323           "sample-rate"
324           '("22050" "32000" "44100" "48000" "88200"
325             "96000" "192000"))
326         (print-enum
327           "transport-display"
328           '("bbt" "time"))
329         (print-enum
330           "jack-transport-type"
331           '("master" "client" "none"))
332         (print-enum
333           "tool"
334           '("select-normal" "select-stretch"
335             "edit" "cut" "erase" "ramp"
336             "audition"))
337         (print-enum
338           "graphic-detail"
339           '("high" "normal" "low" "ultra-low"))
340         (print-enum
341           "recording-mode"
342           '("overwrite-events" "merge-events"
343             "takes" "muted-takes"))
344         (print-enum
345           "bounce-step"
346           '("before-inserts" "pre-fader"
347             "post-fader"))
348         (print-enum
349           "preroll-count"
350           '("none" "one-bar" "two-bars"
351             "four-bars"))
352         (newline)
353
354         ;; -- print normal schemas --
355
356         (schema-print
357           (make-schema
358             "general"
359             (list
360               (make-schema-key
361                 "recent-projects" "as" "[]"
362                 "Recent project list"
363                 "A list of recent projects to be referenced on startup.")
364               (make-schema-key
365                 "first-run" "b" "true"
366                 "First run"
367                 "Whether this is the first run or not.")
368               (make-schema-key
369                 "install-dir" "s" ""
370                 "Installation directory"
371                 "This is the directory Zrythm is installed in. Currently only used on Windows.")
372               (make-schema-key
373                 "last-project-dir" "s" ""
374                 "Last project directory"
375                 "Last directory a project was created in.")
376               (make-schema-key
377                 "run-versions" "as" "[]"
378                 "List of all versions run at least once"
379                 "A list of versions run at least once.")
380               (make-schema-key
381                 "last-version-new-release-notified-on"
382                 "s" "999"
383                 "Last version that was notified of a new release"
384                 "The last version that received a 'new version has been released' notification.")
385               (make-schema-key
386                 "first-check-for-updates" "b" "true"
387                 "First check for updates"
388                 "Whether this is the first time attempting to check for updates.")
389             ))) ;; general
390
391         ;; Monitor schema
392         (schema-print
393           (make-schema
394             "monitor"
395             (list
396               (make-schema-key-with-range
397                 "monitor-vol" "d"
398                 "0.0" "2.0" "1.0"
399                 "Monitor volume"
400                 "The monitor volume in amplitude (0 to 2).")
401               (make-schema-key-with-range
402                 "mute-vol" "d"
403                 "0.0" "0.5" "0.0"
404                 "Mute volume"
405                 "The monitor mute volume in amplitude (0 to 2).")
406               (make-schema-key-with-range
407                 "listen-vol" "d"
408                 "0.5" "2.0" "1.0"
409                 "Listen volume"
410                 "The monitor listen volume in amplitude (0 to 2).")
411               (make-schema-key-with-range
412                 "dim-vol" "d"
413                 "0.0" "0.5" "0.1"
414                 "Dim volume"
415                 "The monitor dim volume in amplitude (0 to 2).")
416               (make-schema-key
417                 "mono" "b" "false"
418                 "Sum to mono"
419                 "Whether to sum the monitor signal to mono.")
420               (make-schema-key
421                 "dim-output" "b" "false"
422                 "Dim output"
423                 "Whether to dim the the monitor signal.")
424               (make-schema-key
425                 "mute" "b" "false"
426                 "Mute"
427                 "Whether to mute the monitor signal.")
428               (make-schema-key
429                 "l-devices" "as" "[]"
430                 "Left output devices"
431                 "A list of output devices to route the left monitor output to.")
432               (make-schema-key
433                 "r-devices" "as" "[]"
434                 "Left output devices"
435                 "A list of output devices to route the right monitor output to.")
436             ))) ;; monitor
437
438         ;; UI schema
439         (schema-print
440           (make-schema
441             "ui"
442             (list
443               (make-schema-key
444                 "bounce-with-parents" "b" "true"
445                 "Bounce with parents"
446                 "Whether to bounce with parent tracks (direct outputs).")
447               (make-schema-key
448                 "disable-after-bounce" "b" "false"
449                 "Disable after bounce"
450                 "Disable track after bouncing.")
451               (make-schema-key-with-enum
452                 "bounce-step"
453                 "bounce-step" "post-fader"
454                 "Bounce step"
455                 "Step in the processing chain to bounce at.")
456               (make-schema-key
457                 "bounce-tail" "i" "0"
458                 "Bounce tail"
459                 "Tail to allow when bouncing (for example to catch reverb tails), in milliseconds.")
460               (make-schema-key-with-enum
461                 "timeline-object-length"
462                 "note-length" "bar"
463                 "Timeline object length"
464                 "Default length to use when creating timeline objects.")
465               (make-schema-key-with-enum
466                 "timeline-object-length-type"
467                 "note-type" "normal"
468                 "Timeline object length type"
469                 "Default length type to use when creating timeline objects (normal, dotted, triplet).")
470               (make-schema-key-with-range
471                 "timeline-last-object-length" "d"
472                 "1.0" "10000000000.0" "3840.0"
473                 "Last timeline object's length"
474                 "The length of the last created timeline object (in ticks).")
475               (make-schema-key-with-enum
476                 "editor-object-length"
477                 "note-length" "beat"
478                 "Editor object length"
479                 "Default length to use when creating editor objects.")
480               (make-schema-key-with-enum
481                 "editor-object-length-type"
482                 "note-type" "normal"
483                 "Editor object length type"
484                 "Default length type to use when creating editor objects (normal, dotted, triplet).")
485               (make-schema-key-with-range
486                 "editor-last-object-length" "d"
487                 "1.0" "10000000000.0" "480.0"
488                 "Last editor object's length"
489                 "The length of the last created editor object (in ticks).")
490               (make-schema-key-with-enum
491                 "piano-roll-note-notation"
492                 "note-notation" "notes"
493                 "Note notation"
494                 "The note notation used in the piano roll - MIDI pitch index or notes (C, C#, etc.)")
495               (make-schema-key
496                 "musical-mode" "b" "false"
497                 "Musical mode"
498                 "Whether to use musical mode. If this is on, time-stretching will be applied to events so that they match the project BPM. This mostly applies to audio regions.")
499               (make-schema-key
500                 "listen-notes" "b" "true"
501                 "Listen to notes while they are moved"
502                 "Whether to listen to MIDI notes while dragging them in the piano roll.")
503               (make-schema-key-with-enum
504                 "piano-roll-highlight"
505                 "piano-roll-highlight" "none"
506                 "Piano roll highlight"
507                 "Whether to highlight chords, scales, both or none in the piano roll.")
508               (make-schema-key-with-enum
509                 "piano-roll-midi-modifier"
510                 "midi-modifier" "velocity"
511                 "Piano roll MIDI modifier"
512                 "The MIDI modifier to display in the MIDI editor (only velocity is valid at the moment).")
513               (make-schema-key
514                 "show-automation-values" "b" "false"
515                 "Show automation values"
516                 "Whether to show automation values in the automation editor.")
517               (make-schema-key
518                 "browser-divider-position" "i" "220"
519                 "Browser divider position"
520                 "Height of the top part of the plugin/file browser.")
521               (make-schema-key
522                 "left-panel-divider-position" "i"
523                 "180"
524                 "Left panel divider position"
525                 "Position of the resize handle of the left panel.")
526               (make-schema-key
527                 "left-panel-tab" "i" "0"
528                 "Left panel tab index"
529                 "Index of the currently opened left panel tab.")
530               (make-schema-key
531                 "right-panel-divider-position" "i"
532                 "180"
533                 "Right panel divider position"
534                 "Position of the resize handle of the right panel.")
535               (make-schema-key
536                 "right-panel-tab" "i" "0"
537                 "Right panel tab index"
538                 "Index of the currently opened right panel tab.")
539               (make-schema-key
540                 "bot-panel-divider-position" "i"
541                 "180"
542                 "Bot panel divider position"
543                 "Position of the resize handle of the bot panel.")
544               (make-schema-key
545                 "bot-panel-tab" "i" "0"
546                 "Bot panel tab index"
547                 "Index of the currently opened bottom panel tab.")
548               (make-schema-key
549                 "timeline-event-viewer-visible" "b"
550                 "false"
551                 "Timeline event viewer visibility"
552                 "Whether the timeline event viewer is visible or not.")
553               (make-schema-key
554                 "editor-event-viewer-visible" "b"
555                 "false"
556                 "Editor event viewer visibility"
557                 "Whether the editor event viewer is visible.")
558               (make-schema-key-with-enum
559                 "transport-display"
560                 "transport-display" "bbt"
561                 "Playhead display type"
562                 "Selected playhead display type (BBT/time).")
563               (make-schema-key-with-enum
564                 "jack-transport-type"
565                 "jack-transport-type" "none"
566                 "JACK transport type"
567                 "Selected JACK transport behavior (master/client/none)")
568               (make-schema-key-with-enum
569                 "ruler-display"
570                 "transport-display" "bbt"
571                 "Ruler display type"
572                 "Selected ruler display type (BBT/time).")
573               (make-schema-key-with-enum
574                 "selected-tool"
575                 "tool" "select-normal"
576                 "Selected editing tool"
577                 "Selected editing tool.")
578               (make-schema-key
579                 "midi-function" "i" "0"
580                 "Last used MIDI function"
581                 "Last used MIDI function (index corresponding to enum in midi function action).")
582               (make-schema-key
583                 "automation-function" "i" "0"
584                 "Last used automation function"
585                 "Last used automation function (index corresponding to enum in automation function action).")
586               (make-schema-key
587                 "audio-function" "i" "0"
588                 "Last used audio function"
589                 "Last used audio function (index corresponding to enum in audio function action).")
590               (make-schema-key
591                 "timeline-playhead-scroll-edges" "b"
592                 "true"
593                 "Playhead scroll edges (timeline)"
594                 "Whether to scroll when the playhead reaches the visible edge (timeline).")
595               (make-schema-key
596                 "timeline-playhead-follow" "b"
597                 "false"
598                 "Follow playhead (timeline)"
599                 "Whether to follow the playhead. When this is on, the visible area will stay centered on the playhead (timeline).")
600               (make-schema-key
601                 "editor-playhead-scroll-edges" "b"
602                 "true"
603                 "Playhead scroll edges (editor)"
604                 "Whether to scroll when the playhead reaches the visible edge (editor).")
605               (make-schema-key
606                 "editor-playhead-follow" "b"
607                 "false"
608                 "Follow playhead (editor)"
609                 "Whether to follow the playhead. When this is on, the visible area will stay centered on the playhead (editor).")
610             ))) ;; ui
611
612         (schema-print
613           (make-schema
614             "ui.plugin-browser"
615             (list
616               (make-schema-key-with-enum
617                 "plugin-browser-tab"
618                 "plugin-browser-tab" "category"
619                 "Plugin browser tab"
620                 "Selected plugin browser tab.")
621               (make-schema-key-with-enum
622                 "plugin-browser-filter"
623                 "plugin-browser-filter" "none"
624                 "Plugin browser filter"
625                 "Selected plugin browser filter")
626               (make-schema-key
627                 "plugin-browser-collections" "as"
628                 "[]"
629                 "Plugin browser collections"
630                 "Tree paths of the selected collections in the plugin browser.")
631               (make-schema-key
632                 "plugin-browser-authors" "as"
633                 "[]"
634                 "Plugin browser authors"
635                 "Tree paths of the selected authors in the plugin browser.")
636               (make-schema-key
637                 "plugin-browser-categories" "as"
638                 "[]"
639                 "Plugin browser categories"
640                 "Tree paths of the selected categories in the plugin browser.")
641               (make-schema-key
642                 "plugin-browser-protocols" "as"
643                 "[]"
644                 "Plugin browser protocols"
645                 "Tree paths of the selected protocols in the plugin browser.")
646             ))) ;; ui.plugin-browser
647
648         (schema-print
649           (make-schema
650             "ui.file-browser"
651             (list
652               (make-schema-key
653                 "file-browser-bookmarks" "as"
654                 "[]"
655                 "File browser bookmarks"
656                 "Location bookmarks for file browser (absolute paths).")
657               (make-schema-key
658                 "file-browser-selected-bookmark" "s"
659                 ""
660                 "File browser selected bookmark"
661                 "Selected bookmark in file browser.")
662               (make-schema-key
663                 "autoplay" "b" "true"
664                 "Autoplay"
665                 "Whether to autoplay the selected file.")
666               (make-schema-key
667                 "show-unsupported-files" "b" "false"
668                 "Show unsupported files"
669                 "Whether to show unsupported files in the file browser.")
670               (make-schema-key
671                 "show-hidden-files" "b" "false"
672                 "Show hidden files"
673                 "Whether to show hidden files in the file browser.")
674               (make-schema-key-with-enum
675                 "filter"
676                 "file-browser-filter" "none"
677                 "File browser filter"
678                 "Selected file browser filter")
679               (make-schema-key
680                 "last-location" "s" ""
681                 "Last location"
682                 "Last visited location.")
683               (make-schema-key
684                 "instrument" "s" ""
685                 "Instrument"
686                 "Instrument plugin to use for MIDI auditioning.")
687             ))) ;; ui.file-browser
688
689         (schema-print
690           (make-schema
691             "ui.mixer"
692             (list
693               (make-schema-key
694                 "inserts-expanded" "b" "true"
695                 "Inserts expanded"
696                 "Whether inserts are expanded.")
697               (make-schema-key
698                 "midi-fx-expanded" "b" "false"
699                 "MIDI FX expanded"
700                 "Whether MIDI FX are expanded.")
701               (make-schema-key
702                 "sends-expanded" "b" "false"
703                 "Sends expanded"
704                 "Whether sends are expanded.")
705             ))) ;; ui.mixer
706
707         (schema-print
708           (make-schema
709             "ui.inspector"
710             (list
711               (make-schema-key
712                 "track-properties-expanded" "b"
713                 "true"
714                 "Track properties expanded"
715                 "Whether track properties is expanded.")
716               (make-schema-key
717                 "track-outputs-expanded" "b"
718                 "true"
719                 "Track outputs expanded"
720                 "Whether track outputs is expanded.")
721               (make-schema-key
722                 "track-sends-expanded" "b"
723                 "true"
724                 "Track sends expanded"
725                 "Whether track sends is expanded.")
726               (make-schema-key
727                 "track-inputs-expanded" "b"
728                 "true"
729                 "Track inputs expanded"
730                 "Whether track inputs is expanded.")
731               (make-schema-key
732                 "track-controls-expanded" "b"
733                 "true"
734                 "Track controls expanded"
735                 "Whether track controls is expanded.")
736               (make-schema-key
737                 "track-inserts-expanded" "b"
738                 "true"
739                 "Track inserts expanded"
740                 "Whether track inserts is expanded.")
741               (make-schema-key
742                 "track-midi-fx-expanded" "b"
743                 "true"
744                 "Track midi-fx expanded"
745                 "Whether track midi-fx is expanded.")
746               (make-schema-key
747                 "track-fader-expanded" "b"
748                 "true"
749                 "Track fader expanded"
750                 "Whether track fader is expanded.")
751               (make-schema-key
752                 "track-comment-expanded" "b"
753                 "true"
754                 "Track comment expanded"
755                 "Whether track comment is expanded.")
756             ))) ;; ui.inspector
757
758         (schema-print
759           (make-schema
760             "ui.panels"
761             (list
762               (make-schema-key
763                 "track-visibility-detached" "b"
764                 "false"
765                 "Track visibility detached"
766                 "Whether the track visibility panel is detached.")
767               (make-schema-key
768                 "track-visibility-size"
769                 "(ii)" "(128,128)"
770                 "Track visibility size"
771                 "Track visibility panel size when detached.")
772               (make-schema-key
773                 "track-inspector-detached" "b"
774                 "false"
775                 "Track inspector detached"
776                 "Whether the track inspector panel is detached.")
777               (make-schema-key
778                 "track-inspector-size"
779                 "(ii)" "(128,128)"
780                 "Track inspector size"
781                 "Track inspector panel size when detached.")
782               (make-schema-key
783                 "plugin-inspector-detached" "b"
784                 "false"
785                 "Plugin inspector detached"
786                 "Whether the plugin inspector panel is detached.")
787               (make-schema-key
788                 "plugin-inspector-size"
789                 "(ii)" "(128,128)"
790                 "Plugin inspector size"
791                 "Plugin inspector panel size when detached.")
792               (make-schema-key
793                 "plugin-browser-detached" "b"
794                 "false"
795                 "Plugin browser detached"
796                 "Whether the plugin browser panel is detached.")
797               (make-schema-key
798                 "plugin-browser-size"
799                 "(ii)" "(128,128)"
800                 "Plugin browser size"
801                 "Plugin browser panel size when detached.")
802               (make-schema-key
803                 "file-browser-detached" "b"
804                 "false"
805                 "File browser detached"
806                 "Whether the file browser panel is detached.")
807               (make-schema-key
808                 "file-browser-size"
809                 "(ii)" "(128,128)"
810                 "File browser size"
811                 "File browser panel size when detached.")
812               (make-schema-key
813                 "monitor-section-detached" "b"
814                 "false"
815                 "Monitor section detached"
816                 "Whether the monitor section panel is detached.")
817               (make-schema-key
818                 "monitor-section-size"
819                 "(ii)" "(128,128)"
820                 "Monitor section size"
821                 "Monitor section panel size when detached.")
822               (make-schema-key
823                 "modulator-view-detached" "b"
824                 "false"
825                 "Modulator view detached"
826                 "Whether the modulator view panel is detached.")
827               (make-schema-key
828                 "modulator-view-size"
829                 "(ii)" "(128,128)"
830                 "Modulator view size"
831                 "Modulator view panel size when detached.")
832               (make-schema-key
833                 "mixer-detached" "b"
834                 "false"
835                 "Mixer detached"
836                 "Whether the mixer panel is detached.")
837               (make-schema-key
838                 "mixer-size"
839                 "(ii)" "(128,128)"
840                 "Mixer size"
841                 "Mixer panel size when detached.")
842               (make-schema-key
843                 "clip-editor-detached" "b"
844                 "false"
845                 "Clip editor detached"
846                 "Whether the clip editor panel is detached.")
847               (make-schema-key
848                 "clip-editor-size"
849                 "(ii)" "(128,128)"
850                 "Clip editor size"
851                 "Clip editor panel size when detached.")
852               (make-schema-key
853                 "chord-pad-detached" "b"
854                 "false"
855                 "Chord pad detached"
856                 "Whether the chord pad panel is detached.")
857               (make-schema-key
858                 "chord-pad-size"
859                 "(ii)" "(128,128)"
860                 "Chord pad size"
861                 "Chord pad panel size when detached.")
862               (make-schema-key
863                 "timeline-detached" "b"
864                 "false"
865                 "Timeline detached"
866                 "Whether the timeline panel is detached.")
867               (make-schema-key
868                 "timeline-size"
869                 "(ii)" "(128,128)"
870                 "Timeline size"
871                 "Timeline panel size when detached.")
872               (make-schema-key
873                 "cc-bindings-detached" "b"
874                 "false"
875                 "CC bindings detached"
876                 "Whether the CC bindings panel is detached.")
877               (make-schema-key
878                 "cc-bindings-size"
879                 "(ii)" "(128,128)"
880                 "CC bindings size"
881                 "CC bindings panel size when detached.")
882               (make-schema-key
883                 "port-connections-detached" "b"
884                 "false"
885                 "Port connections detached"
886                 "Whether the port connections panel is detached.")
887               (make-schema-key
888                 "port-connections-size"
889                 "(ii)" "(128,128)"
890                 "Port connections size"
891                 "Port connections panel size when detached.")
892               (make-schema-key
893                 "scenes-detached" "b"
894                 "false"
895                 "Scenes detached"
896                 "Whether the scenes panel is detached.")
897               (make-schema-key
898                 "scenes-size"
899                 "(ii)" "(128,128)"
900                 "Scenes size"
901                 "Scenes panel size when detached.")
902             ))) ;; ui.panels
903
904         (schema-print
905           (make-schema
906             "export"
907             (list
908               (make-schema-key
909                 "genre" "s" "Electronic"
910                 "Genre"
911                 "Genre to use when exporting, if the file type supports it.")
912               (make-schema-key
913                 "artist" "s" "Zrythm"
914                 "Artist"
915                 "Artist to use when exporting, if the file type supports it.")
916               (make-schema-key
917                 "title" "s" "My Project"
918                 "Title"
919                 "Title to use when exporting, if the file type supports it.")
920               (make-schema-key-with-enum
921                 "time-range" "export-time-range"
922                 "song"
923                 "Time range"
924                 "Time range to export.")
925               (make-schema-key-with-enum
926                 "format" "export-format" "flac"
927                 "Format"
928                 "Format to export to.")
929               (make-schema-key-with-enum
930                 "filename-pattern"
931                 "export-filename-pattern"
932                 "append-format"
933                 "Filename pattern"
934                 "Filename pattern for exported files.")
935               (make-schema-key
936                 "dither" "b" "false"
937                 "Dither"
938                 "Add dither while exporting, if applicable.")
939               (make-schema-key
940                 "export-stems" "b" "false"
941                 "Export stems"
942                 "Whether to export stems instead of the mixdown.")
943               (make-schema-key-with-enum
944                 "bit-depth"
945                 "export-bit-depth" "24"
946                 "Bit depth"
947                 "Bit depth to use when exporting")
948             ))) ;; export
949
950         (schema-print
951           (make-schema
952             "transport"
953             (list
954               (make-schema-key
955                 "loop" "b"
956                 "true"
957                 "Transport loop"
958                 "Whether looping is enabled.")
959               (make-schema-key
960                 "return-to-cue" "b"
961                 "true"
962                 "Return to cue"
963                 "Whether return to cue on stop is enabled.")
964               (make-schema-key
965                 "metronome-enabled" "b" "false"
966                 "Metronome enabled"
967                 "Whether the metronome is enabled.")
968               (make-schema-key-with-range
969                 "metronome-volume" "d"
970                 "0.0" "2.0" "1.0"
971                 "Metronome volume"
972                 "The metronome volume in amplitude (0 to 2).")
973               (make-schema-key-with-enum
974                 "metronome-countin"
975                 "preroll-count" "none"
976                 "Metronome Count-in"
977                 "Count-in bars for the metronome.")
978               (make-schema-key
979                 "punch-mode" "b" "false"
980                 "Punch mode enabled"
981                 "Whether punch in/out is enabled for recording.")
982               (make-schema-key
983                 "start-on-midi-input" "b" "false"
984                 "Start playback on MIDI input"
985                 "Whether to start playback on MIDI input.")
986               (make-schema-key-with-enum
987                 "recording-mode" "recording-mode"
988                 "takes" "Recording mode"
989                 "Recording mode.")
990               (make-schema-key-with-enum
991                 "recording-preroll"
992                 "preroll-count" "none"
993                 "Recording Pre-Roll"
994                 "Number of bars to pre-roll when recording.")
995             ))) ;; transport
996
997         ;; -- print preferences schemas --
998         ;; the first key in each schema should
999         ;; be called "info" and have the group in
1000         ;; the summary and the subgroup in the
1001         ;; description
1002         ;; the value is [
1003         ;;   sort index of group,
1004         ;;   sort index of child ]
1005
1006         (preferences-category-print
1007           (make-preferences-category
1008             "general"
1009             (list
1010               (make-schema
1011                 "engine"
1012                 (list
1013                   (make-schema-key
1014                     "info" "ai" "[0,0]"
1015                     "General" "Engine")
1016                   (make-schema-key-with-enum
1017                     "audio-backend" "audio-backend"
1018                     "none" "Audio backend"
1019                     "The audio backend to use.")
1020                   (make-schema-key
1021                     "rtaudio-audio-device-name" "s"
1022                     "" "RtAudio device"
1023                     "The name of the RtAudio device to use.")
1024                   (make-schema-key
1025                     "sdl-audio-device-name" "s"
1026                     "" "SDL device"
1027                     "The name of the SDL device to use.")
1028                   (make-schema-key-with-enum
1029                     "sample-rate" "sample-rate"
1030                     "48000" "Samplerate"
1031                     "Samplerate to pass to the backend.")
1032                   (make-schema-key-with-enum
1033                     "buffer-size" "buffer-size"
1034                     "512" "Buffer size"
1035                     "Buffer size to pass to the backend.")
1036                   (make-schema-key-with-enum
1037                     "midi-backend" "midi-backend"
1038                     "none" "MIDI backend"
1039                     "The MIDI backend to use.")
1040                   (make-schema-key
1041                     "audio-inputs" "as"
1042                     "[]" "Audio inputs"
1043                     "A list of audio inputs to enable.")
1044                   (make-schema-key
1045                     "midi-controllers" "as"
1046                     "[]" "MIDI controllers"
1047                     "A list of controllers to enable.")
1048                 )) ;; general/engine
1049               (make-schema
1050                 "paths"
1051                 (list
1052                   (make-schema-key
1053                     "info" "ai" "[0,1]"
1054                     "General" "Paths")
1055                   (make-schema-key
1056                     "zrythm-dir" "s"
1057                     "" "Zrythm path"
1058                     "The directory used to save user data in.")
1059                 )) ;; general/updates
1060               (make-schema
1061                 "updates"
1062                 (list
1063                   (make-schema-key
1064                     "info" "ai" "[0,2]"
1065                     "General" "Updates")
1066                   (make-schema-key
1067                     "check-for-updates" "b" "false"
1068                     "Check for updates"
1069                     "Whether to check for updates.")
1070                 )) ;; general/updates
1071             ))) ;; general
1072
1073         (preferences-category-print
1074           (make-preferences-category
1075             "plugins"
1076             (list
1077               (make-schema
1078                 "uis"
1079                 (list
1080                   (make-schema-key
1081                     "info" "ai" "[1,0]"
1082                     "Plugins" "UIs")
1083                   (make-schema-key
1084                     "open-on-instantiate" "b"
1085                     "true" "Open UI on instantiation"
1086                     "Open plugin UIs when they are instantiated.")
1087                   (make-schema-key
1088                     "stay-on-top" "b"
1089                     "true" "Keep window on top"
1090                     "Always show plugin UIs on top of the main window.")
1091                   (make-schema-key-with-range
1092                     "refresh-rate" "i" "0" "180"
1093                     "0" "Refresh rate"
1094                     "Refresh rate in Hz. If set to 0, the screen's refresh rate will be used.")
1095                   (make-schema-key-with-range
1096                     "scale-factor" "d" "0.0" "4.0"
1097                     "0.0" "Scale factor"
1098                     "Scale factor to pass to plugin UIs. If set to 0, the monitor's scale factor will be used.")
1099                 )) ;; plugins/uis
1100               (make-schema
1101                 "paths"
1102                 (list
1103                   (make-schema-key
1104                     "info" "ai" "[1,1]"
1105                     "Plugins" "Paths")
1106                   (make-schema-key
1107                     "vst-search-paths-windows" "as"
1108                     "[ \"C:\\\\Program Files\\\\Common Files\\\\VST2\",
1109        \"C:\\\\Program Files\\\\VSTPlugins\",
1110        \"C:\\\\Program Files\\\\Steinberg\\\\VSTPlugins\",
1111        \"C:\\\\Program Files\\\\Common Files\\\\VST2\",
1112        \"C:\\\\Program Files\\\\Common Files\\\\Steinberg\\\\VST2\" ]"
1113                     "VST plugins"
1114                     "The search paths to scan for VST plugins in. Duplicate paths will be deduplicated.")
1115                   (make-schema-key
1116                     "sfz-search-paths" "as" "[]"
1117                     "SFZ instruments"
1118                     "The search paths to scan for SFZ instruments in. Duplicate paths will be deduplicated.")
1119                   (make-schema-key
1120                     "sf2-search-paths" "as" "[]"
1121                     "SF2 instruments"
1122                     "The search paths to scan for SF2 instruments in. Duplicate paths will be deduplicated.")
1123                 )) ;; plugins/paths
1124             ))) ;; plugins
1125
1126         (preferences-category-print
1127           (make-preferences-category
1128             "editing"
1129             (list
1130               (make-schema
1131                 "audio"
1132                 (list
1133                   (make-schema-key
1134                     "info" "ai" "[3,0]"
1135                     "Editing" "Audio")
1136                   (make-schema-key-with-enum
1137                     "fade-algorithm" "curve-algorithm"
1138                     "superellipse" "Fade algorithm"
1139                     "Default fade algorithm to use for fade in/outs.")
1140                 )) ;; editing/audio
1141               (make-schema
1142                 "automation"
1143                 (list
1144                   (make-schema-key
1145                     "info" "ai" "[3,1]"
1146                     "Editing" "Automation")
1147                   (make-schema-key-with-enum
1148                     "curve-algorithm"
1149                     "curve-algorithm"
1150                     "superellipse"
1151                     "Curve algorithm"
1152                     "Default algorithm to use for automation curves.")
1153                 )) ;; editing/automation
1154               (make-schema
1155                 "undo"
1156                 (list
1157                   (make-schema-key
1158                     "info" "ai" "[3,2]"
1159                     "Editing" "Undo")
1160                   (make-schema-key-with-range
1161                     "undo-stack-length" "i" "-1"
1162                     "380000" "128"
1163                     "Undo stack length"
1164                     "Maximum undo history stack length. Set to -1 for unlimited.")
1165                 )) ;; editing/undo
1166             ))) ;; editing
1167
1168         (preferences-category-print
1169           (make-preferences-category
1170             "projects"
1171             (list
1172               (make-schema
1173                 "general"
1174                 (list
1175                   (make-schema-key
1176                     "info" "ai" "[4,0]"
1177                     "Projects" "General")
1178                   (make-schema-key-with-range
1179                     "autosave-interval" "u"
1180                     "0" "120" "1"
1181                     "Autosave interval"
1182                     "Interval to auto-save projects, in minutes. Auto-saving will be disabled if this is set to 0.")
1183                 )) ;; projects/general
1184             ))) ;; projects
1185
1186         (preferences-category-print
1187           (make-preferences-category
1188             "ui"
1189             (list
1190               (make-schema
1191                 "general"
1192                 (list
1193                   (make-schema-key
1194                     "info" "ai" "[5,0]"
1195                     "UI" "General")
1196                   (make-schema-key-with-enum
1197                     "graphic-detail"
1198                     "graphic-detail" "high"
1199                     "Draw detail"
1200                     "Level of detail to use when drawing graphics.")
1201                   (make-schema-key-with-range
1202                     "font-scale" "d"
1203                     "0.2" "2.0" "1.0"
1204                     "Font scale"
1205                     "Font scale.")
1206                   (make-schema-key-with-enum
1207                     "language" "language"
1208                     "en"
1209                     "User interface language"
1210                     "The language to use for the user interface.")
1211                   (make-schema-key
1212                     "css-theme" "s"
1213                     "zrythm-theme.css"
1214                     "CSS theme"
1215                     "The CSS theme to use.")
1216                   (make-schema-key
1217                     "icon-theme" "s"
1218                     "zrythm-dark"
1219                     "Icon theme"
1220                     "The icon theme to use. This is the directory name.")
1221                 )) ;; ui/general
1222             ))) ;; ui
1223
1224         (preferences-category-print
1225           (make-preferences-category
1226             "dsp"
1227             (list
1228               (make-schema
1229                 "pan"
1230                 (list
1231                   (make-schema-key
1232                     "info" "ai" "[2,0]"
1233                     "DSP" "Pan")
1234                   (make-schema-key-with-enum
1235                     "pan-algorithm" "pan-algorithm"
1236                     "sine"
1237                     "Pan algorithm"
1238                     "The panning algorithm to use when applying pan on mono signals (not used at the moment).")
1239                   (make-schema-key-with-enum
1240                     "pan-law" "pan-law"
1241                     "minus-three-db"
1242                     "Pan law"
1243                     "The pan law to use when applying pan on mono signals (not used at the moment).")
1244                 )) ;; dsp/pan
1245             ))) ;; dsp
1246
1247         (preferences-category-print
1248           (make-preferences-category
1249             "scripting"
1250             (list
1251               (make-schema
1252                 "general"
1253                 (list
1254                   (make-schema-key
1255                     "info" "ai" "[6,0]"
1256                     "Scripting" "General")
1257                   (make-schema-key
1258                     "default-script" "s" "print-all-tracks.scm"
1259                     "Default script"
1260                     "The default script to use in the scripting window.")
1261                 )) ;; scripting/general
1262             ))) ;; scripting
1263
1264         (display "</schemalist>"))))))
1265
1266(apply main (program-arguments))
1267