I can not answer all of your questions, but Harry may jump in and answer
On 02/22/2012 10:56 AM, email@example.com wrote:
Yes, kind of.
More precisely: you actually only ask JACK for a pointer.
"Where can I read the audio-data from" -> reply: an array starting at
this memory address. similar for write.
> If so then why callback func
> Why not
What's confusing you is that there is no dedicated 'read/write'. You
only ask: where to read from and where to write to.
Those pointers are valid during the whole process callback function.
You usually query them at the start of the process function.
The data that resides in the outputBuffer memory-area (float array) is
/written back/ at the end of each process callback.
(Actually, JACK uses a "zero-copy" approach which makes it rather fast
and efficient: JACK prepares a float array for your application to
write _output_ audio to. You ask where that float-array is and write
audio data to it. The next jack-client in the graph will be pointed to
exactly the same memory as _input_. -- although in reality the
implementation is a bit more complicated..)
> How can i detect (list) - all available ports:channels ?
the source of 'jack_lsp' is a good example:
> How to automatic connect my client i/o ports to jackd ?
Be very careful with that. Most applications should not do this, but let
the user connect ports: either manually or automatically using
studio/session patchbay tools.
In a studio: the playback1/2 outputs may correspond to a sub-woofer or
be connected to something where you don't want any JACK client to send
audio by default.. Speakers have been killed by auto-connecting JACK
That being said:
jack_connect(c, jack_port_name(src_port), jack_port_name(dst_port))
but disable it by default or ask the user if s/he wishes to auto-connect
> jack_lsp -t
> 32 bit float - does JACK work with other sample formats ?
theoretically yes, practically no.
You can change the data-format for the whole JACK system. It requires
recompiling jack and adapting all jack-clients. e.g. "video-jack" does
that it uses fixed-size RGB videoframes instead of "32bit float"
> mono - is it possible operate with interleaved stereo stream ?
> audio - what else as audio ?
JACK as we know it officially only supports audio and MIDI.
but in principle it can any data: control information, video,..
> What about stereo stream ?
> outputPort = jack_port_register ( client,
One usually uses a for loop and an array of ports:
> If so, then how to write data and sync both seperate(d) channels?
Neither with separate ports.
The First sample is outputPort is played at the same time as the
first sample in outputPort[N].
Some example code to de-interleave N-channel audio:
With JACK, two channel (stereo) audio is no different than forty-two
channel sound (or 5.1 or whatever).
One of the big features of jack is its simple interface. There's exactly
ONE format for audio: 32bit float mono channels. No interleaving, no
16/24 bit conversions, no overflow/clipping inside the JACK graph
(floats can go beyond -1.0 .. +1.0).
Clipping is done as last step before the audio goes back to the device.
Bit-dithering [if necessary and wanted] happens inside the server
back-end that interfaces with the audio-device.
Linux-audio-dev mailing list