File: levelmeter.tcl

package info (click to toggle)
snack 2.2.10.20090623-dfsg-8
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 3,764 kB
  • sloc: ansic: 32,662; sh: 8,558; tcl: 1,086; python: 761; makefile: 582
file content (34 lines) | stat: -rwxr-xr-x 820 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/sh
# the next line restarts using wish \
exec wish8.5 "$0" "$@"

package require -exact snack 2.2

snack::sound s -channels 2

pack [frame .a]
pack [frame .b]
pack [snack::levelMeter .a.left  -width 20 -length 200 \
	-orient horizontal]
pack [snack::levelMeter .a.right -width 20 -length 200 \
	-orient horizontal]
pack [snack::levelMeter .b.left  -width 20 -length 200 \
	-orient vertical -oncolor green] -side left
pack [snack::levelMeter .b.right -width 20 -length 200 \
	-orient vertical -oncolor orange] -side left

s record
after 100 Update

proc Update {} {
  set l [s max -start 0 -end -1 -channel 0]
  set r [s max -start 0 -end -1 -channel 1]
  s length 0

  .a.left  configure -level $l
  .a.right configure -level $r
  .b.left  configure -level $l
  .b.right configure -level $r

  after 100 Update
}