diff --git a/internal/audio/recorder.go b/internal/audio/recorder.go index 402af36..d75c89f 100644 --- a/internal/audio/recorder.go +++ b/internal/audio/recorder.go @@ -130,6 +130,30 @@ func (r *Recorder) Start(fromDev, micDev string, prerollSec int) error { if prerollSec < 0 { prerollSec = 0 } + // Does the configured endpoint still EXIST? + // + // Endpoint ids are stored, and a DAX channel that is reconfigured, disabled + // or removed comes back with a different id. The old one then opens without + // complaint on some drivers and simply never streams — which is + // indistinguishable from a quiet band until the recording turns out empty. + // Checking the list takes milliseconds and answers it outright. + if devs, derr := ListInputDevices(); derr == nil { + known := func(id string) bool { + for _, d := range devs { + if d.ID == id { + return true + } + } + return false + } + if fromDev != "" && !known(fromDev) { + LogSink("recorder: the configured radio input no longer exists (%s) — re-select it in Settings → Audio", fromDev) + AlertSink("The configured radio audio input no longer exists — re-select it in Settings") + } + if micDev != "" && micDev != fromDev && !known(micDev) { + LogSink("recorder: the configured microphone no longer exists (%s) — re-select it in Settings → Audio", micDev) + } + } r.prerollSamples = prerollSec * sampleRate r.twoSrc = micDev != "" && micDev != fromDev r.stopCh = make(chan struct{})