Hi,

I have a mic on snd/1 and speakers on snd/0.  I had tried a lot of different
settings with audacity port but couldn't get this to work, so I chose the
method of last resort.  Below is a patch to allow an AUDIORECDEVICE environment
variable specifying the wanted microphone.

-peter


Index: sio.c
===================================================================
RCS file: /cvs/src/lib/libsndio/sio.c,v
retrieving revision 1.24
diff -u -p -u -r1.24 sio.c
--- sio.c       29 Jun 2019 06:05:26 -0000      1.24
+++ sio.c       17 Nov 2020 16:13:04 -0000
@@ -43,6 +43,7 @@ sio_open(const char *str, unsigned int m
 {
        static char devany[] = SIO_DEVANY;
        struct sio_hdl *hdl;
+       char *rec = NULL;
 
 #ifdef DEBUG
        _sndio_debug_init();
@@ -55,6 +56,12 @@ sio_open(const char *str, unsigned int m
                str = getenv("AUDIODEVICE");
                if (str == NULL)
                        str = devany;
+               rec = getenv("AUDIORECDEVICE");
+               if (rec == NULL)
+                       rec = devany;
+
+               if (rec && mode == SIO_REC)
+                       str = rec;
        }
        if (strcmp(str, devany) == 0) {
                hdl = _sio_aucat_open("snd/0", mode, nbio);
Index: sioctl.c
===================================================================
RCS file: /cvs/src/lib/libsndio/sioctl.c,v
retrieving revision 1.1
diff -u -p -u -r1.1 sioctl.c
--- sioctl.c    26 Feb 2020 13:53:58 -0000      1.1
+++ sioctl.c    17 Nov 2020 16:13:04 -0000
@@ -28,6 +28,7 @@ sioctl_open(const char *str, unsigned in
 {
        static char devany[] = SIO_DEVANY;
        struct sioctl_hdl *hdl;
+       char *rec = NULL;
 
 #ifdef DEBUG
        _sndio_debug_init();
@@ -38,6 +39,14 @@ sioctl_open(const char *str, unsigned in
                str = getenv("AUDIODEVICE");
                if (str == NULL)
                        str = devany;
+               
+               rec = getenv("AUDIORECDEVICE");
+               if (rec == NULL)
+                       rec = devany;
+               
+               if (rec && mode == SIO_REC)
+                       str = rec;
+       
        }
        if (strcmp(str, devany) == 0) {
                hdl = _sioctl_aucat_open("snd/0", mode, nbio);

Reply via email to