On 09/30/10 22:41, Philipp Überbacher wrote:
Excerpts from Robin Gareus's message of 2010-09-30
16:21:27 +0200:
On 09/30/10 13:35, Louigi Verona wrote:
As for JACK support.... would anyone be
interested in adding it, if it is
trivial? Would love to have it in my audio chain.
At second glance: it's not going to be that easy. The built-in player
makes use of mutex-locks which would need to be replaced with a
[lock-free] ringbuffer (Adding JACK I/O is still trivial but without
lock-free buffers paulstrech would be able to block jack-processing and
cause x-runs).
That'd be a good job for someone who wants to get started with JACK and
C/C++ programming.
I'd be interested.
It would likely take me some time though, and maybe some guidance, but
it's something I want to learn. I dabbled in C but can only read simple
code. I start to study computer science next week, which will give me
access to the library at least, to K&R and a bunch of others.
The lectures at university are mostly in java but C is required at some
point, and I guess it's better to start learning it sooner rather than
later, besides, it seems to be needed for all the neat audio stuff ;)
So yeah, I guess I should get the code, put it in a git repo and just
start hacking...
Aww sorry. I saw this too late.
The film I intended to watch was too boring so..
git clone
git://rg42.org/paulstretch
cd paulstretch
./compile_linux_fftw_jack.sh
or get a diff:
http://rg42.org/gitweb/?p=paulstretch.git;a=commitdiff_plain;hp=upstream;h=…
There's still quite a few things to do. besides: it's a quick hack and
far from optimal:
- It currently only opens the JACK clients if it's playing.
(after stop the port-connections are lost)
- It auto-connects the jack-ports to the first two available outputs
(unless you remove the -DENABLE_AUTOCONNECT_JACK compile option)
- it does not do any resampling
(but prints a warning if the samplerates mismatch and plays anyway)
- it does not add a ringbuffer.
(it may cause x-runs)
So you can take this as inspiration :)
Using a jack_ringbuffer is actually not that hard, have a look at the
jack_capture.c example client (comes with the jackd source).
Resampling with libsamplerate is not very complicated, although I'm sure
you'll have to work out a few things if you do it the first time (it's a
good learning experience - google for "secret rabbit code".
OTOH I'm not convinced that the paulstrech player needs anyway. It may
be a nice add-on feature though.
Hint: for both ringbuffer and/or resampling you'll want to add a new
function to Player.cpp that basically does the same as
void Player::getaudiobuffer(int nsamples, float *out)
I suggest
getaudiobuffer_channel(int nsamples, int channel, float *out)
Contact Paul and Alan Calvin :)
Cheers!
robin