From 372646be398c142116e7faaf6b643df2f775a85a Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Thu, 10 Mar 2011 08:06:35 -0600 Subject: [PATCH] cocoa: fix `play-sound' by expanding paths properly and checking whether playing succeeds original commit: ca8c6a813313acecd19ccc463c0f48bd9c3aa836 --- collects/mred/private/wx/cocoa/sound.rkt | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/collects/mred/private/wx/cocoa/sound.rkt b/collects/mred/private/wx/cocoa/sound.rkt index ff3aad2a..adf34464 100644 --- a/collects/mred/private/wx/cocoa/sound.rkt +++ b/collects/mred/private/wx/cocoa/sound.rkt @@ -20,17 +20,16 @@ (define (play-sound path async?) (let ([s (as-objc-allocation (tell (tell MySound alloc) - initWithContentsOfFile: #:type _NSString (if (path? path) - (path->string path) - path) + initWithContentsOfFile: #:type _NSString (path->string + (path->complete-path path)) byReference: #:type _BOOL #t))] [sema (make-semaphore)]) (tellv s setDelegate: s) (set-ivar! s sema sema) (tellv s retain) ; don't use `retain', because we dont' want auto-release - (tellv s play) - (if async? - #t - (begin - (semaphore-wait sema) - (get-ivar s result))))) + (and (tell #:type _BOOL s play) + (if async? + #t + (begin + (semaphore-wait sema) + (get-ivar s result))))))