_dsp:set!   scheme


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/runtime/scheme.xtm

Implementation

;; this for buffered version
(define _dsp:set!
  (lambda (zerolatency? name . args)
    (println 'zerolatency: zerolatency?)
    (let* ((nn (if (symbol? name) (symbol->string name) name))
           (ft (impc:ti:get-closure-arg-types nn))
           (ct (if ft
                   (map (lambda (x) (impc:ir:get-type-from-str x)) ft)
                   (log-error 'Function name 'does 'not 'exist 'or 'is 'not 'compiled))))
      (cond ((equal? ct (list *impc:ir:void*
                              (+ *impc:ir:float* *impc:ir:pointer*)
                              (+ *impc:ir:float* *impc:ir:pointer*)
                              *impc:ir:si64*
                              (+ *impc:ir:si8* *impc:ir:pointer*)))
             (sys:set-dsp-wrapper-array (llvm:get-function-pointer "imp_dsp_wrapper_array"))
             (sys:set-dsp-closure (llvm:get-function-pointer (string-append nn "_getter")))) ;; whole buffer
            ((equal? ct (list *impc:ir:double*
                              *impc:ir:double*
                              *impc:ir:si64*
                              *impc:ir:si64*
                              (+ *impc:ir:double* *impc:ir:pointer*))) ;; sample by sample form FX
             (sys:set-dsp-wrapper (llvm:get-function-pointer "imp_dsp_wrapper"))
             (sys:set-dsp-closure (llvm:get-function-pointer (string-append nn "_getter")))) ;; whole buffer
            ((equal? ct (list *impc:ir:double*
                              (+ *impc:ir:double* *impc:ir:pointer*)
                              *impc:ir:si64*
                              *impc:ir:si64*
                              (+ *impc:ir:double* *impc:ir:pointer*))) ;; sample by sample form FX
             (sys:set-dspmt-wrapper (llvm:get-function-pointer "imp_dsp_sum_wrapper")
                                    (llvm:get-function-pointer "imp_dsp_wrapper"))
             (sys:set-dsp-closure (llvm:get-function-pointer (string-append nn "_getter")))
             (dotimes (i (length args))
               (sys:set-dspmt-closure (llvm:get-function-pointer (string-append (list-ref args i) "_getter")) i))
             (sys:init-mt-audio (length args) zerolatency?)
             )
            ((equal? ct (list *impc:ir:float*
                              *impc:ir:float*
                              *impc:ir:si64*
                              *impc:ir:si64*
                              (+ *impc:ir:float* *impc:ir:pointer*))) ;; sample by sample form FX
             (sys:set-dsp-wrapper (llvm:get-function-pointer "imp_dspf_wrapper"))
             (sys:set-dsp-closure (llvm:get-function-pointer (string-append nn "_getter")))) ;; whole buffer
            ((equal? ct (list *impc:ir:float*
                              (+ *impc:ir:float* *impc:ir:pointer*)
                              *impc:ir:si64*
                              *impc:ir:si64*
                              (+ *impc:ir:float* *impc:ir:pointer*))) ;; sample by sample form FX
             (sys:set-dspmt-wrapper (llvm:get-function-pointer "imp_dspf_sum_wrapper")
                                    (llvm:get-function-pointer "imp_dspf_wrapper"))
             (sys:set-dsp-closure (llvm:get-function-pointer (string-append nn "_getter")))
             (dotimes (i (length args))
               (sys:set-dspmt-closure (llvm:get-function-pointer (string-append (list-ref args i) "_getter")) i))
             (sys:init-mt-audio (length args) zerolatency?)
             )
            ((equal? ct (list *impc:ir:void*
                              (+ *impc:ir:float* *impc:ir:pointer* *impc:ir:pointer*)
                              (+ *impc:ir:float* *impc:ir:pointer*)
                              *impc:ir:si64*
                              (+ *impc:ir:si8* *impc:ir:pointer*))) ;; buffer by buffer
             (sys:set-dspmt-wrapper-array (llvm:get-function-pointer "imp_dsp_sum_wrapper_array")
                                          (llvm:get-function-pointer "imp_dsp_wrapper_array"))
             (sys:set-dsp-closure (llvm:get-function-pointer (string-append nn "_getter")))
             (dotimes (i (length args))
               (sys:set-dspmt-closure (llvm:get-function-pointer (string-append (list-ref args i) "_getter")) i))
             (sys:init-mt-audio-buf (length args) zerolatency?)
             )
            (else (log-error 'Bad 'closure 'signature 'for 'dsp:set! ct))))))


Back to Index

Similar Entries