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 / levelmeter.tcl < prev    next >
Encoding:
Text File  |  2001-10-22  |  820 b   |  35 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 -channels 2
  8.  
  9. pack [frame .a]
  10. pack [frame .b]
  11. pack [snack::levelMeter .a.left  -width 20 -length 200 \
  12.     -orient horizontal]
  13. pack [snack::levelMeter .a.right -width 20 -length 200 \
  14.     -orient horizontal]
  15. pack [snack::levelMeter .b.left  -width 20 -length 200 \
  16.     -orient vertical -oncolor green] -side left
  17. pack [snack::levelMeter .b.right -width 20 -length 200 \
  18.     -orient vertical -oncolor orange] -side left
  19.  
  20. s record
  21. after 100 Update
  22.  
  23. proc Update {} {
  24.   set l [s max -start 0 -end -1 -channel 0]
  25.   set r [s max -start 0 -end -1 -channel 1]
  26.   s length 0
  27.  
  28.   .a.left  configure -level $l
  29.   .a.right configure -level $r
  30.   .b.left  configure -level $l
  31.   .b.right configure -level $r
  32.  
  33.   after 100 Update
  34. }
  35.