#include <JackClient.h>
Public Member Functions | |
JackClient (QString name, int nChans, int nFrames) | |
~JackClient () | |
void | go () |
void | start () |
void | stop () |
Static Public Member Functions | |
static void | error () |
static void | error (const char *desc) |
static void | jack_shutdown (void *arg) |
static int | srate_callback (jack_nframes_t nframes, void *arg) |
Public Attributes | |
int | nChans |
Protected Attributes | |
jack_client_t * | client |
const char ** | ports |
Definition at line 16 of file JackClient.h.
|
Definition at line 70 of file JackClient.cpp. References client, error(), inBufPtr, inFrame, input_port, iPhase, jack_shutdown(), outBufPtr, outFrame, output_port, srate_callback(), xx_global_process_xx(), xx_nChans_xx, and xx_nFrames_xx. 00070 :Stk () 00071 { 00072 xx_nChans_xx = this->nChans = nChans; 00073 xx_nFrames_xx = nFrames; 00074 inFrame = new double[nChans]; 00075 outFrame = new double[nChans]; 00076 input_port = new jack_port_t *[nChans]; 00077 output_port = new jack_port_t *[nChans]; 00078 inBufPtr = new jack_default_audio_sample_t *[nChans]; 00079 outBufPtr = new jack_default_audio_sample_t *[nChans]; 00080 00081 iPhase = new double[nChans]; // sample frame of output channels 00082 for (int i = 0; i < nChans; i++) 00083 iPhase[i] = 0.0; 00084 00085 /* tell the JACK server to call error() whenever it 00086 * experiences an error. Notice that this callback is 00087 * global to this process, not specific to each client. 00088 * 00089 * This is set here so that it can catch errors in the 00090 * connection process 00091 */ 00092 jack_set_error_function (error); 00093 00094 /* try to become a client of the JACK server */ 00095 00096 if ((client = jack_client_new (name)) == 0) 00097 { 00098 printf ("jack server not running?\n"); 00099 // return 1; 00100 } 00101 00102 /* tell the JACK server to call `process()' whenever 00103 * there is work to be done. 00104 */ 00105 00106 jack_set_process_callback (client, xx_global_process_xx, 0); 00107 00108 /* tell the JACK server to call `srate()' whenever 00109 * the sample rate of the system changes. 00110 */ 00111 00112 00113 jack_set_sample_rate_callback (client, srate_callback, 0); 00114 00115 /* tell the JACK server to call `jack_shutdown()' if 00116 * it ever shuts down, either entirely, or if it 00117 * just decides to stop calling us. 00118 */ 00119 00120 jack_on_shutdown (client, jack_shutdown, 0); 00121 00122 /* display the current sample rate. once the client is activated 00123 * (see below), you should rely on your own sample rate 00124 * callback (see above) for this value. 00125 */ 00126 00127 printf ("engine sample rate: %u\n", jack_get_sample_rate (client)); 00128 00129 /* create two ports */ 00130 for (int i = 0; i < nChans; i++) 00131 { 00132 QString iName, oName; 00133 QTextOStream (&iName) << "input" << i; 00134 QTextOStream (&oName) << "output" << i; 00135 00136 input_port[i] = 00137 jack_port_register (client, iName, 00138 JACK_DEFAULT_AUDIO_TYPE, 00139 JackPortIsInput, 0); 00140 output_port[i] = 00141 jack_port_register (client, oName, 00142 JACK_DEFAULT_AUDIO_TYPE, 00143 JackPortIsOutput, 0); 00144 } 00145 }
Here is the call graph for this function: |
|
Definition at line 229 of file JackClient.cpp.
|
|
Definition at line 28 of file JackClient.h.
|
|
Definition at line 25 of file JackClient.h. Referenced by JackClient().
|
|
Definition at line 166 of file JackClient.cpp. References client, input_port, nChans, output_port, and ports. Referenced by start(). 00167 { /* tell the JACK server that we are ready to roll */ 00168 00169 // if (jack_activate (client)) 00170 // { 00171 // printf ("cannot activate client"); 00172 // return 1; 00173 // } 00174 00175 /* connect the ports. Note: you can't do this before 00176 * the client is activated, because we can't allow 00177 * connections to be made to clients that aren't 00178 * running. 00179 */ 00180 00181 00182 if ((ports = 00183 jack_get_ports (client, NULL, NULL, 00184 JackPortIsPhysical | JackPortIsOutput)) == NULL) 00185 { 00186 fprintf (stderr, "Cannot find any physical capture ports\n"); 00187 exit (1); 00188 } 00189 for (int i = 0; i < nChans; i++) 00190 { 00191 00192 if (jack_connect 00193 (client, ports[i], jack_port_name (input_port[i]))) 00194 { 00195 fprintf (stderr, "cannot connect input ports\n"); 00196 } 00197 } 00198 00199 free (ports); 00200 00201 if ((ports = 00202 jack_get_ports (client, NULL, NULL, 00203 JackPortIsPhysical | JackPortIsInput)) == NULL) 00204 { 00205 fprintf (stderr, "Cannot find any physical playback ports\n"); 00206 exit (1); 00207 } 00208 00209 for (int i = 0; i < nChans; i++) 00210 { 00211 if (jack_connect 00212 (client, jack_port_name (output_port[i]), ports[i])) 00213 { 00214 fprintf (stderr, "cannot connect output ports\n"); 00215 } 00216 00217 } 00218 // printf ("about to sleep\n"); 00219 free (ports); 00220 00221 /* Since this is just a toy, run for a few seconds, then finish */ 00222 00223 // sleep (10); 00224 // printf ("...awake\n"); 00225 // jack_client_close (client); 00226 // exit (0); 00227 }
|
|
Definition at line 33 of file JackClient.h. Referenced by JackClient().
|
|
Definition at line 38 of file JackClient.h. Referenced by JackClient().
|
|
Definition at line 155 of file JackClient.cpp. Referenced by MainDialog::startJack(). 00156 { /* tell the JACK server that we are ready to roll */ 00157 00158 if (jack_activate (client)) 00159 { 00160 printf ("cannot activate client"); 00161 // return 1; 00162 } 00163 go(); 00164 }
Here is the call graph for this function: |
|
Definition at line 149 of file JackClient.cpp. References client. Referenced by MainDialog::closeEvent(), and MainDialog::stopJack(). 00150 { 00151 jack_client_close (client); 00152 }
|
|
Definition at line 44 of file JackClient.h. Referenced by go(), JackClient(), start(), and stop(). |
|
Definition at line 24 of file JackClient.h. Referenced by go(). |
|
Definition at line 45 of file JackClient.h. Referenced by go(). |