1#!/bin/sh
2# the next line restarts using wish \
3exec wish8.4 "$0" "$@"
4
5package require -exact snack 2.2
6
7# This example shows how to control the volume of two audio clips.
8
9snack::sound s1
10snack::sound s2
11
12set map1 [snack::filter map 1.0]
13set map2 [snack::filter map 1.0]
14
15proc play {} {
16 s1 play -filter $::map1
17 s2 play -filter $::map2
18}
19
20proc stop {} {
21 s1 stop
22 s2 stop
23}
24
25proc configure { args } {
26 $::map1 configure [$::ft.s1 get]
27 $::map2 configure [$::ft.s2 get]
28}
29
30proc load1 {} {
31 s1 configure -file [tk_getOpenFile]
32}
33
34proc load2 {} {
35 s2 configure -file [tk_getOpenFile]
36}
37
38set t .
39set ft [frame $t.ft]
40set fb [frame $t.fb]
41pack $fb -side bottom
42pack $ft
43
44scale $ft.s1 -label "sound 1" -from 1.0 -to 0.0 -resolution 0.01 -command configure
45scale $ft.s2 -label "sound 2" -from 1.0 -to 0.0 -resolution 0.01 -command configure
46pack $ft.s1 $ft.s2 -side left
47
48pack [button $fb.bl1 -text "load 1" -command load1] -side left
49pack [button $fb.bl2 -text "load 2" -command load2] -side left
50pack [button $fb.bp -bitmap snackPlay -command play] -side left
51pack [button $fb.bs -bitmap snackStop -command stop] -side left
52