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 / mixer.tcl < prev    next >
Encoding:
Text File  |  2001-10-22  |  1.6 KB  |  52 lines

  1. #!/bin/sh
  2. # the next line restarts using wish \
  3. exec wish8.3 "$0" "$@"
  4.  
  5. # A cross-platform mixer application that adapts to the capabilities
  6. # of Snack on the machine it is run on.
  7. # Lots of functionality on Linux - play volume only on Windows, currently.
  8.  
  9. package require -exact snack 2.1
  10.  
  11. proc Update {} {
  12.   global doMonitor
  13.   snack::mixer update
  14.   if $doMonitor { after 100 Update }
  15. }
  16. bind . <Configure> Update
  17. wm protocol . WM_DELETE_WINDOW exit
  18.  
  19. pack [frame .f] -expand yes -fill both
  20. pack [checkbutton .r -text Monitor -command Update -variable doMonitor]
  21.  
  22. foreach line [snack::mixer lines] {
  23.   pack [frame .f.g$line -bd 1 -relief solid] -side left -expand yes -fill both
  24.   pack [label .f.g$line.l -text $line]
  25.   if {[snack::mixer channels $line] == "Mono"} {
  26.     snack::mixer volume $line v(r$line)
  27.   } else {
  28.     snack::mixer volume $line v(l$line) v(r$line)
  29.     pack [scale .f.g$line.e -from 100 -to 0 -show no -var v(l$line)] -side \
  30.         left -expand yes -fill both
  31.   }
  32.   pack [scale .f.g$line.s -from 100 -to 0 -show no -var v(r$line)] -expand yes\
  33.       -fill both
  34. }
  35.  
  36. pack [frame .f.f2] -side left
  37.  
  38. if {[llength [snack::mixer inputs]] > 0} {
  39.   pack [label .f.f2.li -text "Input jacks:"]
  40.   foreach jack [snack::mixer inputs] {
  41.     snack::mixer input $jack v(i$jack)
  42.     pack [checkbutton .f.f2.b$jack -text $jack -variable v(i$jack)] -anc w
  43.   }
  44. }
  45. if {[llength [snack::mixer outputs]] > 0} {
  46.   pack [label .f.f2.lo -text "Output jacks:"]
  47.   foreach jack [snack::mixer outputs] {
  48.     snack::mixer output $jack v(o$jack)
  49.     pack [checkbutton .f.f2.b$jack -text $jack -variable v(o$jack)] -anc w
  50.   }
  51. }
  52.