Audio Processing Framework (APF) version 0.5.0
|
C++ wrapper for a JACK client. More...
#include <apf/jackclient.h>
Classes | |
struct | jack_error |
exception to be thrown at various occasions. More... | |
Public Types | |
enum | callback_usage_t { dont_use_jack_process_callback = 0 , use_jack_process_callback } |
Select if JACK's audio callback function shall be called. More... | |
typedef jack_default_audio_sample_t | sample_t |
typedef jack_nframes_t | nframes_t |
typedef jack_port_t | port_t |
Public Member Functions | |
JackClient (const std::string &name="JackClient", callback_usage_t callback_usage=dont_use_jack_process_callback) | |
Constructor. More... | |
bool | activate () const |
Activate JACK client. More... | |
bool | deactivate () const |
Deactivate JACK client. More... | |
manage JACK ports | |
port_t * | register_in_port (const std::string &name) const |
Register JACK input port. More... | |
port_t * | register_out_port (const std::string &name) const |
Register JACK output port. More... | |
port_t * | register_port (const std::string &name, unsigned long flags) const |
Register JACK port (input or output). More... | |
bool | unregister_port (port_t *port) const |
Unregister JACK port. More... | |
bool | connect_ports (const std::string &source, const std::string &destination) const |
Connect two JACK ports. More... | |
bool | disconnect_ports (const std::string &source, const std::string &destination) const |
Disconnect two JACK ports. More... | |
bool | connect_pending_connections () const |
Make connections which are still pending from a previous call to connect_ports(). More... | |
manage JACK transport | |
void | transport_start () const |
Start JACK transport. More... | |
void | transport_stop () const |
Stop JACK transport. More... | |
bool | transport_locate (nframes_t frame) const |
Set JACK transport location. More... | |
std::pair< bool, nframes_t > | get_transport_state () const |
Get JACK transport state. More... | |
bool | set_freewheel (int onoff) const |
Set JACK freewheeling mode. More... | |
std::string | client_name () const |
nframes_t | sample_rate () const |
nframes_t | buffer_size () const |
bool | is_realtime () const |
Start JACK transport. More... | |
int | get_real_time_priority () const |
Start JACK transport. More... | |
float | get_cpu_load () const |
Start JACK transport. More... | |
jack_native_thread_t | client_thread_id () const |
Start JACK transport. More... | |
callback functions | |
can be overwritten in derived classes | |
virtual int | jack_process_callback (nframes_t nframes) |
JACK process callback function. More... | |
virtual int | jack_sync_callback (jack_transport_state_t state, jack_position_t *pos) |
JACK sync callback function. More... | |
virtual void | jack_shutdown_callback () |
JACK shutdown callback. More... | |
virtual int | jack_sample_rate_callback (nframes_t sr) |
JACK sample rate callback. More... | |
virtual int | jack_buffer_size_callback (nframes_t bs) |
JACK buffer size callback. More... | |
virtual int | jack_xrun_callback () |
JACK xrun callback. More... | |
C++ wrapper for a JACK client.
Definition at line 67 of file jackclient.h.
typedef jack_default_audio_sample_t apf::JackClient::sample_t |
Definition at line 70 of file jackclient.h.
typedef jack_nframes_t apf::JackClient::nframes_t |
Definition at line 71 of file jackclient.h.
typedef jack_port_t apf::JackClient::port_t |
Definition at line 72 of file jackclient.h.
Select if JACK's audio callback function shall be called.
Enumerator | |
---|---|
dont_use_jack_process_callback | JACK audio callback is never called. |
use_jack_process_callback | JACK audio callback (jack_process_callback()) is called after activate() |
Definition at line 75 of file jackclient.h.
|
inlineexplicit |
Constructor.
name | client name of the JACK client to be created. |
callback_usage | if use_jack_process_callback , the member function jack_process_callback() is called by JACK in each audio cycle. |
name
should not include a colon. This doesn't cause an error directly, but it messes up the JACK client- and portnames. jack_error | if something goes wrong |
Definition at line 477 of file jackclient.h.
|
inlinevirtual |
Definition at line 113 of file jackclient.h.
|
inline |
Activate JACK client.
Definition at line 126 of file jackclient.h.
|
inline |
Deactivate JACK client.
Definition at line 141 of file jackclient.h.
|
inline |
Register JACK input port.
name | desired port name |
Definition at line 155 of file jackclient.h.
References register_port().
|
inline |
Register JACK output port.
name | desired port name |
Definition at line 164 of file jackclient.h.
References register_port().
|
inline |
Register JACK port (input or output).
name | desired port name |
flags | JACK port flags |
Definition at line 174 of file jackclient.h.
Referenced by register_in_port(), and register_out_port().
|
inline |
Unregister JACK port.
port | JACK port |
Definition at line 184 of file jackclient.h.
|
inline |
Connect two JACK ports.
source | source port name |
destination | destination port name |
Definition at line 201 of file jackclient.h.
|
inline |
Disconnect two JACK ports.
source | source port name |
destination | destination port name |
Definition at line 211 of file jackclient.h.
|
inline |
Make connections which are still pending from a previous call to connect_ports().
This is needed if connect_ports() has been called while the JackClient wasn't activated yet.
Definition at line 220 of file jackclient.h.
|
inline |
Start JACK transport.
Definition at line 246 of file jackclient.h.
|
inline |
Stop JACK transport.
Definition at line 252 of file jackclient.h.
|
inline |
Set JACK transport location.
frame | location |
Definition at line 261 of file jackclient.h.
|
inline |
Get JACK transport state.
Definition at line 269 of file jackclient.h.
|
inline |
Set JACK freewheeling mode.
onoff | non-zero: start; zero: stop |
Definition at line 288 of file jackclient.h.
|
inline |
Definition at line 294 of file jackclient.h.
|
inline |
Definition at line 296 of file jackclient.h.
|
inline |
Definition at line 298 of file jackclient.h.
|
inline |
Start JACK transport.
Definition at line 300 of file jackclient.h.
|
inline |
Start JACK transport.
Definition at line 305 of file jackclient.h.
|
inline |
Start JACK transport.
Definition at line 310 of file jackclient.h.
|
inline |
Start JACK transport.
Definition at line 315 of file jackclient.h.
|
inlineprotectedvirtual |
JACK process callback function.
This function is empty in the JackClient base class. Derived classes should overwrite it if needed.
nframes | Number of frames (~samples) in the current block. This value is delivered by the JACK server. |
jack_error | if not implemented |
Definition at line 338 of file jackclient.h.
|
inlineprotectedvirtual |
JACK sync callback function.
Definition at line 345 of file jackclient.h.
|
inlineprotectedvirtual |
JACK shutdown callback.
By default, this is throwing a jack_error exception. If you don't like this, you can overwrite this function in your derived class.
Definition at line 357 of file jackclient.h.
|
inlineprotectedvirtual |
JACK sample rate callback.
sr | new sample rate delivered by JACK |
jack_error | if not implemented |
Definition at line 366 of file jackclient.h.
|
inlineprotectedvirtual |
JACK buffer size callback.
jack_error | if not implemented |
Definition at line 375 of file jackclient.h.
|
inlineprotectedvirtual |
JACK xrun callback.
Definition at line 383 of file jackclient.h.