#!/usr/bin/wish # matt willis - simple tk interface to fmtools # mute button added by James Smith # -*- tcl -*- # These are stations in the Glasgow area. Customize for your own locale. set stations \ "RadioScotland 94.3 Radio1 99.5 Radio2 89.9 Radio3 92.2 Radio4 95.85 Q96fm 96.3 ScotFM 100.3 ClassicFM 101.65 Clyde-1 102.5 BeatFM 106.1 " set volume 32768 set n [expr [llength $stations]/2] set radbut 0 set tuneit 9430 set rvol 32768 set state 0 # make tuner buttons frame .labels for {set i 0} {$i<$n} {incr i 1} { radiobutton .r$i -value $i -variable radbut \ -text [lindex $stations [expr $i *2]] -command setstation pack .r$i -anchor w -in .labels } frame .rhs scale .vol -orient horizontal -from 0 -to 65535 -showvalue 0 \ -variable volume -label Volume: entry .stn -bg black -fg green -font "-*-helvetica-*-r-*-*-20-*-*-*-*-*-*-*" \ -width 6 -justify right -state disabled button .exit -command out -text exit button .mute -command mute -text mute pack .vol .stn .exit .mute -in .rhs pack .labels .rhs -side left .vol configure -command setvolume proc setstation {} { global stations radbut volume eval exec fm [lindex $stations [expr $radbut*2+1]] $volume .stn configure -state normal .stn delete 0 end .stn insert 0 [lindex $stations [expr $radbut*2+1]] .stn configure -state disabled } proc setvolume {sliderval} { setstation } proc out {} { global stations radbut volume eval exec fm [lindex $stations [expr $radbut*2+1]] 0 exit } proc mute {} { global stations radbut volume rvol state if {$state==0} { set rvol $volume eval exec fm [lindex $stations [expr $radbut*2+1]] 0 set state 1 .mute config -text unmute } else { eval exec fm [lindex $stations [expr $radbut*2+1]] $volume set state 0 .mute config -text mute } }