1#!/bin/sh
2# the next line restarts using wish \
3exec wish8.3 "$0" "$@"
4
5package require -exact snack 2.2
6
7snack::sound s
8
9set v(0) 1
10set v(1) 0
11set v(2) 0
12set v(3) 1
13set f [snack::filter map $v(0) $v(1) $v(2) $v(3)]
14
15pack [label .l -text "In (L,R)"] -anchor e
16pack [frame .f]
17pack [label .f.l -text Out] -side left
18pack [frame .f.f] -side left
19pack [frame .f.f.t]
20pack [frame .f.f.b]
21pack [label .f.f.t.l -text L] -side left
22pack [checkbutton .f.f.t.a -var v(0) -command Config] -side left
23pack [checkbutton .f.f.t.b -var v(1) -command Config] -side left
24pack [label .f.f.b.l -text R] -side left
25pack [checkbutton .f.f.b.a -var v(2) -command Config] -side left
26pack [checkbutton .f.f.b.b -var v(3) -command Config] -side left
27pack [frame .fb]
28snack::createIcons
29pack [button .fb.a -image snackOpen -command Load] -side left
30pack [button .fb.b -bitmap snackPlay -command Play] -side left
31pack [button .fb.c -bitmap snackStop -command "s stop"] -side left
32
33proc Config {} {
34    global f v
35    $f configure $v(0) $v(1) $v(2) $v(3)
36}
37
38proc Play {} {
39    global f
40    s stop
41    s play -devicechannels 2 -filter $f
42}
43
44proc Load {} {
45 set file [snack::getOpenFile -initialdir [file dirname [s cget -file]]]
46 if {$file == ""} return
47 s config -file $file
48}
49