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 / compose.tcl < prev    next >
Encoding:
Text File  |  2001-10-22  |  2.4 KB  |  84 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. snack::sound s
  8.  
  9. set f0 [snack::filter map 0.5]
  10. set f1 [snack::filter echo 0.6 0.6 30 0.4]
  11. set f2 [snack::filter echo 0.6 0.6 50 0.3]
  12. set f3 [snack::filter compose $f0 $f1 $f2]
  13.  
  14. pack [frame .f]
  15. pack [frame .f.f1 -borderwidth 2 -relief raised]
  16. pack [frame .f.f2 -borderwidth 2 -relief raised]
  17. pack [frame .f.f3 -borderwidth 2 -relief raised]
  18.  
  19. set m1 1.0
  20. pack [label .f.f1.l -text "Map Filter"]
  21. pack [scale .f.f1.s0 -label Map -from 1.0 -to 0.0 -resolution .01 \
  22.     -variable m1 -command "$f0 configure"]
  23.  
  24. set v(inGain1) 0.6
  25. pack [label .f.f2.l -text "Echo Filter 1"]
  26. pack [scale .f.f2.s1 -label InGain -from 1.0 -to 0.0 -resolution .01 \
  27.     -variable v(inGain1) -command Config1] -side left
  28.  
  29. set v(outGain1) 0.6
  30. pack [scale .f.f2.s2 -label OutGain -from 1.0 -to 0.0 -resolution .01 \
  31.     -variable v(outGain1) -command Config1] -side left
  32.  
  33. set v(delay1) 30.0
  34. pack [scale .f.f2.s3 -label Delay -from 250.0 -to 10.0 -variable v(delay1) \
  35.     -command Config1] -side left 
  36.  
  37. set v(decay1) 0.4
  38. pack [scale .f.f2.s4 -label Decay -from 1.0 -to 0.0 -resolution .01 \
  39.     -variable v(decay1) -command Config1] -side left 
  40.  
  41. set v(inGain2) 0.7
  42. pack [label .f.f3.l -text "Echo Filter 2"]
  43. pack [scale .f.f3.s1 -label InGain -from 1.0 -to 0.0 -resolution .01 \
  44.     -variable v(inGain2) -command Config2] -side left
  45.  
  46. set v(outGain2) 0.5
  47. pack [scale .f.f3.s2 -label OutGain -from 1.0 -to 0.0 -resolution .01 \
  48.     -variable v(outGain2) -command Config2] -side left
  49.  
  50. set v(delay2) 50.0
  51. pack [scale .f.f3.s5 -label Delay -from 250.0 -to 10.0 -variable v(delay2) \
  52.     -command Config2] -side left 
  53.  
  54. set v(decay2) 0.3
  55. pack [scale .f.f3.s6 -label Decay -from 1.0 -to 0.0 -resolution .01 \
  56.     -variable v(decay2) -command Config2] -side left 
  57.  
  58. snack::createIcons
  59. pack [frame .fb]
  60. pack [button .fb.a -image snackOpen -command Load] -side left
  61. pack [button .fb.b -bitmap snackPlay -command Play] -side left
  62. pack [button .fb.c -bitmap snackStop -command "s stop"] -side left
  63.  
  64. proc Config1 {args} {
  65.     global f1 v
  66.     $f1 configure $v(inGain1) $v(outGain1) $v(delay1) $v(decay1)
  67. }
  68.  
  69. proc Config2 {args} {
  70.     global f2 v
  71.     $f2 configure $v(inGain2) $v(outGain2) $v(delay2) $v(decay2)
  72. }
  73.  
  74. proc Play {} {
  75.     global f3
  76.     s play -filter $f3
  77. }
  78.  
  79. proc Load {} {
  80.  set file [snack::getOpenFile -initialdir [file dirname [s cget -file]]]
  81.  if {$file == ""} return
  82.  s config -file $file
  83. }
  84.