> It's realtime safe as long as you know that those system calls pass
> control to the thread you want them to pass control to and not some
> other random thread that has nothing to do with JACK.
Ok, but how does JACK keep the OS from executing a completely different process as the next job?
Also, as you say, by using e.g., malloc(), the realtime app indeed passes the control to the kernel thread, which has to do a lot with JACK (it does exactly what the rt app need to get process). So why is calling malloc() not realtime then?
Many thanks for the help.
Hello,
it is often being said that JACK 2 is real time safe, for example in the JACK faq. I wondered how JACK 2 suspends a thread, so I checked what happens after the JackClient finished CallProcessCallback():
JackClient::CallProcessCallback()
-> JackClient::CycleWaitAux()
-> JackClient::WaitSync()
-> JackGraphManager::SuspendRefNum()
-> JackConnectionManager::SuspendRefNum()
-> virtual JackSynchro::TimedWait()
However, I found only two classes in the `posix' folder that implement this virtual function:
* JackPosixSemaphore: uses `sem_timedwait()' to block
* JackFifo: uses `read()' to block
However, both `sem_timedwait()' and `read()' are syscalls, so they contain context switch, which means they are non realtime. Actually, the JACK documentation warns to use function like these if you pass a process() callback to jack [1].
So how can JACK claim it would be realtime? (No objections, I just don't understand it)
Best,
Johannes
[1] http://jackaudio.org/files/docs/html/group__ClientCallbacks.html#gafb5ec9fb…
Hi Len,
i am using ubuntu studio.
the pc i refer to is used for audio processing and routing primarily - it
is a jack client server.
so without any user intervention apart from powering it ON , it gets audio
through ethernet from the jack master, processes it and sends it out
through its local soundcards.
on occasions I want to log on and use this computer for local audio
capturing and / or playback. so jack would ideally run independent of a
user session. Having said that, I usually don't need to log out and back
in, I tend to lock the system as I am a single user. no need to deal with
multiple user case now.
I use a locally compiled jack2 version without dbus support because I had a
version mismatch between windows and linux jack.
some audio applications (namely calf) need an X server so in my custom
startup scripts I start a vnc session as well.
The problem as I understand it is that after log on, pam.d elevates logged
in user's privileges to access hardware. The main problem is that
alsa_(in|out) is can not grab the local soundcards... and I do not know
what could be the conflict. people over at jack-devel mailing list said it
could bea number of things like pulseaudio or lightdm....
there seems to be a conflict or ideologies because some one suggests I
make a system init script and another says jack is not designed to run as a
system service.
Personally, I think that jack is indeed not designed as a system service,
but I could be wrong. what is more a jack run as root, would never be
available to applications that I would start as a user. is that so?
I think I replied to everything :)
On Sat, Apr 18, 2015 at 6:01 PM, Len Ovens <len(a)ovenwerks.net> wrote:
> On Sat, 18 Apr 2015, Athanasios Silis wrote:
>
> Hi Len,
>> unfortunately the .desktop file is not good for me.
>> it is only run after I have logged in, whereas I want my script to be
>> started as
>> me, but before I log in.
>> Is there a way to achieve that, without resorting to autologin ?
>>
>
> OK, perhaps a full description of what you are trying to acheive would
> help. little bits of info I think I have put together include:
> - You will be using a DE at some point.
> - You want to be able to access jack after logging in as well as before
> - jack is still to be used only by one user
> - jack2 is prefered?
> - what would jack be doing while logged out I don't know
> - should jack continue to run after logout?
> (that is do you normally logout and in)
> - Is most of the running done by script anyway and loggin in is used
> mostly for other things besides audio? Can all audio stuff be done by
> command line?
> - will jack be used as a device for pulseaudio...
> - will pulse run at all? if so will it ever touch the same device as jack
> has?
> - is your machine using sysv init, systemd, upstart? (upstart is going
> away BTW, leaving one to wonder about the future of MIR)
>
> As Jeremy has already suggested have you tried:
>
> export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/dbus/system_bus_socket
> jack_control start
>
> in the script run by your su user?
>
> --
> Len Ovens
> www.ovenwerks.net
>
>
> _______________________________________________
> Linux-audio-user mailing list
> Linux-audio-user(a)lists.linuxaudio.org
> http://lists.linuxaudio.org/listinfo/linux-audio-user
>
Hi Len,
unfortunately the .desktop file is not good for me.
it is only run after I have logged in, whereas I want my script to be
started as me, but before I log in.
Is there a way to achieve that, without resorting to autologin ?
On Fri, Apr 17, 2015 at 4:10 PM, Len Ovens <len(a)ovenwerks.net> wrote:
> On Fri, 17 Apr 2015, Athanasios Silis wrote:
>
> Hi all,
>> I am trying to run jackd instance from /etc/rc.local (along with a few
>> other
>> applications) from a custom made init script.
>>
>> The system is ubuntustudio and I have setup everything to have elevated
>> permissions when executing applications from the @audio group.
>>
>
> Are you really wanting to run audio while you are logged out? It would be
> much easier to add a desktop file to ~/.config/autostart/ Like
> jackstart.desktop with something like:
>
> [Desktop Entry]
> Encoding=UTF-8
> Version=0.9.4
> Type=Application
> Name=AutoJack
> Comment=Jackdbus starter
> Exec=jack_control start
> StartupNotify=false
> Terminal=false
> Hidden=false
>
>
> Change the Exec to point to a script if you want to add config options, or
> use jackd instead of jack_control if you don't care about PA-jack bridging.
>
> This will have jack runnning from login.
>
> If you want to headless operation then have rc.local do it as the user
> that will run this stuff.
>
> --
> Len Ovens
> www.ovenwerks.net
>
>
hi all, continuing from a previous email where I try to start up several
audio applications from a custom init script , which is run from rc.local,
I noticed that I get several
Capture open error: Device or resource busy
error messages for the alsa_(in|out) instances I set up:
alsa_out -d hw:DSP24,0 -c 10 -j dsp_out -r 48000 -p128 -n2 &
alsa_in -d hw:DSP24,0 -c 12 -j dsp_in -r 48000 -p128 -n2 &
alsa_out -d hw:Intel -c 8 -j hda_out -r 48000 -p128 -n3 &
alsa_in -d hw:Intel -c 2 -j hda_in -r 48000 -p128 -n3 &
These work when I use the script manually by logging in the pc.
but from rc.local the seems to be a problem with alsa.
on some reboots, perhaps one (random) of these will work , but usually non
of the 4 will be loaded correctly.
what could be conflicting here?
Hi all,
I am trying to run jackd instance from /etc/rc.local (along with a few
other applications) from a custom made init script.
The system is ubuntustudio and I have setup everything to have elevated
permissions when executing applications from the @audio group.
so when I am logged on, I see this:
nass@starkill:~$ ulimit -r -l
real-time priority (-r) 95
max locked memory (kbytes, -l) unlimited
which is expected and I can execute the script I wrote.
but, when I execute my script from /etc/rc.local as
su - nass -c "ulimits -r -l cd audio_setup/scripts ; bash ./start_audio"
then my user does not (yet?) have elevated permissions.
real-time priority (-r) 0
max locked memory (kbytes, -l) 64
is there a script I can run before my start_audio script to elevate my
permissions?
thank you
Hello,
Sorry about that. My mistake.
--
Due to administrative overhead, messages sent by non-members to
jack-devel will be discarded. Please join the mailing list and then
resend your message.
Jack on Raspberry PI 2.eml
Subject:
Jack on Raspberry PI 2
From:
Ron <rlpatton(a)aol.com>
Date:
4/16/2015 10:47
To:
jack-devel(a)lists.jackaudio.org
Hello,
I have downloaded, built and installed the latest version of Jack on a
Raspberry PI 2 running Raspbian (Linux 3.18.11-v7+ #777 SMP PREEMPT).
ron@squireoaksfarm-radio ~/src/quick2wire-python-api $ jackd --version
jackdmp 1.9.11
Copyright 2001-2005 Paul Davis and others.
Copyright 2004-2014 Grame.
jackdmp comes with ABSOLUTELY NO WARRANTY
This is free software, and you are welcome to redistribute it
under certain conditions; see the file COPYING for details
jackdmp version 1.9.11 tmpdir /dev/shm protocol 8
I have been all over the internet trying to find a solution to the
following error that prevents the jack server from starting (using
qjackctl):
10:31:31.869 Patchbay deactivated.
10:31:31.882 Statistics reset.
10:31:31.931 ALSA connection change.
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
10:31:31.961 ALSA connection graph change.
10:31:35.651 JACK is starting...
10:31:35.653 /usr/local/bin/jackd -dalsa -dhw:0 -r48000 -p1024 -n2
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
10:31:35.682 JACK was started with PID=9484.
jackdmp 1.9.11
Copyright 2001-2005 Paul Davis and others.
Copyright 2004-2014 Grame.
jackdmp comes with ABSOLUTELY NO WARRANTY
This is free software, and you are welcome to redistribute it
under certain conditions; see the file COPYING for details
JACK server starting in realtime mode with priority 10
Cannot lock down 82278944 byte memory area (Cannot allocate memory)
10:31:36.022 JACK was stopped successfully.
10:31:36.028 JACK has crashed.
10:31:37.778 Could not connect to JACK server as client. - Overall
operation failed. - Unable to connect to serve
r. Please check the messages window for more info.
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
I have tried to start the sever with the "--no-mlock" option.
Here are the contents of audio.conf
ron@squireoaksfarm-radio /etc/security/limits.d $ more audio.conf
# Provided by the jackd package.
#
# Changes to this file will be preserved.
#
# If you want to enable/disable realtime permissions, run
#
# dpkg-reconfigure -p high jackd
@audio - rtprio 95
@audio - memlock unlimited
#@audio - nice -19
The user "ron" is a member of the audio group.
Please help,
Ron
73
Ron / W4MMP
Hi Fons,
After our discussion in LAC I did two things :
- remove some log messages
- allow to better control thread priority definition, basically following the model used on Linux (server_priority = N, client_priority = N-5 so that the client may use threads with a priority between client RT value and server RT value) (see : http://comments.gmane.org/gmane.comp.audio.jackit/17931). On Windows it works like the following:
- using the -P number below 89 make all RT thread takes THREAD_PRIORITY_TIME_CRITICAL priority
- using value more than 89 moves in the MMCSS ("Pro Audio") class where 4 values can be used (AVRT_PRIORITY_LOW, AVRT_PRIORITY_NORMAL, AVRT_PRIORITY_HIGH, AVRT_PRIORITY_CRITICAL)
- client priority is 3 below server priority: so if 92 is used for the server, then JACK server RT thread will actually takes AVRT_PRIORITY_CRITICAL and client thread will use AVRT_PRIORITY_CRITICAL - 3 = AVRT_PRIORITY_LOW
- then the client my possibly use a value between AVRT_PRIORITY_LOW and AVRT_PRIORITY_CRITICAL for some other threads.
Tell me it if works the way you need to, and if not, how we can improve the implementation.
Links for the binaries here:
https://dl.dropboxusercontent.com/u/28869550/Jack_v1.9.11_32_setup.exehttps://dl.dropboxusercontent.com/u/28869550/Jack_v1.9.11_64_setup.exe
Thanks.
Stéphane
> Do you want to synchronize JACK clients so they do something in the same
> cycle / at the same sample time?
Yes, I think so.
> You could inject an event to JACK that's being distributed to the clients
> (inside JACK). The clients would then receive the events in the same cycle
> and can process (at given sample pos) in that cycle.
This sounds very good. However, I am not sure what you mean in terms of code. Can you please provide some example code?
> > Nonetheless, if I have 40 instances of zyn, I'd
> > like to (actually must) compute them concurrently. So how to do this with
> > one client?
>
> By using your own internal graph mechanism that has parallel capabilities.
> See, for excample, https://github.com/flowprogramming/dspatch
This one is based on pthread_cond_wait(), which is either implemented as a spinlock or not realtime safe (I guess the second). So how can this help?
> > The best way I can see is using an array of jack clients, and hoping
> > they'll process() at the same time. However, this sounds very tricky...
>
> There can be very good reasons for using JACK 1. If a user is doing that,
> you won't get any parallelization at all.
Does JACK 2 allow to use multiple jack clients that call process() at the same time? Or does it allow to enter process() with multiple threads? There seems to be no documentation/tutorial about JACK 2.