added running sc for osx

This commit is contained in:
Mustafa 2014-05-29 10:36:59 -07:00
parent bb6ac29aca
commit 0160a693cc

View file

@ -4,20 +4,50 @@
(provide (all-defined-out)) (provide (all-defined-out))
(define (sc-running/unix?)
(system "ps -e | grep scsynth | grep -v grep > /dev/null"))
(define (get-scsynth-path/osx)
(define path1 "/Applications/SuperCollider/SuperCollider/SuperCollider.app/Contents/Resources/scsynth")
(define path2 "/Volumes/SuperCollider/SuperCollider/SuperCollider.app/Contents/Resources/scsynth")
(cond [(file-exists? path1) path1]
[(file-exists? path2) path2]
[else (error "Could not find scsynth for running SuperCollider")]))
;; run scsynth ;; run scsynth
(define (run-super-collider) (define (run-super-collider)
(display "in run-super-collider\n") ;(display "in run-super-collider\n")
(match (system-type 'os) (match (system-type 'os)
('unix (if (system "ps -e | grep scsynth > /dev/null") ('unix (if (sc-running/unix?)
(display "SuperCollider Running\n") (display "SuperCollider Running\n")
(begin (begin
(display "Starting SuperCollider...") (display "Starting SuperCollider...")
(process "./start_server_linux.sh") (process "./start_server_linux.sh")
(sleep 0.5) (sleep 0.5)
(if (system "ps -e | grep scsynth > /dev/null") (if (sc-running/unix?)
(display "OK\n") (display "OK\n")
(display "Error\n"))))) (display "Error\n")))))
('macosx 1) ('macosx (if (sc-running/unix?)
(display "SuperCollider Running\n")
(begin
(display "Starting SuperCollider...")
(process* (get-scsynth-path/osx) "-u" "57110")
(sleep 0.5)
(if (sc-running/unix?)
(display "OK\n")
(display "Error\n")))))
('windows 1)
(else 1)))
(define (stop-super-collider)
;(display "in run-super-collider\n")
(match (system-type 'os)
('unix 1)
('macosx (begin
(display "Stopping SuperCollider...")
(process "pkill scsynth")
(display (if (sc-running/unix?) "Error stopping\n" "OK\n"))))
('windows 1) ('windows 1)
(else 1))) (else 1)))