home *** CD-ROM | disk | FTP | other *** search
/ PC World 2002 May / PCWorld_2002-05_cd.bin / Software / TemaCD / activetcltk / ActiveTcl8.3.4.1-8.win32-ix86.exe / ActiveTcl8.3.4.1-win32-ix86 / demos / Snack / echo.tcl < prev    next >
Encoding:
Text File  |  2001-10-22  |  1.5 KB  |  59 lines

  1. #!/bin/sh
  2. # the next line restarts using wish \
  3. exec wish8.3 "$0" "$@"
  4.  
  5. package require -exact snack 2.1
  6.  
  7. set f [snack::filter echo 0.6 0.6 30 0.4 50 0.3]
  8.  
  9. snack::sound s
  10.  
  11. pack [frame .f]
  12.  
  13. set v(iGain) 0.6
  14. pack [scale .f.s1 -label InGain -from 1.0 -to 0.0 -resolution .01 \
  15.     -variable v(iGain) -command Config] -side left
  16.  
  17. set v(oGain) 0.6
  18. pack [scale .f.s2 -label OutGain -from 1.0 -to 0.0 -resolution .01 \
  19.     -variable v(oGain) -command Config] -side left
  20.  
  21. set v(delay1) 30.0
  22. pack [scale .f.s3 -label Delay1 -from 250.0 -to 10.0 -variable v(delay1) \
  23.     -command Config] -side left 
  24.  
  25. set v(decay1) 0.4
  26. pack [scale .f.s4 -label Decay1 -from 1.0 -to 0.0 -resolution .01 \
  27.     -variable v(decay1) -command Config] -side left 
  28.  
  29. set v(delay2) 50.0
  30. pack [scale .f.s5 -label Delay2 -from 250.0 -to 10.0 -variable v(delay2) \
  31.     -command Config] -side left 
  32.  
  33. set v(decay2) 0.3
  34. pack [scale .f.s6 -label Decay2 -from 1.0 -to 0.0 -resolution .01 \
  35.     -variable v(decay2) -command Config] -side left 
  36.  
  37. snack::createIcons
  38. pack [frame .fb]
  39. pack [button .fb.a -image snackOpen -command Load] -side left
  40. pack [button .fb.b -bitmap snackPlay -command Play] -side left
  41. pack [button .fb.c -bitmap snackStop -command "s stop"] -side left
  42.  
  43. proc Config {args} {
  44.   global f v
  45.   $f configure $v(iGain) $v(oGain) $v(delay1) $v(decay1) $v(delay2) $v(decay2)
  46. }
  47.  
  48. proc Play {} {
  49.   global f
  50.   s stop
  51.   s play -filter $f
  52. }
  53.  
  54. proc Load {} {
  55.   set file [snack::getOpenFile -initialdir [file dirname [s cget -file]]]
  56.   if {$file == ""} return
  57.   s config -file $file
  58. }
  59.