Initial commit of newLISP.
[newlisp.git] / guiserver / sound-demo.lsp
blob5ebed02b9d59f2832c948ddd379f202993250539
1 #!/usr/bin/newlisp
2 ;;
3 ; button-demo.lsp - demonstrate the button control
5 ;;;; initialization
6 (set-locale "C")
7 (load (append (env "NEWLISPDIR") "/guiserver.lsp"))
9 (gs:init)
10 ;(gs:set-trace true)
12 (constant (global 'home-dir) (or (env "HOME") (env "USERPROFILE") (env "DOCUMENT_ROOT") ""))
14 ;;;; describe the GUI
15 (gs:frame 'SoundDemo 100 100 200 100 "Sound Demo")
16 (gs:set-flow-layout 'SoundDemo "center" 20 20)
17 (gs:button 'aSound 'button-action "Choose Sound File")
18 (gs:add-to 'SoundDemo 'aSound)
19 (gs:set-visible 'SoundDemo true)
21 ;;;; define actions
22 (define (button-action)
23 (gs:open-file-dialog 'SoundDemo 'openfile-action home-dir
24 ".aif .wav" "Sound files .wav and .aif")
27 (define (openfile-action id op file)
28 (if file (gs:play-sound (base64-dec file)))
31 ;;;; listen for incoming action requests and dispatch
32 (gs:listen)
34 ;; eof