Hi,
This is during the first run of the init/cleanup cycle:
root@bela ~$ cat /proc/xenomai/sched
CPU PID CLASS PRI TIMEOUT TIMEBASE STAT NAME
0 0 idle -1 - master R ROOT
0 6499 rt 95 17us master D bela-audio
root@bela ~$ cat /proc/xenomai/stat
CPU PID MSW CSW PF STAT %CPU NAME
0 0 0 1180400 0 00500080 98.7 ROOT
0 6499 2 60172 1 00300184 0.0 bela-audio
0 0 0 3499363 0 00000000 0.1 IRQ67: [timer]
Now I set it back up:
root@bela ~$ cat /proc/xenomai/sched
CPU PID CLASS PRI TIMEOUT TIMEBASE STAT NAME
0 0 idle -1 - master R ROOT
root@bela ~$ cat /proc/xenomai/stat
CPU PID MSW CSW PF STAT %CPU NAME
0 0 0 1734565 0 00500080 71.7 ROOT
0 0 0 4065005 0 00000000 1.3 IRQ67: [timer]
Which reflects what I see. Changing the RTAudio verbosity didn't seem to make much of a difference. Upping the Bela verbosity (in the Settings struct) doesn't show anything weird or different between the two init/cleanup cycles. However, the PRU::loop() printfs show the following:
setup()
audio inited
audio started: 0
entering PRU::loop while(!gShouldStop)
Using embedded PRU code
(... runs ...)
Enter new library name for RT loading > someLib2.so
Stopping audio...
exiting PRU::loop while(!gShouldStop)
cleanup()
-> Opened someLib2.so
numInputs: 0
numOutputs: 2
numParams: 8
Starting with period size 16; analog enabled
DAC level 0dB; ADC level -6dB; headphone level -6dB
Warning: couldn't export GPIO test pin
setup()
audio inited
audio started: 0
entering PRU::loop while(!gShouldStop)
exiting PRU::loop while(!gShouldStop)
Using embedded PRU code
So the PRU::loop while() is exiting immediately, and I can confirm that is because gShouldStop isn't being reset when calling Bela_initAudio()... I suppose I can set that manually in setup() as a workaround.