summaryrefslogtreecommitdiff
path: root/defs.c
blob: e1d1ca398beb12eaf566fe581db66a5f6f9cdac6 (plain)
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
char tcl_defs[] = "\
#\n\
#    This file is part of tk707.\n\
#\n\
#    Copyright (C) 2000, 2001, 2002, 2003, 2004 Chris Willing and Pierre Saramito \n\
#\n\
#    tk707 is free software; you can redistribute it and/or modify\n\
#    it under the terms of the GNU General Public License as published by\n\
#    the Free Software Foundation; either version 2 of the License, or\n\
#    (at your option) any later version.\n\
#\n\
#    Foobar is distributed in the hope that it will be useful,\n\
#    but WITHOUT ANY WARRANTY; without even the implied warranty of\n\
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n\
#    GNU General Public License for more details.\n\
#\n\
#    You should have received a copy of the GNU General Public License\n\
#    along with Foobar; if not, write to the Free Software\n\
#    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n\
#\n\
# -----------------------------------------\n\
#	File defs.tcl\n\
#	Definitions and pre-start set up.\n\
# -----------------------------------------\n\
proc usage {} {\n\
    puts \"usage: tk707 options...; please read the documentation (html,info,..) and the unix manual.\"\n\
    exit 0\n\
}\n\
set small_size_factor  0.75;\n\
set medium_size_factor 0.9;\n\
set normal_size_factor 1.0;\n\
set large_size_factor  2;\n\
set size_factor        $normal_size_factor\n\
set input_file_name \"\";\n\
set new_argv \"\"\n\
for {set i 0} {$i < $argc} {incr i} {\n\
        set argi [lindex $argv $i];\n\
#       puts \"defs.tcl: argv($i) = `$argi'\";\n\
        if {$argi == \"--help\"} {\n\
	    usage\n\
        } elseif {$argi == \"-small\"} {\n\
#           puts \"defs.tcl: small!\";\n\
	    set [lindex $argv $i] \"-n\";\n\
	    set size_factor $small_size_factor;\n\
        } elseif {$argi == \"-medium\"} {\n\
#           puts \"defs.tcl: medium!\";\n\
	    set size_factor $medium_size_factor;\n\
        } elseif {$argi == \"-normalsize\"} {\n\
#           puts \"defs.tcl: normal!\";\n\
	    set new_argv \"$new_argv $argi\"\n\
	    set size_factor $normal_size_factor;\n\
        } elseif {$argi == \"-big\"} {\n\
#           puts \"defs.tcl: large!\";\n\
	    set new_argv \"$new_argv $argi\"\n\
	    set size_factor $large_size_factor;\n\
	} else {\n\
	    # send option to the 2nd C-code pass...\n\
#           puts \"defs.tcl: argv($i) = `$argi'...added\";\n\
	    set new_argv \"$new_argv $argi\"\n\
	}\n\
}\n\
#\n\
# we strip options to avoid mistakes\n\
#  TODO: send -p x:y nd so to C code\n\
set argv $new_argv\n\
set argc [llength $argv]\n\
#puts \"argv := $argv\"\n\
#puts \"argc := $argc\"\n\
# -----------------------------------------\n\
# pixel to centimeter conversion\n\
# -----------------------------------------\n\
package require Tcl 8.0\n\
package require Tk 8.0\n\
set VERSION 0.8\n\
set PKGDATADIR  [pwd]\n\
\n\
# uncomment to show sonme boxes:\n\
#set debug_relief \"-borderwidth 2p -relief groove\";\n\
set debug_relief \"\";\n\
# -----------------------------------------\n\
# pixel <--> point/inch/cm\n\
# -----------------------------------------\n\
set cm_per_inch     2.54;\n\
set point_per_inch 72.00;\n\
set point_per_cm [expr $point_per_inch / $cm_per_inch];\n\
set pixel_per_point [tk scaling]\n\
# puts \"dpi $pixel_per_point\"\n\
set pixel_per_inch [expr int($pixel_per_point*$point_per_inch+0.5)]\n\
set pixel_per_cm   [expr $pixel_per_inch/$cm_per_inch]\n\
# -----------------------------------------\n\
# get window max dimension\n\
# -----------------------------------------\n\
set maxsize_in_pixel   [wm maxsize .]\n\
set maxwidth_in_pixel  [lindex $maxsize_in_pixel 0]\n\
set maxheight_in_pixel [lindex $maxsize_in_pixel 1]\n\
set maxwidth_in_cm     [expr $maxwidth_in_pixel * $pixel_per_cm ]\n\
set maxheight_in_cm    [expr $maxheight_in_pixel* $pixel_per_cm ]\n\
# -----------------------------------------\n\
# resize coefficient if window is too small\n\
# -----------------------------------------\n\
if {$size_factor < $medium_size_factor} { 	# small screens\n\
    set size_factor $small_size_factor; \n\
    set font8 \"6\";\n\
    set font12 \"6\"; \n\
    set boldfont12 \"6\"; \n\
    set boldfont13 \"6\";\n\
    set courrier_boldfont_i_50 \"10\"; \n\
    set boldr14 \"8\";\n\
    set helvetica_bold_r_12 \"6\"; \n\
    set normal_r_14 \"8\"; \n\
} elseif {$size_factor < $normal_size_factor} { # medium screen\n\
    set size_factor $medium_size_factor; \n\
    set font8      \"6\";\n\
    set font12     \"8\";\n\
    set boldfont12 \"8\"; \n\
    set boldfont13 \"8\"; \n\
    set courrier_boldfont_i_50 \"adobe-courier-bold-i-*-30\"; \n\
    set boldr14 \"bold-r-*-10\"; \n\
    set helvetica_bold_r_12 \"8\"; \n\
    set normal_r_14 \"10\"; \n\
} else { 			# normal screen\n\
    set size_factor $normal_size_factor;\n\
    set font8      \"7\";\n\
    set font12     \"9\";\n\
    set boldfont12 \"9\"; \n\
    set boldfont13 \"9\";\n\
    set courrier_boldfont_i_50 \"adobe-courier-bold-i-*-50\"; \n\
    set boldr14 \"bold-r-*-11\"; \n\
    set helvetica_bold_r_12 \"9\"; \n\
    set normal_r_14 \"10\"; \n\
}\n\
# -----------------------------------------\n\
# pixel to centimeter conversion\n\
# -----------------------------------------\n\
set scaling $size_factor;\n\
tk scaling $scaling\n\
set pixel_per_point [tk scaling]\n\
set point_per_pixel [expr 1./$pixel_per_point]\n\
set pixel_per_inch [expr int($pixel_per_point*$point_per_inch+0.5)]\n\
set pixel_per_cm   [expr $pixel_per_inch/$cm_per_inch]\n\
# -----------------------------------------\n\
# set global constants\n\
# -----------------------------------------\n\
set tcl_rcFileName \"~/.tk707rc\"\n\
if {[catch {open $tcl_rcFileName r} fid]} {\n\
} else {\n\
      catch {source $tcl_rcFileName}\n\
}\n\
set res [eval tk7_init $argv]\n\
if {$res == 1 || $res == 3} {\n\
	exit\n\
} elseif {$res ==2} {\n\
	wm iconify .\n\
	port_setup\n\
	tk7_init\n\
}\n\
rename exit exit.old\n\
proc exit {} {\n\
	exit707\n\
	exit.old\n\
}\n\
# -----------------------------------------\n\
# set global constants\n\
# -----------------------------------------\n\
set right_space_width 0.5;\n\
\n\
\n\
set tkxox(VERSION)		\"TK707-$VERSION\"\n\
set tkxox(READ) 		0\n\
set tkxox(WRITE) 		1\n\
set tkxox(TRACK) 		0\n\
set tkxox(PATTERN) 		1\n\
set tkxox(STOP)			0\n\
set tkxox(START)		1\n\
set tkxox(CONT)			2\n\
set tkxox(FILE_UNCHANGED)	0\n\
set tkxox(FILE_MODIFIED)	1\n\
set tkxox(col_on) 		#ffaa00\n\
set tkxox(col_active) 		#ffaaaa\n\
set tkxox(col_def_bg) 		#d9d9d9\n\
set tkxox(col_def_active) 	#ececec\n\
set tkxox(but_grey) 		#888888\n\
set tkxox(but_grey_active) 	#999999\n\
set tkxox(but_grey_on) 		#bbbbbb\n\
set tkxox(lamp_off) 		#882200\n\
set tkxox(lamp_on) 		#ff8800\n\
set tkxox(color_fg_shift)    	#ffffff;       # the text on the shift keys (white)\n\
set tkxox(color_bg_shift)       #000044cffb22; # the box on the shift keys (blue)\n\
set tkxox(vol_trough_color) 	#a5e3a5e3a5e3; # background of the trough for volume\n\
set tkxox(vol_slider_passive)   #570a570a570a; # volume slider when nothing append\n\
set tkxox(vol_slider_active)    #204120412041; # volume slider when we interact\n\
set tkxox(vol_highlightbackground) $tkxox(col_def_bg); # the border outside volumes\n\
\n\
set tkxox(color_score_bg)       #c24d108c09e9;  # the color of rectangles arround notes\n\
set tkxox(score_active_note)    #ffffff; 	# the color of used notes on the score\n\
set tkxox(score_passive_note)   #87cfff; 	# the color of unused  notes (at right)\n\
\n\
set tkxox(color_title_fg)       $tkxox(color_bg_shift);  # the color of \"RHYTHM COMPOSER\"\n\
set tkxox(color_title_logo_fg)  $tkxox(vol_slider_active); # the color of \"TK-707\"\n\
set tkxox(color_title_bg)       $tkxox(col_def_bg); \n\
\n\
set tkxox(tick_flam_duration)	4\n\
#\n\
# color background\n\
#\n\
tk_setPalette $tkxox(col_def_bg)\n\
#\n\
#\n\
# Properties of note elements:\n\
# WARNING: may be as in <util.h>\n\
#\n\
set tkxox(flam)               	[expr 1 << 0]\n\
set tkxox(weak_accent)       	[expr 1 << 1]\n\
set tkxox(strong_accent)     	[expr 1 << 2]\n\
set tkxox(zero_velocity)       	[expr 1 << 3]\n\
set tkxox(velocity_field)       [expr $tkxox(zero_velocity) | \\\n\
				      $tkxox(weak_accent)   | \\\n\
				      $tkxox(strong_accent)]\n\
\n\
set tkxox(col_default_velocity) $tkxox(but_grey)\n\
set tkxox(col_weak_accent)      $tkxox(lamp_on)\n\
set tkxox(col_strong_accent)    #ff0000\n\
set tkxox(col_zero_velocity)    white\n\
\n\
\n\
set mode(rdrw) 			$tkxox(READ)\n\
set mode(patr) 			-1\n\
set mode(stopgo) 		$tkxox(STOP)\n\
set mode(patgroup) 		0\n\
set mode(current_track) 	0\n\
set mode(current_pattern) 	0\n\
set mode(current_instr)		1\n\
set mode(measure) 		-1\n\
set mode(tempo) 		120\n\
set mode(cartridge) 		0\n\
set mode(midi_channel) 		0\n\
set mode(PATTERN_REPEAT) 	false\n\
set mode(TRACK_START) 		false\n\
set mode(REPEAT_INTERVAL) 	5\n\
set mode(showtrack)		true\n\
set mode(current_accent)	0\n\
set mode(file_status)		$tkxox(FILE_UNCHANGED)\n\
\n\
set flash(count) -1\n\
set flash(duration) 20\n\
\n\
# Default sound mapping\n\
#\n\
set sound(1,name) \"Bass 1\"\n\
set sound(1,shortname) \"Bass 1\"\n\
set sound(1,note) 35\n\
set sound(2,name) \"Bass 2\"\n\
set sound(2,shortname) \"Bass 2\"\n\
set sound(2,note) 36\n\
set sound(3,name) \"Snare 1\"\n\
set sound(3,shortname) \"Snare 1\"\n\
set sound(3,note) 38\n\
set sound(4,name) \"Snare 2\"\n\
set sound(4,shortname) \"Snare 2\"\n\
set sound(4,note) 40\n\
set sound(5,name) \"LowTom\"\n\
set sound(5,shortname) \"LowTom\"\n\
set sound(5,note) 41\n\
set sound(6,name) \"MidTom\"\n\
set sound(6,shortname) \"MidTom\"\n\
set sound(6,note) 45\n\
set sound(7,name) \"HighTom\"\n\
set sound(7,shortname) \"HighTom\"\n\
set sound(7,note) 48\n\
set sound(8,name) \"Rim\"\n\
set sound(8,shortname) \"Rim\"\n\
set sound(8,note) 37\n\
set sound(9,name) \"Cowbell\"\n\
set sound(9,shortname) \"Cowbell\"\n\
set sound(9,note) 56\n\
set sound(10,name) \"Hand Clap\"\n\
set sound(10,shortname) \"Clap\"\n\
set sound(10,note) 39\n\
set sound(11,name) \"Tambourine\"\n\
set sound(11,shortname) \"Tamb\"\n\
set sound(11,note) 54\n\
set sound(12,name) \"HH Closed 1\"\n\
set sound(12,shortname) \"HH C1\"\n\
set sound(12,note) 42\n\
set sound(13,name) \"HH Closed 2\"\n\
set sound(13,shortname) \"HH C2\"\n\
set sound(13,note) 42\n\
set sound(14,name) \"HHat Open\"\n\
set sound(14,shortname) \"HH Open\"\n\
set sound(14,note) 46\n\
set sound(15,name) \"Crash\"\n\
set sound(15,shortname) \"Crash\"\n\
set sound(15,note) 49\n\
set sound(16,name) \"Ride\"\n\
set sound(16,shortname) \"Ride\"\n\
set sound(16,note) 51\n\
tk7_set_sounds\n\
#\n\
# instrument(1:16) to volume(1:10) mapping\n\
#\n\
set instrument_to_volume(1) 1\n\
set instrument_to_volume(2) 1\n\
set instrument_to_volume(3) 2\n\
set instrument_to_volume(4) 2\n\
set instrument_to_volume(5) 3\n\
set instrument_to_volume(6) 4\n\
set instrument_to_volume(7) 5\n\
set instrument_to_volume(8) 6\n\
set instrument_to_volume(9) 6\n\
set instrument_to_volume(10) 7\n\
set instrument_to_volume(11) 7\n\
set instrument_to_volume(12) 8\n\
set instrument_to_volume(13) 8\n\
set instrument_to_volume(14) 8\n\
set instrument_to_volume(15) 9\n\
set instrument_to_volume(16) 10\n\
\n\
#\n\
# default abbrevs, for volume labels\n\
#\n\
set sound(1,abbrev)  \"BASS\"\n\
set sound(2,abbrev)  \"\"\n\
set sound(3,abbrev)  \"SNARE\"\n\
set sound(4,abbrev)  \"\"\n\
set sound(5,abbrev)  \"LT\"\n\
set sound(6,abbrev)  \"MT\"\n\
set sound(7,abbrev)  \"HT\"\n\
set sound(8,abbrev)  \"R\"\n\
set sound(9,abbrev)  \"CB\"\n\
set sound(10,abbrev) \"C\"\n\
set sound(11,abbrev) \"T\"\n\
set sound(12,abbrev) \"HH\"\n\
set sound(13,abbrev) \"\"\n\
set sound(14,abbrev) \"\"\n\
set sound(15,abbrev) \"CRASH\"\n\
set sound(16,abbrev) \"RIDE\"\n\
#\n\
# default volume labels\n\
#\n\
set volume_label(0) \"ACCENT\"\n\
set volume_label(1) \"$sound(1,abbrev)\"\n\
set volume_label(2) \"$sound(3,abbrev)\"\n\
set volume_label(3) \"$sound(5,abbrev)\"\n\
set volume_label(4) \"$sound(6,abbrev)\"\n\
set volume_label(5) \"$sound(7,abbrev)\"\n\
set volume_label(6) \"$sound(8,abbrev)/$sound(9,abbrev)\"\n\
set volume_label(7) \"$sound(10,abbrev)/$sound(11,abbrev)\"\n\
set volume_label(8) \"$sound(12,abbrev)\"\n\
set volume_label(9) \"$sound(15,abbrev)\"\n\
set volume_label(10) \"$sound(16,abbrev)\"\n\
#\n\
# default implicit delay (e.g. short sound)\n\
#\n\
set has_delay(1) 0\n\
set has_delay(2) 0\n\
set has_delay(3) 0\n\
set has_delay(4) 0\n\
set has_delay(5) 0\n\
set has_delay(6) 0\n\
set has_delay(7) 0\n\
set has_delay(8) 0\n\
set has_delay(9) 0\n\
set has_delay(10) 0\n\
set has_delay(11) 0\n\
set has_delay(12) 0\n\
set has_delay(13) 0\n\
set has_delay(14) 0\n\
set has_delay(15) 0\n\
set has_delay(16) 0\n\
";