To say I don't really know what I am doing is putting it mildly. I have created the UI for a widget so that the play stop and skip controls for jack transport can be in the panel of a plasma desktop. What I don't know is how to send the commands and to what to have them actually working (small detail, I know). I have actually spent a good bit of time on this because I had to learn all the qml stuff.
I created a gitlab page for it here https://gitlab.com/a7534/jacktransportwidget
If you want to install it, you download it and move the jacktransportwidget folder to ~/.local/share/plasma/plasmoids You might have to restart plasma. It doesn't do anything at the moment, though.
What I want it to do is, detect in the background when JACK is running and connect to it. There is an indicator button on the widget, which I want to light up when it's connected. The buttons are skip forward and back, play/pause and stop. I copied the buttons off Catia. My idea for this was to move those buttons on the panel because that would be convenient.
Those are my first goals. If I can get that working, I'll see if I can do other things for jack from the panel.
What I am looking for is any advice and/or information to help with how I go about getting this to work because I haven't had any joy finding information on this.
First project - KDE Widget for Jack Transport
Moderators: MattKingUSA, khz
- SpotlightKid
- Established Member
- Posts: 260
- Joined: Sun Jul 02, 2017 1:24 pm
- Has thanked: 57 times
- Been thanked: 61 times
Re: First project - KDE Widget for Jack Transport
Do you want to write the main program logic in C++ or Python? In latter case, check out jackclient-python.
This example shows how to connect to a running JACK server and query and manipulate the transport state:
https://github.com/spatialaudio/jackcli ... sporter.py
This example shows how to connect to a running JACK server and query and manipulate the transport state:
https://github.com/spatialaudio/jackcli ... sporter.py
- marbangens
- Established Member
- Posts: 56
- Joined: Fri Nov 16, 2018 8:39 pm
- Been thanked: 6 times
Re: First project - KDE Widget for Jack Transport
If you like to detect jack in the background with c++ you probably need to create a thread with the lowest priority and just check for something simple and fast and then sleep kind of loop. Its a bit advanced for fist project, but you learn the most when you just go into the fun stuff from the start
There is the docs
https://jackaudio.org/api/group__TransportControl.html
You may need to use those, test what you need to use and what works for you and you're code
Look at others code also, take things apart and test everything
There is the docs
https://jackaudio.org/api/group__TransportControl.html
You may need to use those, test what you need to use and what works for you and you're code
Code: Select all
jack_client_open()
// To change position, use jack_transport_reposition() and jack_transport_locate()
jack_transport_start()
jack_transport_stop()
- Largos
- Established Member
- Posts: 632
- Joined: Mon Oct 05, 2020 12:21 pm
- Has thanked: 71 times
- Been thanked: 185 times
Re: First project - KDE Widget for Jack Transport
A little update on my progress, I decided to go with Python as I found the documentation for the jack api good to understand. Documentation for plasmoids is not so good, so I am making a standalone python/qml app instead. It has all the plasma integration, so the icons will change with plasma theme change. It won't be on the panel but obviously can be set for always on top for a similar effect.
I managed to find a video which told me how to get the qml to talk to the python so I have a working play button. The other buttons should hopefully be fairly straight forward, I'll do some tweaks to the qml and that will hopefully be ready.
I am not doing the indicator and auto detect that I want to do with plasmoid, as I don't think that will need that function. I don't know how to do that yet anyway.
I also spent an hour earlier shouting at the screen because I forgot I needed to start it with python3 not python and I kept using the up arrow in terminal to constantly repeat my mistake.
I managed to find a video which told me how to get the qml to talk to the python so I have a working play button. The other buttons should hopefully be fairly straight forward, I'll do some tweaks to the qml and that will hopefully be ready.
I am not doing the indicator and auto detect that I want to do with plasmoid, as I don't think that will need that function. I don't know how to do that yet anyway.
I also spent an hour earlier shouting at the screen because I forgot I needed to start it with python3 not python and I kept using the up arrow in terminal to constantly repeat my mistake.
- Largos
- Established Member
- Posts: 632
- Joined: Mon Oct 05, 2020 12:21 pm
- Has thanked: 71 times
- Been thanked: 185 times
Re: First project - KDE Widget for Jack Transport
https://gitlab.com/Largos/jack-transport-for-plasma
That's the page for the stand alone application. It's usable now though has a few faults.
The stop button breaks the animation of the play/pause button and the play/pause button is not synced with other jack apps. Not figured out how to get the background to follow theming so it's a neutral gray. You can change the "color" field in the qml file to whatever you want easily though, even transparent..
That's the page for the stand alone application. It's usable now though has a few faults.
The stop button breaks the animation of the play/pause button and the play/pause button is not synced with other jack apps. Not figured out how to get the background to follow theming so it's a neutral gray. You can change the "color" field in the qml file to whatever you want easily though, even transparent..
- SpotlightKid
- Established Member
- Posts: 260
- Joined: Sun Jul 02, 2017 1:24 pm
- Has thanked: 57 times
- Been thanked: 61 times
Re: First project - KDE Widget for Jack Transport
Nice. You probably shouldn't create the jack client at the module level, but only if your main.py is actually run as the main script (i.e. after line 74f.).
You should probably use a QTimer to periodically poll `client.transport_state`.
- Largos
- Established Member
- Posts: 632
- Joined: Mon Oct 05, 2020 12:21 pm
- Has thanked: 71 times
- Been thanked: 185 times
Re: First project - KDE Widget for Jack Transport
Why would this be bad? There is only the one python script being used.SpotlightKid wrote: ↑Sun Feb 06, 2022 3:58 pmNice. You probably shouldn't create the jack client at the module level, but only if your main.py is actually run as the main script (i.e. after line 74f.).
Thanks, I will give this a try.You should probably use a QTimer to periodically poll `client.transport_state`.
- SpotlightKid
- Established Member
- Posts: 260
- Joined: Sun Jul 02, 2017 1:24 pm
- Has thanked: 57 times
- Been thanked: 61 times
Re: First project - KDE Widget for Jack Transport
It's just a suggestion as a matter of principle. As it is, it doesn't hurt. But should you ever want to import your main.py as a module* or maybe you'll refactor your code along the way and put the JACK connection establishment in another module, it shouldn't trigger the connection at import time.
* for example, when you package your project as a Python package and define a command line script entry point in setup.py / setup.cfg, it will need to import main.py.