refactor(tci): remove the test bench now that choosing the device is the setup
The TCI section of the audio settings was an investigation: open the stream, read what arrives, record ten seconds to listen to, key a tone. It answered every question it was built for — the frame layout, the sample width, that the radio asks rather than follows a clock, that the transmit audio source decides — and confirmed 80 W on real hardware. None of that belongs in front of an operator now. The radio is simply one of the devices in the two dropdowns, and choosing it IS the configuration: one control, in the place where the question is already being asked. Keeping the tick box beside it would have been two switches for one decision, with the second one where nobody looks. Gone with it: the stream/record/probe bindings, the audio.tci_rx setting, and twenty-four translation keys. The plumbing they proved out stays and now carries the voice keyer.
This commit is contained in:
+7
-37
@@ -68,18 +68,18 @@ func tciToRecorderPCM(rate int, samples []float32) []byte {
|
||||
// startTCIRecording opens the receive stream and routes it to the recorder.
|
||||
//
|
||||
// Called when the TCI backend comes up, and only when the operator has asked
|
||||
// for it: opening a 384 kB/s stream on a station that records nothing is work
|
||||
// the radio does for nobody.
|
||||
// for it by choosing the radio as their receive device: opening a 384 kB/s
|
||||
// stream on a station that records nothing is work the radio does for nobody.
|
||||
func (a *App) startTCIRecording() {
|
||||
if a.cat == nil {
|
||||
return
|
||||
}
|
||||
// Two ways to ask for the same thing: the option in the TCI section, or
|
||||
// simply choosing the radio as the "From radio" device. The second is where
|
||||
// an operator looks first — it is the question they are already answering —
|
||||
// so it has to work as well as the tick box.
|
||||
// One switch, and it is the one an operator is already looking at: the
|
||||
// "From radio" device. There used to be a tick box here as well, from when
|
||||
// this was an experiment with no device to choose — two controls for one
|
||||
// question, and the second was where nobody would look.
|
||||
cfg, _ := a.GetAudioSettings()
|
||||
if a.settingOr(keyTCIRecAudio, "") != "1" && cfg.FromRadio != audio.NetworkDeviceID {
|
||||
if cfg.FromRadio != audio.NetworkDeviceID {
|
||||
return
|
||||
}
|
||||
err := a.cat.TCIAudioDo(func(t cat.TCIAudioController) error {
|
||||
@@ -96,33 +96,3 @@ func (a *App) startTCIRecording() {
|
||||
}
|
||||
applog.Printf("tci: recording the receive audio over TCI — no virtual cable needed")
|
||||
}
|
||||
|
||||
// keyTCIRecAudio turns it on. Off by default: it replaces whatever sound card
|
||||
// the operator has already wired up, and a setting that changes where a
|
||||
// recording comes from should be asked for rather than assumed.
|
||||
const keyTCIRecAudio = "audio.tci_rx"
|
||||
|
||||
// GetTCIRecordAudio reports whether the recorder takes its audio from the radio.
|
||||
func (a *App) GetTCIRecordAudio() bool { return a.settingOr(keyTCIRecAudio, "") == "1" }
|
||||
|
||||
// SetTCIRecordAudio turns it on or off, and applies it NOW rather than at the
|
||||
// next restart: an option that needs the application relaunched to take effect
|
||||
// reads as an option that does not work.
|
||||
func (a *App) SetTCIRecordAudio(on bool) error {
|
||||
a.setSetting(keyTCIRecAudio, boolStr(on))
|
||||
if on {
|
||||
a.startTCIRecording()
|
||||
return nil
|
||||
}
|
||||
if a.cat == nil {
|
||||
return nil
|
||||
}
|
||||
return a.cat.TCIAudioDo(func(t cat.TCIAudioController) error {
|
||||
if s, ok := t.(interface {
|
||||
SetTCIAudioSink(func(int, []float32))
|
||||
}); ok {
|
||||
s.SetTCIAudioSink(nil)
|
||||
}
|
||||
return t.StopTCIAudio()
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user