Open tone-test output before transmission

This commit is contained in:
Brandon McGinty (chatgpt)
2026-08-09 14:41:01 -04:00
committed by Brandon McGinty
parent d64e5125dd
commit e564bb8583
3 changed files with 22 additions and 7 deletions
+6 -6
View File
@@ -56,12 +56,8 @@ func (b *Barnard) connect(reconnect bool) bool {
// --- Tone test mode: skip all OpenAL; generate 440 Hz tone
// --- and save incoming audio to a file.
// Start the tone generator goroutine.
b.toneTestStop = make(chan struct{})
go StartToneGenerator(b.Client, b.toneTestStop)
b.Tx = true
// Attach the audio file saver.
// Open the output first. Starting transmission before this succeeds
// leaves an orphaned tone goroutine when the path is unusable.
saver, err := NewAudioFileSaver(b.ToneTestOutput)
if err != nil {
b.exitWithError(err)
@@ -70,6 +66,10 @@ func (b *Barnard) connect(reconnect bool) bool {
b.toneTestSaver = saver
b.Client.Config.AttachAudio(saver)
b.toneTestStop = make(chan struct{})
go StartToneGenerator(b.Client, b.toneTestStop)
b.Tx = true
b.Connected = true
return true
}