Skip to content

Commit

Permalink
add | to pattern language (for tieing durations)
Browse files Browse the repository at this point in the history
  • Loading branch information
benswift committed Jan 23, 2020
1 parent 49c1f6d commit 7f1b1fd
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions libs/core/looper.xtm
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,24 @@
args))
(targs (map (lambda (l)
(cond ((vector? l) (map (lambda (x) (eval x)) (vector->list l)))
((and (symbol? l) (not (equal? l '_))) (eval l))
((and (symbol? l) (not (member l '(_ |)))) (eval l))
(else l)))
tmpargs)))
(if (or (list? (car tmpargs)) (pair? (car tmpargs)))
(apply rmap_helper one_beat offset func (+ beat (- (car t) pos)) one_beat loopcnt (+ looppos (- (car t) pos)) targs)
(if (not (and (symbol? (car tmpargs)) (equal? (car tmpargs) '_)))
(apply callback
(- (*metro* (+ beat (- (car t) pos))) *RMAP_HELPER_CALLBACK_OFFSET*)
func (+ beat (- (car t) pos)) one_beat
loopcnt targs)))))
(cond
((or (list? (car tmpargs)) (pair? (car tmpargs)))
(apply rmap_helper one_beat offset func (+ beat (- (car t) pos)) one_beat loopcnt (+ looppos (- (car t) pos)) targs))
((member (car tmpargs) '(_ |)) #f) ;; skip these symbols
(else
;; this is a messy expression, but it just counts the number of
;; '| symbols *after* the current value, and adds them to the
;; duration
(let ((note-dur (* one_beat
(+ 1 (length (take-while (lambda (x) (equal? x '|))
(cl:nthcdr (cdr t) (car args))))))))
(apply callback
(- (*metro* (+ beat (- (car t) pos))) *RMAP_HELPER_CALLBACK_OFFSET*)
func (+ beat (- (car t) pos)) note-dur
loopcnt targs))))))
newlst))))

;; rhythm map
Expand Down

0 comments on commit 7f1b1fd

Please sign in to comment.