Slider Pane
I'm having problems with the CAPI:SLIDER pane on LWM 6.0.1 (Mac OS X v. 10.6.5, MacBook Pro).
First of all, the documentation seems to be lacking. I don't see where SLIDER or any of its superclasses explains the arguments required by its CALLBACK. I've figured those out, I think: item, value and action.
I see from a 2008 email that SHOW-VALUE-P is ignored on Cocoa. It apparently still does nothing on Cocoa.
I'm trying to use it to set the system sound volume, and I'd like to play a sound sample whenever the slider is used to change the volume. Responding to :MOVE actions seems to be the right thing to do (as opposed to :DRAG). But for some reason, the slider callback is called twice with a :MOVE action every time the slug is moved.
Here's some code to illustrate:
(defun say (what)
(system:call-system
(format nil "osascript -e 'say ~C~A~C'" #\" what #\")))
(defun set-loudness (n)
"Set system sound volume to a number between 0 and 7."
(system:call-system
(format nil "osascript -e 'set volume ~D'" n)))
(defun loudness-callback (item value action)
(when (equal action :move)
(set-loudness value)
(say "Loud enough?")))
(capi:contain (make-instance 'capi:slider
:orientation :vertical
:start-point :bottom
:start 0
:end 7
:slug-start 5
:show-value-p t ; no effect on Cocoa
:callback 'loudness-callback
:title "Sound Volume"))
P.S. For extra points, does anyone know how I can get the original system sound volume so I can restore it? And how about getting a list of voices available?