From b11d79242cb20944b41cfcb74e1859fc5dd6868d Mon Sep 17 00:00:00 2001 From: Tomi Hakala Date: Mon, 4 Mar 2024 20:14:10 +0200 Subject: [PATCH] Update branch filter in GitHub Actions workflow and add capture device listing --- .github/workflows/docker-build.yml | 2 +- internal/myaudio/capture.go | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index c4484239..69079c02 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -3,7 +3,7 @@ name: Deploy Image to GHCR on: push: branches: - - main + - dev workflow_dispatch: jobs: diff --git a/internal/myaudio/capture.go b/internal/myaudio/capture.go index 8cf66b79..40f2232d 100644 --- a/internal/myaudio/capture.go +++ b/internal/myaudio/capture.go @@ -35,6 +35,25 @@ func CaptureAudio(settings *conf.Settings, wg *sync.WaitGroup, quitChan chan str deviceConfig.SampleRate = conf.SampleRate deviceConfig.Alsa.NoMMap = 1 + var infos []malgo.DeviceInfo + + // Get list of capture devices + infos, err = malgoCtx.Devices(malgo.Capture) + if err != nil { + fmt.Println(err) + os.Exit(1) + } + + fmt.Println("Capture Devices") + for i, info := range infos { + e := "ok" + _, err := malgoCtx.DeviceInfo(malgo.Capture, info.ID, malgo.Shared) + if err != nil { + e = err.Error() + } + fmt.Printf(" %d: %s, [%s]\n", i, info.Name(), e) + } + // Write to ringbuffer when audio data is received // BufferMonitor() will poll this buffer and read data from it onReceiveFrames := func(pSample2, pSamples []byte, framecount uint32) {