topclock-streamer   scheme


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/libs/core/topclock.xtm

Implementation

;; topclock streamer
;; only starts if this client becomes
;; the master by winning a public election
;; broadcasts "/clock/stream" messages
(define topclock-streamer
  (lambda (beat dur)
    (let* ((bpm (*metro* 'get-tempo))
           (cycle (*metro* 'get-cycle)))
      (io:osc:send (*metro* beat) *topclock-broadcast* "/clock/stream"
                   (1970->1900 (samples->clock (*metro* beat)))
                   bpm (rational->n beat) (rational->d beat) cycle)
      (if *topclock-master*
          (callback (*metro* (+ beat (* .5 dur))) 'topclock-streamer (+ beat dur) dur)))))


Back to Index