Detach tone-test savers on reconnect

This commit is contained in:
Brandon McGinty (chatgpt)
2026-08-09 23:12:56 -04:00
committed by Brandon McGinty
parent b23afebdb3
commit bad4e8172a
4 changed files with 66 additions and 15 deletions
+16 -4
View File
@@ -64,10 +64,11 @@ type Barnard struct {
FileStreamMutex sync.Mutex
// Added for tone test mode (bypasses all soundcard/OpenAL)
ToneTest bool
ToneTestOutput string
toneTestStop chan struct{}
toneTestSaver *AudioFileSaver
ToneTest bool
ToneTestOutput string
toneTestStop chan struct{}
toneTestSaver *AudioFileSaver
toneTestSaverDetach gumble.Detacher
// Added for recording
RecordingMutex sync.Mutex
@@ -98,6 +99,17 @@ func (b *Barnard) cleanupConnectionAudio() {
b.FileStreamMutex.Unlock()
}
func (b *Barnard) cleanupToneTestAudio() {
if b.toneTestSaverDetach != nil {
b.toneTestSaverDetach.Detach()
b.toneTestSaverDetach = nil
}
if b.toneTestSaver != nil {
b.toneTestSaver.Stop()
b.toneTestSaver = nil
}
}
func (b *Barnard) StopTransmission() {
if b.Tx {
b.Notify("micdown", "me", "")