Re: [LAU] Toggle Jack Transport CLI

From: <holger@email-addr-hidden>
Date: Mon Dec 19 2016 - 12:52:57 EET

19. Dezember 2016 11:35 Uhr, hollundertee@gmx.net schrieb:
> On Wed, 16 Nov 2016 07:04:04 +0000
> holger@dehnhardt.org wrote:
>
>> Hi lista :)
>>
>> Using an i3 (https://i3wm.org/docs/userguide.html#exec)
>> shortcut, I can control my jack transport from everywhere, even when
>> no jack application has focus :
>>
>> bindsym $mod+p exec echo play | jack_transport
>> bindsym $mod+Shift+p exec echo stop | jack_transport
>>
>> Thanks to FalkTX for the pipe trick BTW, I saw that on
>> linuxmusicians ; This is very cool if you have some sort of wireless
>> keyboard, but as you can see it's two different keystrokes, how do I
>> make it so toggles play/pause? Alternatively, how do I know when
>> jack transport is rolling, so I can hack my way into making my own
>> toggle script? I did my homework and read the inline --help of all
>> the available jack commands on my machine : With this patch,
>> jack_transport should be able to toggle. I will suggest it to the
>> jack-develop list but would be happy if some else can test it. Holger
>>
>> -----------------
>>
>> diff --git a/example-clients/transport.c b/example-clients/transport.c
>> index c543b41..0b1130f 100644
>> --- a/example-clients/transport.c
>> +++ b/example-clients/transport.c
>> @@ -211,6 +211,29 @@ static void com_timeout(char *arg)
>> jack_set_sync_timeout(client, (jack_time_t) (timeout*1000000));
>> }
>> +/* Set sync timeout in seconds. */
>> +static void com_toggle(char *arg)
>> +{
>> + jack_position_t current;
>> + jack_transport_state_t transport_state;
>> +
>> + transport_state = jack_transport_query (client, ¤t);
>> +
>> + switch (transport_state) {
>> + case JackTransportStopped:
>> + com_play( arg );
>> + break;
>> + case JackTransportRolling:
>> + com_stop( arg );
>> + break;
>> + case JackTransportStarting:
>> + printf ("state: Starting - no transport toggling");
>> + break;
>> + default:
>> + printf ("state: Unknown - no transport toggling");
>> + }
>> +}
>> +
>> /* Command parsing based on GNU readline info examples. */
>> @@ -238,6 +261,7 @@ command_t commands[] = {
>> {"stop", com_stop, "Stop transport"},
>> {"tempo", com_tempo, "Set beat tempo "},
>> {"timeout", com_timeout, "Set sync timeout in "},
>> + {"toggle", com_toggle, "Toggle transport rolling"},
>> {"?", com_help, "Synonym for `help'" },
>> {(char *)NULL, (cmd_function_t *)NULL, (char *)NULL }
>> };
>
> Thanks guys,
>
> I was just browsing the list for nice Linux Audio music when I found
> this thread, which is just what I needed as well :)
> In my case the purpose is for screencasts.
> I plan to record the screen using SimpleScreenRecorder and audio
> through jack into Ardour or somesuch. The problem I had was that if I
> start SSR and Ardour separately I need to manually align A/V later. It
> is simpler if A/V starts at the same time.
>
> I was thinking of starting jack transport through qjackctl or somesuch,
> using the CLI did not occur to me.
>
> SSR lacks jack transport control, but I think assigning the same hotkey
> to SSR and jack transport should work just fine. I guess I still need
> to take the alsa/jacks latency into account, but at least that should
> be small and constant.
>
> Does anyone have a better idea?
>
> @Holger: Thanks, but patching a jack example client requires
> maintenance since this change would be lost with each new jack package
> coming through the repo.
>
> Regards,
> Philipp
>
> _______________________________________________
> Linux-audio-user mailing list
> Linux-audio-user@lists.linuxaudio.org
> http://lists.linuxaudio.org/listinfo/linux-audio-user

I know, I know...
that's why I wanted to send it to the Jack list to get it applied... I still did not do it sorry.
Will try to send it this evening...

Holger
_______________________________________________
Linux-audio-user mailing list
Linux-audio-user@lists.linuxaudio.org
http://lists.linuxaudio.org/listinfo/linux-audio-user
Received on Mon Dec 19 16:15:02 2016

This archive was generated by hypermail 2.1.8 : Mon Dec 19 2016 - 16:15:02 EET