You are here

Add new comment

Sure,

jackCallbackProcess_out is the callback function.
( jack_set_process_callback(client_out, jackCallbackProcess_out, 0); )

The callback function transfers the new data ( process_out(nframes) )and signals to initiates a new audio update cycle.

int jackCallbackProcess_out(jack_nframes_t nframes, void *arg)
{
int err, core;

if (transport_aware_out)
{
jack_position_t pos;
if (jack_transport_query(client_out, &pos) != JackTransportRolling)
{
process_silence_out(nframes);
return 0;
}
}

process_out(nframes);

// Triger update process
pthread_mutex_lock(&updateThreadMutex);
pthread_mutex_unlock(&updateThreadMutex);
// Signal update thread
pthread_cond_signal(&updateThreadCv);

return 0;
}

The update process thread measures the entrance time and calculates the elapsed time from the previous entrance time -> ~5800 microsec.

void* AUDMNG_updateThread(void *arg)
{
int lockCount = 0, voice, count;
int ID;
int core, utilization;
struct timeval startts, prvStartts;
struct timeval stopts;

while (updateThreadIsRunning)
{

pthread_mutex_lock(&updateThreadMutex);
pthread_cond_wait(&updateThreadCv, &updateThreadMutex);
pthread_mutex_unlock(&updateThreadMutex);

ModSynth::get_instance()->update_tasks(0);

prvStartts.tv_usec = startts.tv_usec;
gettimeofday(&startts, NULL);

fprintf(stderr, "Time from last block: %i Time from prev block end time [us]: %i\n", startts.tv_usec- prvStartts.tv_usec, startts.tv_usec - stopts.tv_usec);

.
.
.
gettimeofday(&stopts, NULL);

}

return NULL;
}

Thanks,

Nahum.