mirror of
https://github.com/thestk/stk
synced 2026-01-18 15:11:53 +00:00
Version 4.4.4
This commit is contained in:
committed by
Stephen Sinclair
parent
0aec39260a
commit
fc877b87bf
@@ -13,7 +13,7 @@
|
||||
Stanford, bearing the names of Karplus and/or
|
||||
Strong.
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace stk {
|
||||
Stanford, bearing the names of Karplus and/or
|
||||
Strong.
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
sample rates. You can specify the maximum polyphony (maximum
|
||||
number of simultaneous voices) in Tabla.h.
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace stk {
|
||||
sample rates. You can specify the maximum polyphony (maximum
|
||||
number of simultaneous voices) in Tabla.h.
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
sample rates. You can specify the maximum polyphony (maximum
|
||||
number of simultaneous voices) in VoicDrum.h.
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace stk {
|
||||
sample rates. You can specify the maximum polyphony (maximum
|
||||
number of simultaneous voices) in VoicDrum.h.
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2012.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
|
||||
@@ -7,25 +7,12 @@ set cont2 7.0
|
||||
set cont4 0.0
|
||||
set cont11 10.0
|
||||
set cont7 3.0
|
||||
set outID "stdout"
|
||||
set commtype "stdout"
|
||||
|
||||
# Configure main window
|
||||
wm title . "STK RagaMatic Controller"
|
||||
wm iconname . "raga"
|
||||
. config -bg grey20
|
||||
|
||||
# Configure "communications" menu
|
||||
menu .menu -tearoff 0
|
||||
menu .menu.communication -tearoff 0
|
||||
.menu add cascade -label "Communication" -menu .menu.communication \
|
||||
-underline 0
|
||||
.menu.communication add radio -label "Console" -variable commtype \
|
||||
-value "stdout" -command { setComm }
|
||||
.menu.communication add radio -label "Socket" -variable commtype \
|
||||
-value "socket" -command { setComm }
|
||||
. configure -menu .menu
|
||||
|
||||
# Configure bitmap display
|
||||
if {[file isdirectory bitmaps]} {
|
||||
set bitmappath bitmaps
|
||||
@@ -50,12 +37,11 @@ label .banner.bottom.ragamat -text " * * RagaMatic * *\n\n \
|
||||
bind . <Destroy> +myExit
|
||||
|
||||
proc myExit {} {
|
||||
global outID
|
||||
puts $outID [format "NoteOff 0.0 1 60 127"]
|
||||
flush $outID
|
||||
puts $outID [format "ExitProgram"]
|
||||
flush $outID
|
||||
close $outID
|
||||
puts [format "NoteOff 0.0 1 60 127"]
|
||||
flush stdout
|
||||
puts [format "ExitProgram"]
|
||||
flush stdout
|
||||
close stdout
|
||||
exit
|
||||
}
|
||||
|
||||
@@ -130,27 +116,23 @@ proc rockOut {} {
|
||||
}
|
||||
|
||||
proc raga {scale} {
|
||||
global outID
|
||||
puts $outID [format "ControlChange 0.0 1 64 %f" $scale]
|
||||
flush $outID
|
||||
puts [format "ControlChange 0.0 1 64 %f" $scale]
|
||||
flush stdout
|
||||
}
|
||||
|
||||
proc noteOn {pitchVal pressVal} {
|
||||
global outID
|
||||
puts $outID [format "NoteOn 0.0 1 %f %f" $pitchVal $pressVal]
|
||||
flush $outID
|
||||
puts [format "NoteOn 0.0 1 %f %f" $pitchVal $pressVal]
|
||||
flush stdout
|
||||
}
|
||||
|
||||
proc noteOff {pitchVal pressVal} {
|
||||
global outID
|
||||
puts $outID [format "NoteOff 0.0 1 %f %f" $pitchVal $pressVal]
|
||||
flush $outID
|
||||
puts [format "NoteOff 0.0 1 %f %f" $pitchVal $pressVal]
|
||||
flush stdout
|
||||
}
|
||||
|
||||
proc printWhatz {tag value1 value2 } {
|
||||
global outID
|
||||
puts $outID [format "%s %i %f" $tag $value1 $value2]
|
||||
flush $outID
|
||||
puts [format "%s %i %f" $tag $value1 $value2]
|
||||
flush stdout
|
||||
}
|
||||
|
||||
frame .banner.butts -bg black
|
||||
@@ -237,68 +219,32 @@ pack .controls.cont7 -padx 10 -pady 10
|
||||
|
||||
pack .controls -side left -padx 10 -pady 10
|
||||
|
||||
# Socket connection procedure
|
||||
set d .socketdialog
|
||||
bind . <Configure> {+ center_the_toplevel %W }
|
||||
proc center_the_toplevel { w } {
|
||||
|
||||
proc setComm {} {
|
||||
global outID
|
||||
global commtype
|
||||
global d
|
||||
if {$commtype == "stdout"} {
|
||||
if { [string compare "stdout" $outID] } {
|
||||
set i [tk_dialog .dialog "Break Socket Connection?" {You are about to break an existing socket connection ... is this what you want to do?} "" 0 Cancel OK]
|
||||
switch $i {
|
||||
0 {set commtype "socket"}
|
||||
1 {close $outID
|
||||
set outID "stdout"}
|
||||
}
|
||||
}
|
||||
} elseif { ![string compare "stdout" $outID] } {
|
||||
set sockport 2001
|
||||
set sockhost localhost
|
||||
toplevel $d
|
||||
wm title $d "STK Client Socket Connection"
|
||||
wm resizable $d 0 0
|
||||
grab $d
|
||||
label $d.message -text "Specify a socket host and port number below (if different than the STK defaults shown) and then click the \"Connect\" button to invoke a socket-client connection attempt to the STK socket server." \
|
||||
-background white -font {Helvetica 10 bold} \
|
||||
-wraplength 3i -justify left
|
||||
frame $d.sockhost
|
||||
entry $d.sockhost.entry -width 15
|
||||
label $d.sockhost.text -text "Socket Host:" \
|
||||
-font {Helvetica 10 bold}
|
||||
frame $d.sockport
|
||||
entry $d.sockport.entry -width 15
|
||||
label $d.sockport.text -text "Socket Port:" \
|
||||
-font {Helvetica 10 bold}
|
||||
pack $d.message -side top -padx 5 -pady 10
|
||||
pack $d.sockhost.text -side left -padx 1 -pady 2
|
||||
pack $d.sockhost.entry -side right -padx 5 -pady 2
|
||||
pack $d.sockhost -side top -padx 5 -pady 2
|
||||
pack $d.sockport.text -side left -padx 1 -pady 2
|
||||
pack $d.sockport.entry -side right -padx 5 -pady 2
|
||||
pack $d.sockport -side top -padx 5 -pady 2
|
||||
$d.sockhost.entry insert 0 $sockhost
|
||||
$d.sockport.entry insert 0 $sockport
|
||||
frame $d.buttons
|
||||
button $d.buttons.cancel -text "Cancel" -bg grey66 \
|
||||
-command { set commtype "stdout"
|
||||
set outID "stdout"
|
||||
destroy $d }
|
||||
button $d.buttons.connect -text "Connect" -bg grey66 \
|
||||
-command {
|
||||
set sockhost [$d.sockhost.entry get]
|
||||
set sockport [$d.sockport.entry get]
|
||||
set err [catch {socket $sockhost $sockport} outID]
|
||||
# Callback on the <Configure> event for a toplevel
|
||||
# that should be centered on the screen
|
||||
|
||||
if {$err == 0} {
|
||||
destroy $d
|
||||
} else {
|
||||
tk_dialog $d.error "Socket Error" {Error: Unable to make socket connection. Make sure the STK socket server is first running and that the port number is correct.} "" 0 OK
|
||||
} }
|
||||
pack $d.buttons.cancel -side left -padx 5 -pady 10
|
||||
pack $d.buttons.connect -side right -padx 5 -pady 10
|
||||
pack $d.buttons -side bottom -padx 5 -pady 10
|
||||
}
|
||||
}
|
||||
# Make sure that we aren't configuring a child window
|
||||
if { [string equal $w [winfo toplevel $w]] } {
|
||||
|
||||
# Calculate the desired geometry
|
||||
set width [winfo reqwidth $w]
|
||||
set height [winfo reqheight $w]
|
||||
set x [expr { ( [winfo vrootwidth $w] - $width ) / 2 }]
|
||||
set y [expr { ( [winfo vrootheight $w] - $height ) / 2 }]
|
||||
#set y 0
|
||||
|
||||
# Hand the geometry off to the window manager
|
||||
wm geometry $w ${width}x${height}+${x}+${y}
|
||||
|
||||
# Unbind <Configure> so that this procedure is
|
||||
# not called again when the window manager finishes
|
||||
# centering the window. Also, revert geometry management
|
||||
# to internal default for subsequent size changes.
|
||||
bind $w <Configure> {}
|
||||
wm geometry $w ""
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
Reference in New Issue
Block a user