;; 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)))))