rsc3/oregano/system.rkt

55 lines
1.7 KiB
Racket
Raw Normal View History

2014-05-27 23:39:51 +00:00
#lang racket
(provide (all-defined-out))
2014-05-29 17:36:59 +00:00
(define (sc-running/unix?)
(system "ps -e | grep scsynth | grep -v grep > /dev/null"))
(define (get-scsynth-path/osx)
2014-06-12 16:19:16 +00:00
(define path1 "/Applications/SuperCollider/SuperCollider.app/Contents/Resources/scsynth")
2014-05-29 17:36:59 +00:00
(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")]))
2014-05-27 23:39:51 +00:00
;; run scsynth
(define (run-super-collider)
2014-05-29 17:36:59 +00:00
;(display "in run-super-collider\n")
2014-05-27 23:39:51 +00:00
(match (system-type 'os)
2014-05-29 17:36:59 +00:00
('unix (if (sc-running/unix?)
2014-05-28 01:01:07 +00:00
(display "SuperCollider Running\n")
(begin
(display "Starting SuperCollider...")
(process "./start_server_linux.sh")
2014-06-12 16:19:16 +00:00
(sleep 1)
2014-05-29 17:36:59 +00:00
(if (sc-running/unix?)
(display "OK\n")
(display "Error\n")))))
('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?)
2014-05-29 17:03:53 +00:00
(display "OK\n")
(display "Error\n")))))
2014-05-29 17:36:59 +00:00
('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)
2014-05-27 23:39:51 +00:00
(else 1)))
2014-06-12 16:19:16 +00:00
(run-super-collider)