From 0160a693cca2134af7ba3d7eced249394ff29209 Mon Sep 17 00:00:00 2001 From: Mustafa Date: Thu, 29 May 2014 10:36:59 -0700 Subject: [PATCH] added running sc for osx --- oregano/system.rkt | 40 +++++++++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/oregano/system.rkt b/oregano/system.rkt index 269d738..14760d6 100644 --- a/oregano/system.rkt +++ b/oregano/system.rkt @@ -4,21 +4,51 @@ (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 (define (run-super-collider) - (display "in run-super-collider\n") + ;(display "in run-super-collider\n") (match (system-type 'os) - ('unix (if (system "ps -e | grep scsynth > /dev/null") + ('unix (if (sc-running/unix?) (display "SuperCollider Running\n") (begin (display "Starting SuperCollider...") (process "./start_server_linux.sh") (sleep 0.5) - (if (system "ps -e | grep scsynth > /dev/null") + (if (sc-running/unix?) (display "OK\n") (display "Error\n"))))) - ('macosx 1) - ('windows 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) (else 1))) (run-super-collider) \ No newline at end of file