All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] Autoconnect jack ports by default
       [not found] <20210224154901.23901-1-koalinux@gmail.com>
@ 2021-02-24 16:16 ` José Ramón Muñoz Pekkarinen
  2021-02-24 16:39   ` Christian Schoenebeck
  0 siblings, 1 reply; 5+ messages in thread
From: José Ramón Muñoz Pekkarinen @ 2021-02-24 16:16 UTC (permalink / raw)
  To: kraxel; +Cc: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 1604 bytes --]

    Hi,

    Adding qemu-devel.

    Best regards.

    José.

On Wed, 24 Feb 2021 at 17:49, José Pekkarinen <koalinux@gmail.com> wrote:

> This patch provides a default value to connect
> jack ports when the user don't specify connect-ports.
>
> Buglink: https://bugs.launchpad.net/qemu/+bug/1908832
>
> Signed-off-by: José Pekkarinen <koalinux@gmail.com>
> ---
>  audio/jackaudio.c | 15 ++++++++++++---
>  1 file changed, 12 insertions(+), 3 deletions(-)
>
> diff --git a/audio/jackaudio.c b/audio/jackaudio.c
> index 3031c4e29b..a29b1ccba2 100644
> --- a/audio/jackaudio.c
> +++ b/audio/jackaudio.c
> @@ -369,14 +369,23 @@ static size_t qjack_read(HWVoiceIn *hw, void *buf,
> size_t len)
>
>  static void qjack_client_connect_ports(QJackClient *c)
>  {
> -    if (!c->connect_ports || !c->opt->connect_ports) {
> +    if (!c->connect_ports) {
>          return;
>      }
>
>      c->connect_ports = false;
>      const char **ports;
> -    ports = jack_get_ports(c->client, c->opt->connect_ports, NULL,
> -        c->out ? JackPortIsInput : JackPortIsOutput);
> +    if (c->out) {
> +        ports = jack_get_ports(c->client,
> +            c->opt->connect_ports ? "system:capture_.*"
> +                : c->opt->connect_ports,
> +            NULL, JackPortIsInput);
> +    } else {
> +        ports = jack_get_ports(c->client,
> +            c->opt->connect_ports ? "system:playback_.*"
> +                : c->opt->connect_ports,
> +            NULL, JackPortIsOutput);
> +    }
>
>      if (!ports) {
>          return;
> --
> 2.26.2
>
>

[-- Attachment #2: Type: text/html, Size: 2406 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Autoconnect jack ports by default
  2021-02-24 16:16 ` [PATCH] Autoconnect jack ports by default José Ramón Muñoz Pekkarinen
@ 2021-02-24 16:39   ` Christian Schoenebeck
  2021-02-24 16:47     ` José Ramón Muñoz Pekkarinen
  0 siblings, 1 reply; 5+ messages in thread
From: Christian Schoenebeck @ 2021-02-24 16:39 UTC (permalink / raw)
  To: qemu-devel
  Cc: José Ramón Muñoz Pekkarinen, kraxel, Geoffrey McRae

On Mittwoch, 24. Februar 2021 17:16:58 CET José Ramón Muñoz Pekkarinen wrote:
> On Wed, 24 Feb 2021 at 17:49, José Pekkarinen <koalinux@gmail.com> wrote:
> > This patch provides a default value to connect
> > jack ports when the user don't specify connect-ports.
> > 
> > Buglink: https://bugs.launchpad.net/qemu/+bug/1908832
> > 
> > Signed-off-by: José Pekkarinen <koalinux@gmail.com>
> > ---
> > 
> >  audio/jackaudio.c | 15 ++++++++++++---
> >  1 file changed, 12 insertions(+), 3 deletions(-)
> > 
> > diff --git a/audio/jackaudio.c b/audio/jackaudio.c
> > index 3031c4e29b..a29b1ccba2 100644
> > --- a/audio/jackaudio.c
> > +++ b/audio/jackaudio.c
> > @@ -369,14 +369,23 @@ static size_t qjack_read(HWVoiceIn *hw, void *buf,
> > size_t len)
> > 
> >  static void qjack_client_connect_ports(QJackClient *c)
> >  {
> > 
> > -    if (!c->connect_ports || !c->opt->connect_ports) {
> > +    if (!c->connect_ports) {
> > 
> >          return;
> >      
> >      }
> >      
> >      c->connect_ports = false;
> >      const char **ports;
> > 
> > -    ports = jack_get_ports(c->client, c->opt->connect_ports, NULL,
> > -        c->out ? JackPortIsInput : JackPortIsOutput);
> > +    if (c->out) {
> > +        ports = jack_get_ports(c->client,
> > +            c->opt->connect_ports ? "system:capture_.*"
> > +                : c->opt->connect_ports,

I think that should be the other way around:

	c->opt->connect_ports ? c->opt->connect_ports : "system:capture_.*"

> > +            NULL, JackPortIsInput);
> > +    } else {
> > +        ports = jack_get_ports(c->client,
> > +            c->opt->connect_ports ? "system:playback_.*"
> > +                : c->opt->connect_ports,

Same here:

	c->opt->connect_ports ? c->opt->connect_ports : "system:playback_.*"

right?

> > +            NULL, JackPortIsOutput);
> > +    }
> > 
> >      if (!ports) {
> >      
> >          return;
> > 
> > --
> > 2.26.2

Best regards
Christian Schoenebeck




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Autoconnect jack ports by default
  2021-02-24 16:39   ` Christian Schoenebeck
@ 2021-02-24 16:47     ` José Ramón Muñoz Pekkarinen
  2021-02-24 17:29       ` Christian Schoenebeck
  0 siblings, 1 reply; 5+ messages in thread
From: José Ramón Muñoz Pekkarinen @ 2021-02-24 16:47 UTC (permalink / raw)
  To: Christian Schoenebeck; +Cc: Geoffrey McRae, qemu-devel, kraxel

[-- Attachment #1: Type: text/plain, Size: 1887 bytes --]

On Wed, 24 Feb 2021 at 18:40, Christian Schoenebeck <qemu_oss@crudebyte.com>
wrote:

> On Mittwoch, 24. Februar 2021 17:16:58 CET José Ramón Muñoz Pekkarinen
> wrote:
> > On Wed, 24 Feb 2021 at 17:49, José Pekkarinen <koalinux@gmail.com>
> wrote:
> > > This patch provides a default value to connect
> > > jack ports when the user don't specify connect-ports.
> > >
> > > Buglink: https://bugs.launchpad.net/qemu/+bug/1908832
> > >
> > > Signed-off-by: José Pekkarinen <koalinux@gmail.com>
> > > ---
> > >
> > >  audio/jackaudio.c | 15 ++++++++++++---
> > >  1 file changed, 12 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/audio/jackaudio.c b/audio/jackaudio.c
> > > index 3031c4e29b..a29b1ccba2 100644
> > > --- a/audio/jackaudio.c
> > > +++ b/audio/jackaudio.c
> > > @@ -369,14 +369,23 @@ static size_t qjack_read(HWVoiceIn *hw, void
> *buf,
> > > size_t len)
> > >
> > >  static void qjack_client_connect_ports(QJackClient *c)
> > >  {
> > >
> > > -    if (!c->connect_ports || !c->opt->connect_ports) {
> > > +    if (!c->connect_ports) {
> > >
> > >          return;
> > >
> > >      }
> > >
> > >      c->connect_ports = false;
> > >      const char **ports;
> > >
> > > -    ports = jack_get_ports(c->client, c->opt->connect_ports, NULL,
> > > -        c->out ? JackPortIsInput : JackPortIsOutput);
> > > +    if (c->out) {
> > > +        ports = jack_get_ports(c->client,
> > > +            c->opt->connect_ports ? "system:capture_.*"
> > > +                : c->opt->connect_ports,
>
> I think that should be the other way around:
>
>         c->opt->connect_ports ? c->opt->connect_ports : "system:capture_.*"
>

    I was thinking exactly the same when I was reading
the patch, but in the way you hint it doesn't make it, so
somewhere we may be taking the logic inverted.

    Best regards.

    José.

[-- Attachment #2: Type: text/html, Size: 2961 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Autoconnect jack ports by default
  2021-02-24 16:47     ` José Ramón Muñoz Pekkarinen
@ 2021-02-24 17:29       ` Christian Schoenebeck
  2021-02-24 19:12         ` José Ramón Muñoz Pekkarinen
  0 siblings, 1 reply; 5+ messages in thread
From: Christian Schoenebeck @ 2021-02-24 17:29 UTC (permalink / raw)
  To: qemu-devel
  Cc: José Ramón Muñoz Pekkarinen, Geoffrey McRae, kraxel

On Mittwoch, 24. Februar 2021 17:47:03 CET José Ramón Muñoz Pekkarinen wrote:
> On Wed, 24 Feb 2021 at 18:40, Christian Schoenebeck <qemu_oss@crudebyte.com>
> wrote:
> > On Mittwoch, 24. Februar 2021 17:16:58 CET José Ramón Muñoz Pekkarinen
> > 
> > wrote:
> > > On Wed, 24 Feb 2021 at 17:49, José Pekkarinen <koalinux@gmail.com>
> > 
> > wrote:
> > > > This patch provides a default value to connect
> > > > jack ports when the user don't specify connect-ports.
> > > > 
> > > > Buglink: https://bugs.launchpad.net/qemu/+bug/1908832
> > > > 
> > > > Signed-off-by: José Pekkarinen <koalinux@gmail.com>
> > > > ---
> > > > 
> > > >  audio/jackaudio.c | 15 ++++++++++++---
> > > >  1 file changed, 12 insertions(+), 3 deletions(-)
> > > > 
> > > > diff --git a/audio/jackaudio.c b/audio/jackaudio.c
> > > > index 3031c4e29b..a29b1ccba2 100644
> > > > --- a/audio/jackaudio.c
> > > > +++ b/audio/jackaudio.c
> > > > @@ -369,14 +369,23 @@ static size_t qjack_read(HWVoiceIn *hw, void
> > 
> > *buf,
> > 
> > > > size_t len)
> > > > 
> > > >  static void qjack_client_connect_ports(QJackClient *c)
> > > >  {
> > > > 
> > > > -    if (!c->connect_ports || !c->opt->connect_ports) {
> > > > +    if (!c->connect_ports) {
> > > > 
> > > >          return;
> > > >      
> > > >      }
> > > >      
> > > >      c->connect_ports = false;
> > > >      const char **ports;
> > > > 
> > > > -    ports = jack_get_ports(c->client, c->opt->connect_ports, NULL,
> > > > -        c->out ? JackPortIsInput : JackPortIsOutput);
> > > > +    if (c->out) {
> > > > +        ports = jack_get_ports(c->client,
> > > > +            c->opt->connect_ports ? "system:capture_.*"
> > > > +                : c->opt->connect_ports,
> > 
> > I think that should be the other way around:
> >         c->opt->connect_ports ? c->opt->connect_ports :
> >         "system:capture_.*"
> 
>     I was thinking exactly the same when I was reading
> the patch, but in the way you hint it doesn't make it, so
> somewhere we may be taking the logic inverted.

I guess that's because the RegEx patterns are interchanged as well. Try:

if (c->out) {
	...
	c->opt->connect_ports ? c->opt->connect_ports : "system:playback_.*"
	...
} else {
	...
	c->opt->connect_ports ? c->opt->connect_ports : "system:capture_.*"
	...
}

Best regards,
Christian Schoenebeck




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Autoconnect jack ports by default
  2021-02-24 17:29       ` Christian Schoenebeck
@ 2021-02-24 19:12         ` José Ramón Muñoz Pekkarinen
  0 siblings, 0 replies; 5+ messages in thread
From: José Ramón Muñoz Pekkarinen @ 2021-02-24 19:12 UTC (permalink / raw)
  To: Christian Schoenebeck; +Cc: Geoffrey McRae, qemu-devel, kraxel

[-- Attachment #1: Type: text/plain, Size: 2708 bytes --]

On Wed, 24 Feb 2021 at 19:29, Christian Schoenebeck <qemu_oss@crudebyte.com>
wrote:

> On Mittwoch, 24. Februar 2021 17:47:03 CET José Ramón Muñoz Pekkarinen
> wrote:
> > On Wed, 24 Feb 2021 at 18:40, Christian Schoenebeck <
> qemu_oss@crudebyte.com>
> > wrote:
> > > On Mittwoch, 24. Februar 2021 17:16:58 CET José Ramón Muñoz Pekkarinen
> > >
> > > wrote:
> > > > On Wed, 24 Feb 2021 at 17:49, José Pekkarinen <koalinux@gmail.com>
> > >
> > > wrote:
> > > > > This patch provides a default value to connect
> > > > > jack ports when the user don't specify connect-ports.
> > > > >
> > > > > Buglink: https://bugs.launchpad.net/qemu/+bug/1908832
> > > > >
> > > > > Signed-off-by: José Pekkarinen <koalinux@gmail.com>
> > > > > ---
> > > > >
> > > > >  audio/jackaudio.c | 15 ++++++++++++---
> > > > >  1 file changed, 12 insertions(+), 3 deletions(-)
> > > > >
> > > > > diff --git a/audio/jackaudio.c b/audio/jackaudio.c
> > > > > index 3031c4e29b..a29b1ccba2 100644
> > > > > --- a/audio/jackaudio.c
> > > > > +++ b/audio/jackaudio.c
> > > > > @@ -369,14 +369,23 @@ static size_t qjack_read(HWVoiceIn *hw, void
> > >
> > > *buf,
> > >
> > > > > size_t len)
> > > > >
> > > > >  static void qjack_client_connect_ports(QJackClient *c)
> > > > >  {
> > > > >
> > > > > -    if (!c->connect_ports || !c->opt->connect_ports) {
> > > > > +    if (!c->connect_ports) {
> > > > >
> > > > >          return;
> > > > >
> > > > >      }
> > > > >
> > > > >      c->connect_ports = false;
> > > > >      const char **ports;
> > > > >
> > > > > -    ports = jack_get_ports(c->client, c->opt->connect_ports, NULL,
> > > > > -        c->out ? JackPortIsInput : JackPortIsOutput);
> > > > > +    if (c->out) {
> > > > > +        ports = jack_get_ports(c->client,
> > > > > +            c->opt->connect_ports ? "system:capture_.*"
> > > > > +                : c->opt->connect_ports,
> > >
> > > I think that should be the other way around:
> > >         c->opt->connect_ports ? c->opt->connect_ports :
> > >         "system:capture_.*"
> >
> >     I was thinking exactly the same when I was reading
> > the patch, but in the way you hint it doesn't make it, so
> > somewhere we may be taking the logic inverted.
>
> I guess that's because the RegEx patterns are interchanged as well. Try:
>
> if (c->out) {
>         ...
>         c->opt->connect_ports ? c->opt->connect_ports :
> "system:playback_.*"
>         ...
> } else {
>         ...
>         c->opt->connect_ports ? c->opt->connect_ports : "system:capture_.*"
>         ...
> }
>

    Very right here, I'll be resending the patch soon,
thanks for the revision!

    José.

[-- Attachment #2: Type: text/html, Size: 4278 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-02-24 19:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20210224154901.23901-1-koalinux@gmail.com>
2021-02-24 16:16 ` [PATCH] Autoconnect jack ports by default José Ramón Muñoz Pekkarinen
2021-02-24 16:39   ` Christian Schoenebeck
2021-02-24 16:47     ` José Ramón Muñoz Pekkarinen
2021-02-24 17:29       ` Christian Schoenebeck
2021-02-24 19:12         ` José Ramón Muñoz Pekkarinen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.