Pause playback while transmitting and declare microphone use.

macOS refuses capture without a usage string, and queued remote audio was still handed to the speaker after push-to-talk began.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Konrad Neitzel
2026-10-03 16:32:01 +02:00
co-authored by Cursor
parent 9c4f6621fc
commit 6233292931
9 changed files with 44 additions and 15 deletions
+7 -4
View File
@@ -163,12 +163,12 @@ func (s *Station) session(ctx context.Context, conn net.Conn) error {
case <-ctx.Done():
timer.Stop()
return ctx.Err()
case <-tcpErr:
case err := <-tcpErr:
timer.Stop()
return errors.New("tcp closed")
case <-udpFail:
return err
case err := <-udpFail:
timer.Stop()
return errors.New("udp closed")
return err
case tcpf = <-tcpCh:
timer.Stop()
reason = "tcp"
@@ -465,12 +465,14 @@ func (s *Station) endTransmit() {
copy(frame, s.mic)
s.mic = nil
if pkt, err := s.enc.Encode(frame); err == nil {
// A lost datagram ends the session when the receive timer expires.
_ = s.sendUDP(udpAudio, appendBlob(nil, pkt))
}
} else {
s.mic = nil
}
if s.udp != nil {
// A lost datagram ends the session when the receive timer expires.
_ = s.sendUDP(udpFlush, nil)
}
}
@@ -511,6 +513,7 @@ func (s *Station) publish() {
s.state.Transmitting = tx
if tx {
s.state.Talker = s.cfg.callsign
s.play = nil
} else {
s.state.Talker = s.remoteTalker
}