File: helpers.tcl

package info (click to toggle)
cecilia 2.0.5-2.1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 4,440 kB
  • ctags: 833
  • sloc: tcl: 9,786; sh: 1,085; makefile: 69; csh: 13
file content (64 lines) | stat: -rw-r--r-- 1,822 bytes parent folder | download | duplicates (3)
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
#
# 	UNIX-SPECIFIC HELPERS MANAGEMENT
# 	(c) 1997 Alexandre Burton & Jean Piche
# 	v1.80a (10/08/97)
#
#       MODIFIED BY Hans-Christoph Steiner
#       $Id $
#

proc getSoundFileInfo {path} {
    global prefs
    catch    {exec $prefs(help:CSND) -U sndinfo $path} stuff
    if {[lsearch $stuff "AIFF"] == -1 && [lsearch $stuff "WAVE"] == -1 } {return 0}
    set type [lindex $stuff [expr [lsearch $stuff "soundfile,"] - 1]]
    if {$type == ""} {
	set type [lindex $stuff [expr [lsearch $stuff "soundfile"] - 1]]
    }
    set dur  [lindex $stuff [expr [lsearch $stuff "seconds"] - 1]]
    set sr   [string trim [lindex $stuff [expr [lsearch $stuff "srate"] + 1]] ", "]
    set tr   [string trim [lindex $stuff [expr [lsearch $stuff ${sr},] + 1]] ", "]
    set siz  [lindex $stuff [expr [lsearch $stuff ${tr},] + 1]]
    return   "$dur $sr [string tolower $type] $tr $siz"

}

proc editSoundFile { path } {
    global prefs
    exec $prefs(help:EDIT) [string trim $path \"] &
}

proc convSoundFile { path } {
    global prefs
    exec soundfiler [string trim $path \"] &
}

proc playSound {what where} {
    global ceclib prefs player
     exec $prefs(help:PLAY) [string trim $what \"] &
}

proc Helpme  {what} {
    global ceclib prefs tcl_platform
    set helpPage [file join $ceclib doc $what]

    switch -- $tcl_platform(os) {
	IRIX {
	    set ps [exec ps -e]
	    if ![regexp netscape $ps] { 
		puts "info: starting netscape."
		exec netscape $helpPage & 
	    } else { exec netscape -remote openURL(file:$helpPage) & }
	}
	Linux {
	    set ps [exec ps -e]
	    if ![regexp $prefs(help:HTML) $ps] { 
		puts "info: starting $prefs(help:HTML)."
		exec $prefs(help:HTML) $helpPage & 
	    } else { exec $prefs(help:HTML) -remote openURL(file:$helpPage) & }
	}
	Darwin {
	    exec /usr/bin/open $helpPage &
	}
    }
}