forked from csound/csound
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nsliders.tk
119 lines (102 loc) · 2.33 KB
/
nsliders.tk
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#
# Controls via sliders for csound in tcl/tk
# John ffitch 2000 May 14
# Modified for stdin/out use May 21
# 2001 January: added text boxes
#
# Create a new slider
proc displayslider num {
global lastsl
set sl ".s$num"
set ex [winfo exists $sl]
if {$ex == 0} {
scale $sl -label Control$num -from 0 -to 127 -orient horizontal -length 10c -command "newval $num"
pack $sl -after $lastsl
set lastsl $sl
}
}
proc newval {num val} {
puts "$num $val"
}
# Output controls
proc setvalue {which val} {
set sl ".s$which"
displayslider $which
$sl set $val
}
proc setmin {which val} {
set sl ".s$which"
displayslider $which
$sl configure -from $val
}
proc setmax {which val} {
set sl ".s$which"
displayslider $which
$sl configure -to $val
}
proc setlab {which val} {
set sl ".s$which"
displayslider $which
$sl configure -label $val
}
# AND NOW THE BUTTONS AND CHECKS
# Create a new button
proc displaybutton num {
global lastb
set bt ".b$num"
set ex [winfo exists $bt]
if {$ex == 0} {
button $bt -text Button$num -command "buttonpush $num"
pack $bt -pady 2m -after $lastb
set lastb $bt
}
}
proc buttonpush num {
puts "0 $num"
}
# Create a new check
proc displaycheck num {
global xxx
set ch ".x$num"
set ex [winfo exists $ch]
if {$ex == 0} {
checkbutton $ch -text Check$num -variable xxx -command "checkpush $num"
pack $ch -pady 2m
}
}
proc checkpush num {
global xxx
puts "-$num $xxx"
}
proc settext {num txt} {
global lasttxt
set wl ".flashtxt$num"
set ex [winfo exists $wl]
if {$ex == 0} {
toplevel $wl
message $wl.msg -text $txt -width 10c -justify left -relief raised -bd 2
pack $wl.msg
} else {
$wl.msg configure -text $txt
}
}
proc deltext num {
set wl ".txt$num"
destroy $wl
}
# ending
message .title -width 10c -justify center -font -*-times-bold-r-normal--*-180-*-*-*-*-*-* -text "Csound Controls"
pack .title
set lastsl .title
message .title1 -width 10c -justify center -font -*-times-bold-r-normal--*-100-*-*-*-*-*-* -text " "
pack .title1
set lastb .title1
#displayslider 1
# # # Experimental
# displayslider 2
# displaybutton 1
# displayslider 3
# displaybutton 2
# displaycheck 1
# # # End
puts "Ready"