feat: cw decoder

This commit is contained in:
2026-06-19 17:31:10 +02:00
parent 45d081ac0c
commit 079d0c32df
8 changed files with 571 additions and 2 deletions
+17
View File
@@ -0,0 +1,17 @@
package audio
// SampleRate is the fixed capture rate (mono 16-bit PCM). Exported so consumers
// like the CW decoder can configure their DSP to match.
const SampleRate = sampleRate
// StreamCapture captures from deviceID and calls onSamples with mono 16-bit PCM
// frames (as int16) until stop closes. A thin wrapper over the internal capture
// loop for live consumers (the CW decoder) that want samples, not raw bytes.
func StreamCapture(deviceID string, stop <-chan struct{}, onSamples func([]int16)) error {
return captureStream(deviceID, stop, func(chunk []byte) {
if len(chunk) == 0 {
return
}
onSamples(bytesToInt16(chunk))
})
}