1#!/bin/sh
2# the next line restarts using wish \
3exec wish8.3 "$0" "$@"
4
5package require -exact snack 2.2
6
7set f [snack::filter echo 0.6 0.6 30 0.4 50 0.3]
8
9snack::sound s
10
11pack [frame .f]
12
13set v(iGain) 0.6
14pack [scale .f.s1 -label InGain -from 1.0 -to 0.0 -resolution .01 \
15	-variable v(iGain) -command Config] -side left
16
17set v(oGain) 0.6
18pack [scale .f.s2 -label OutGain -from 1.0 -to 0.0 -resolution .01 \
19	-variable v(oGain) -command Config] -side left
20
21set v(delay1) 30.0
22pack [scale .f.s3 -label Delay1 -from 250.0 -to 10.0 -variable v(delay1) \
23	-command Config] -side left
24
25set v(decay1) 0.4
26pack [scale .f.s4 -label Decay1 -from 1.0 -to 0.0 -resolution .01 \
27	-variable v(decay1) -command Config] -side left
28
29set v(delay2) 50.0
30pack [scale .f.s5 -label Delay2 -from 250.0 -to 10.0 -variable v(delay2) \
31	-command Config] -side left
32
33set v(decay2) 0.3
34pack [scale .f.s6 -label Decay2 -from 1.0 -to 0.0 -resolution .01 \
35	-variable v(decay2) -command Config] -side left
36
37snack::createIcons
38pack [frame .fb]
39pack [button .fb.a -image snackOpen -command Load] -side left
40pack [button .fb.b -bitmap snackPlay -command Play] -side left
41pack [button .fb.c -bitmap snackStop -command "s stop"] -side left
42
43proc Config {args} {
44  global f v
45  $f configure $v(iGain) $v(oGain) $v(delay1) $v(decay1) $v(delay2) $v(decay2)
46}
47
48proc Play {} {
49  s stop
50  s play -filter $::f
51}
52
53proc Load {} {
54  set file [snack::getOpenFile -initialdir [file dirname [s cget -file]]]
55  if {$file == ""} return
56  s config -file $file
57}
58