Look for talk_group-<tg> file when announcing talkgroups
This commit is contained in:
parent
a7bfdaeb19
commit
0a48e9ee8f
|
|
@ -39,6 +39,22 @@ if {$logic_name != [namespace tail [namespace current]]} {
|
|||
}
|
||||
|
||||
|
||||
#
|
||||
# A helper function for announcing a talkgroup.
|
||||
# If there is an audio clip matching the name talk_group-<tg> it will be played
|
||||
# instead of spelling the digits. Look at the documentation for playMsg for
|
||||
# more information on where to put the audio clip.
|
||||
#
|
||||
# tg - The talkgroup to announce
|
||||
#
|
||||
proc say_talkgroup {tg} {
|
||||
if [playMsg "Core" "talk_group-$tg" 0] {
|
||||
} else {
|
||||
spellNumber $tg
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# Executed when an unknown command is received
|
||||
# cmd - The command string
|
||||
|
|
@ -69,11 +85,11 @@ proc report_tg_status {} {
|
|||
set prev_announce_time [clock seconds]
|
||||
set prev_announce_tg $selected_tg
|
||||
playMsg "Core" "talk_group"
|
||||
spellNumber $selected_tg
|
||||
say_talkgroup $selected_tg
|
||||
} else {
|
||||
playMsg "Core" "previous"
|
||||
playMsg "Core" "talk_group"
|
||||
spellNumber $previous_tg
|
||||
say_talkgroup $previous_tg
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -116,7 +132,7 @@ proc tg_local_activation {new_tg old_tg} {
|
|||
set prev_announce_tg $new_tg
|
||||
playSilence 100
|
||||
playMsg "Core" "talk_group"
|
||||
spellNumber $new_tg
|
||||
say_talkgroup $new_tg
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -143,7 +159,7 @@ proc tg_remote_activation {new_tg old_tg} {
|
|||
set prev_announce_tg $new_tg
|
||||
playSilence 100
|
||||
playMsg "Core" "talk_group"
|
||||
spellNumber $new_tg
|
||||
say_talkgroup $new_tg
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -175,7 +191,7 @@ proc tg_command_activation {new_tg old_tg} {
|
|||
set prev_announce_tg $new_tg
|
||||
playSilence 100
|
||||
playMsg "Core" "talk_group"
|
||||
spellNumber $new_tg
|
||||
say_talkgroup $new_tg
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -195,7 +211,7 @@ proc tg_default_activation {new_tg old_tg} {
|
|||
# set prev_announce_tg $new_tg
|
||||
# playSilence 100
|
||||
# playMsg "Core" "talk_group"
|
||||
# spellNumber $new_tg
|
||||
# say_talkgroup $new_tg
|
||||
#}
|
||||
}
|
||||
|
||||
|
|
@ -216,7 +232,7 @@ proc tg_qsy {new_tg old_tg} {
|
|||
playSilence 100
|
||||
playMsg "Core" "qsy"
|
||||
#playMsg "Core" "talk_group"
|
||||
spellNumber $new_tg
|
||||
say_talkgroup $new_tg
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -254,7 +270,7 @@ proc tg_qsy_failed {} {
|
|||
proc tg_qsy_pending {tg} {
|
||||
playSilence 100
|
||||
playMsg "Core" "qsy"
|
||||
spellNumber $tg
|
||||
say_talkgroup $tg
|
||||
playMsg "Core" "pending"
|
||||
}
|
||||
|
||||
|
|
@ -269,7 +285,7 @@ proc tg_qsy_ignored {tg} {
|
|||
playSilence 100
|
||||
if {!$qsy_pending_active} {
|
||||
playMsg "Core" "qsy"
|
||||
spellNumber $tg
|
||||
say_talkgroup $tg
|
||||
}
|
||||
playMsg "Core" "ignored"
|
||||
playSilence 500
|
||||
|
|
@ -337,7 +353,7 @@ proc tmp_monitor_add {tg} {
|
|||
#puts "### tmp_monitor_add: $tg"
|
||||
playSilence 100
|
||||
playMsg "Core" "monitor"
|
||||
spellNumber $tg
|
||||
say_talkgroup $tg
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -18,17 +18,43 @@
|
|||
# EchoLink, Help, Parrot etc. If a sound is not found in the specified context,
|
||||
# a search in the "Default" context is done.
|
||||
#
|
||||
proc playMsg {context msg} {
|
||||
# It's also possible to have local overrides by putting files under a "local"
|
||||
# directory either directly under the "sounds" directory or under the language
|
||||
# pack directory. For example if context is "Core" and the language is set to
|
||||
# "en_US" the following paths will be searched:
|
||||
#
|
||||
# .../sounds/en_US/local/Core/
|
||||
# .../sounds/local/Core/
|
||||
# .../sounds/en_US/Core/
|
||||
# .../sounds/en_US/local/Default/
|
||||
# .../sounds/local/Default/
|
||||
# .../sounds/en_US/Default/
|
||||
#
|
||||
# context - The context to look for the sound files in (e.g Default,
|
||||
# Parrot etc).
|
||||
# msg - The basename of the file to play
|
||||
# warn - Set to 0 to not print a warning if no sound clip was found
|
||||
#
|
||||
proc playMsg {context msg {warn 1}} {
|
||||
global basedir
|
||||
global langdir
|
||||
|
||||
set candidates [glob -nocomplain "$langdir/$context/$msg.{wav,raw,gsm}" \
|
||||
"$langdir/Default/$msg.{wav,raw,gsm}"];
|
||||
if { [llength $candidates] > 0 } {
|
||||
set candidates [glob -nocomplain \
|
||||
"$langdir/local/$context/$msg.{wav,raw,gsm}" \
|
||||
"$basedir/sounds/local/$context/$msg.{wav,raw,gsm}" \
|
||||
"$langdir/$context/$msg.{wav,raw,gsm}" \
|
||||
"$langdir/local/Default/$msg.{wav,raw,gsm}" \
|
||||
"$basedir/sounds/local/Default/$msg.{wav,raw,gsm}" \
|
||||
"$langdir/Default/$msg.{wav,raw,gsm}"];
|
||||
if {[llength $candidates] > 0} {
|
||||
playFile [lindex $candidates 0];
|
||||
} else {
|
||||
puts "*** WARNING: Could not find audio clip \"$msg\" in context \"$context\"";
|
||||
if {$warn} {
|
||||
puts "*** WARNING: Could not find audio clip \"$msg\" in context \"$context\"";
|
||||
}
|
||||
return 0
|
||||
}
|
||||
return 1
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue