defaultxr / cl-patterns

Library for writing patterns to generate or process (a)musical sequences of mathematically (un)related (non-)compound values in Lisp.

Home Page:https://w.struct.ws/cl-patterns

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support NamedControl for cl-collider

TatriX opened this issue · comments

Recently (named-control) was added to cl-collider.
When used with cl-patterns it throws an error.

I quickly fixed it on my end, but I'm not sure about string-upcase.

@@ -203,14 +203,14 @@ See also: `backend-play-event'"))
 (defmethod backend-instrument-args-list (instrument event backend)
   (if-let ((controls (backend-instrument-controls instrument backend)))
     (let ((instrument-params (remove-if (lambda (arg) ;; for parameters unspecified by the event, we fall back to the instrument's defaults, NOT the event's...
-                                          (unless (string= (symbol-name arg) "SUSTAIN") ;; ...with the exception of sustain, which the instrument should always get.
+                                          (unless (eq arg :sustain) ;; ...with the exception of sustain, which the instrument should always get.
                                             (multiple-value-bind (value key) (event-value event arg)
                                               (declare (ignore value))
                                               (eql key t))))
                                         (append controls (list :group :to :id))))) ;; FIX: this is for the supercollider backend; genericize this
       ;; get the value of each of the instrument's arguments from the event...
       (loop :for param :in instrument-params
-         :for sparam = (make-keyword param)
+         :for sparam = (make-keyword (string-upcase param))
          :for val = (backend-convert-object (event-value event sparam) sparam backend)
          :if (or (eql :gate sparam)
                  (not (null val)))

Thanks! Your suggestion worked, though I used string-equal instead of eq since string-equal does a case-insensitive comparison of strings or symbols, whereas eq tests if they're the same object in memory (it's implementation-dependent whether two instances of a symbol with the same name and package are "the same object"). Anyway it looks like cl-patterns is working again with the beep synthdef example you posted in the linked issue. I've never really used named-controls much so if you notice any other issues with them definitely let me know!