Touch ups and additional capabilities added to fifo functionality. Sample Fenrir scripts in extra
This commit is contained in:
@@ -327,6 +327,14 @@ func (b *Barnard) CommandTalk(ui *uiterm.Ui, cmd string) {
|
||||
b.setTransmit(ui, 2)
|
||||
}
|
||||
|
||||
func (b *Barnard) CommandSelfMute(ui *uiterm.Ui, cmd string) {
|
||||
b.toggleSelfMute()
|
||||
}
|
||||
|
||||
func (b *Barnard) CommandSelfDeafen(ui *uiterm.Ui, cmd string) {
|
||||
b.toggleSelfDeafen()
|
||||
}
|
||||
|
||||
func (b *Barnard) CommandMicUp(ui *uiterm.Ui, cmd string) {
|
||||
b.setTransmit(ui, 1)
|
||||
}
|
||||
@@ -649,40 +657,11 @@ func (b *Barnard) OnTextInput(ui *uiterm.Ui, textbox *uiterm.Textbox, text strin
|
||||
|
||||
// Check if this is a command (starts with /)
|
||||
if strings.HasPrefix(text, "/") {
|
||||
// Remove the leading slash and process as command
|
||||
// Remove the leading slash and process it through the same command
|
||||
// registry used by FIFO control.
|
||||
cmdText := strings.TrimPrefix(text, "/")
|
||||
parts := strings.SplitN(cmdText, " ", 2)
|
||||
cmdName := parts[0]
|
||||
cmdArgs := ""
|
||||
if len(parts) > 1 {
|
||||
cmdArgs = parts[1]
|
||||
}
|
||||
|
||||
// Handle built-in commands
|
||||
switch cmdName {
|
||||
case "file":
|
||||
b.CommandPlayFile(ui, cmdArgs)
|
||||
case "stop":
|
||||
b.CommandStopFile(ui, cmdArgs)
|
||||
case "exit":
|
||||
b.CommandExit(ui, cmdArgs)
|
||||
case "status":
|
||||
b.CommandStatus(ui, cmdArgs)
|
||||
case "noise":
|
||||
b.CommandNoiseSuppressionToggle(ui, cmdArgs)
|
||||
case "agc":
|
||||
b.CommandAGCToggle(ui, cmdArgs)
|
||||
case "record":
|
||||
b.CommandRecord(ui, cmdArgs)
|
||||
case "admin":
|
||||
b.CommandAdmin(ui, cmdArgs)
|
||||
case "micup":
|
||||
b.CommandMicUp(ui, cmdArgs)
|
||||
case "micdown":
|
||||
b.CommandMicDown(ui, cmdArgs)
|
||||
case "toggle", "talk":
|
||||
b.CommandTalk(ui, cmdArgs)
|
||||
default:
|
||||
if !ui.DispatchCommand(cmdText) {
|
||||
cmdName, _, _ := strings.Cut(cmdText, " ")
|
||||
b.AddOutputLine(fmt.Sprintf("Unknown command: /%s", cmdName))
|
||||
}
|
||||
return
|
||||
@@ -766,6 +745,8 @@ func (b *Barnard) OnUiInitialize(ui *uiterm.Ui) {
|
||||
b.Ui.AddCommandListener(b.CommandMicDown, "micdown")
|
||||
b.Ui.AddCommandListener(b.CommandTalk, "toggle")
|
||||
b.Ui.AddCommandListener(b.CommandTalk, "talk")
|
||||
b.Ui.AddCommandListener(b.CommandSelfMute, "mute")
|
||||
b.Ui.AddCommandListener(b.CommandSelfDeafen, "deafen")
|
||||
b.Ui.AddCommandListener(b.CommandExit, "exit")
|
||||
b.Ui.AddCommandListener(b.CommandStatus, "status")
|
||||
b.Ui.AddCommandListener(b.CommandNoiseSuppressionToggle, "noise")
|
||||
|
||||
Reference in New Issue
Block a user