diff --git a/ChangeLog b/ChangeLog index bf0582e7..85b22f04 100644 --- a/ChangeLog +++ b/ChangeLog @@ -15,7 +15,12 @@ Tim Blechmann --------------------------- Jackdmp changes log ---------------------------- +--------------------------- + +2008-01-29 Stephane Letz + + * Implement jack_recompute_total_latency and jack_recompute_total_latencies. + * Remove fBufferSize field in JackGraphManager object. 2008-01-28 Stephane Letz diff --git a/common/JackAPI.cpp b/common/JackAPI.cpp index 264ec2de..79126e87 100644 --- a/common/JackAPI.cpp +++ b/common/JackAPI.cpp @@ -426,7 +426,7 @@ EXPORT void jack_port_set_latency(jack_port_t* port, jack_nframes_t frames) } } -EXPORT int jack_recompute_total_latencies(jack_client_t* ext_client, jack_port_t* port) +EXPORT int jack_recompute_total_latency(jack_client_t* ext_client, jack_port_t* port) { #ifdef __CLIENTDEBUG__ JackLibGlobals::CheckContext(); @@ -441,11 +441,9 @@ EXPORT int jack_recompute_total_latencies(jack_client_t* ext_client, jack_port_t jack_error("jack_recompute_total_latencies called with a NULL port"); return -1; } else { - // TODO + WaitGraphChange(); + return GetGraphManager()->ComputeTotalLatency(myport); } - - // The latency computation is done each time jack_port_get_total_latency is called - return 0; } EXPORT int jack_recompute_total_latencies(jack_client_t* ext_client) @@ -459,11 +457,9 @@ EXPORT int jack_recompute_total_latencies(jack_client_t* ext_client) jack_error("jack_recompute_total_latencies called with a NULL client"); return -1; } else { - // TODO + WaitGraphChange(); + return GetGraphManager()->ComputeTotalLatencies(); } - - // The latency computation is done each time jack_port_get_total_latency is called - return 0; } EXPORT int jack_port_set_name(jack_port_t* port, const char* name) @@ -927,9 +923,8 @@ EXPORT jack_nframes_t jack_port_get_total_latency(jack_client_t* ext_client, jac jack_error("jack_port_get_total_latency called with an incorrect port %ld", myport); return 0; } else { - // The latency computation is done each time - WaitGraphChange(); - return GetGraphManager()->GetTotalLatency(myport); + WaitGraphChange(); + return GetGraphManager()->GetPort(myport)->GetTotalLatency(); } } diff --git a/common/JackAudioDriver.cpp b/common/JackAudioDriver.cpp index f3f81541..6b0012d2 100644 --- a/common/JackAudioDriver.cpp +++ b/common/JackAudioDriver.cpp @@ -94,7 +94,7 @@ int JackAudioDriver::Attach() for (i = 0; i < fCaptureChannels; i++) { snprintf(buf, sizeof(buf) - 1, "%s:%s:out%d", fClientControl->fName, fCaptureDriverName, i + 1); - if ((port_index = fGraphManager->AllocatePort(fClientControl->fRefNum, buf, JACK_DEFAULT_AUDIO_TYPE, (JackPortFlags)port_flags)) == NO_PORT) { + if ((port_index = fGraphManager->AllocatePort(fClientControl->fRefNum, buf, JACK_DEFAULT_AUDIO_TYPE, (JackPortFlags)port_flags, fEngineControl->fBufferSize)) == NO_PORT) { jack_error("driver: cannot register port for %s", buf); return -1; } @@ -109,7 +109,7 @@ int JackAudioDriver::Attach() for (i = 0; i < fPlaybackChannels; i++) { snprintf(buf, sizeof(buf) - 1, "%s:%s:in%d", fClientControl->fName, fPlaybackDriverName, i + 1); - if ((port_index = fGraphManager->AllocatePort(fClientControl->fRefNum, buf, JACK_DEFAULT_AUDIO_TYPE, (JackPortFlags)port_flags)) == NO_PORT) { + if ((port_index = fGraphManager->AllocatePort(fClientControl->fRefNum, buf, JACK_DEFAULT_AUDIO_TYPE, (JackPortFlags)port_flags, fEngineControl->fBufferSize)) == NO_PORT) { jack_error("driver: cannot register port for %s", buf); return -1; } @@ -123,7 +123,7 @@ int JackAudioDriver::Attach() if (fWithMonitorPorts) { JackLog("Create monitor port \n"); snprintf(buf, sizeof(buf) - 1, "%s:%s:monitor_%u", fClientControl->fName, fPlaybackDriverName, i + 1); - if ((port_index = fGraphManager->AllocatePort(fClientControl->fRefNum, buf, JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput)) == NO_PORT) { + if ((port_index = fGraphManager->AllocatePort(fClientControl->fRefNum, buf, JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, fEngineControl->fBufferSize)) == NO_PORT) { jack_error("Cannot register monitor port for %s", buf); return -1; } else { diff --git a/common/JackEngine.cpp b/common/JackEngine.cpp index 7474b3de..c674c132 100644 --- a/common/JackEngine.cpp +++ b/common/JackEngine.cpp @@ -628,7 +628,7 @@ int JackEngine::PortRegister(int refnum, const char* name, const char *type, uns JackLog("JackEngine::PortRegister ref = %ld name = %s type = %s flags = %d buffer_size = %d\n", refnum, name, type, flags, buffer_size); assert(fClientTable[refnum]); - *port_index = fGraphManager->AllocatePort(refnum, name, type, (JackPortFlags)flags); + *port_index = fGraphManager->AllocatePort(refnum, name, type, (JackPortFlags)flags, fEngineControl->fBufferSize); if (*port_index != NO_PORT) { NotifyPortRegistation(*port_index, true); return 0; diff --git a/common/JackGraphManager.cpp b/common/JackGraphManager.cpp index 0bdd4dca..994619c3 100644 --- a/common/JackGraphManager.cpp +++ b/common/JackGraphManager.cpp @@ -217,8 +217,8 @@ int JackGraphManager::RequestMonitor(jack_port_id_t port_index, bool onoff) // C return 0; } -// Server -jack_nframes_t JackGraphManager::GetTotalLatencyAux(jack_port_id_t port_index, jack_port_id_t src_port_index, JackConnectionManager* manager, int hop_count) +// Client +jack_nframes_t JackGraphManager::ComputeTotalLatencyAux(jack_port_id_t port_index, jack_port_id_t src_port_index, JackConnectionManager* manager, int hop_count) { const jack_int_t* connections = manager->GetConnections(port_index); jack_nframes_t latency = GetPort(port_index)->GetLatency(); @@ -227,37 +227,49 @@ jack_nframes_t JackGraphManager::GetTotalLatencyAux(jack_port_id_t port_index, j if (hop_count > 8) return latency; - + for (int i = 0; (i < CONNECTION_NUM) && ((dst_index = connections[i]) != EMPTY); i++) { if (src_port_index != dst_index) { - AssertPort(dst_index); + AssertPort(dst_index); JackPort* dst_port = GetPort(dst_index); jack_nframes_t this_latency = (dst_port->fFlags & JackPortIsTerminal) ? dst_port->GetLatency() - : GetTotalLatencyAux(dst_index, port_index, manager, hop_count + 1); + : ComputeTotalLatencyAux(dst_index, port_index, manager, hop_count + 1); max_latency = MAX(max_latency, this_latency); } } - + return max_latency + latency; } -// Server -jack_nframes_t JackGraphManager::GetTotalLatency(jack_port_id_t port_index) +// Client +int JackGraphManager::ComputeTotalLatency(jack_port_id_t port_index) { UInt16 cur_index; UInt16 next_index; - jack_nframes_t total_latency; + JackPort* port = GetPort(port_index); AssertPort(port_index); - JackLog("JackGraphManager::GetTotalLatency port_index = %ld\n", port_index); - + do { cur_index = GetCurrentIndex(); - total_latency = GetTotalLatencyAux(port_index, port_index, ReadCurrentState(), 0); + port->fTotalLatency = ComputeTotalLatencyAux(port_index, port_index, ReadCurrentState(), 0); next_index = GetCurrentIndex(); } while (cur_index != next_index); // Until a coherent state has been read + + JackLog("JackGraphManager::GetTotalLatency port_index = %ld total latency = %ld\n", port_index, port->fTotalLatency); + return 0; +} - return total_latency; +// Client +int JackGraphManager::ComputeTotalLatencies() +{ + jack_port_id_t port_index; + for (port_index = FIRST_AVAILABLE_PORT; port_index < PORT_NUM; port_index++) { + JackPort* port = GetPort(port_index); + if (port->IsUsed()) + ComputeTotalLatency(port_index); + } + return 0; } // Server @@ -265,14 +277,12 @@ void JackGraphManager::SetBufferSize(jack_nframes_t buffer_size) { JackLock lock(this); JackLog("JackGraphManager::SetBufferSize size = %ld\n", (long int)buffer_size); - jack_port_id_t port_index; - - fBufferSize = buffer_size; - + + jack_port_id_t port_index; for (port_index = FIRST_AVAILABLE_PORT; port_index < PORT_NUM; port_index++) { JackPort* port = GetPort(port_index); if (port->IsUsed()) - port->ClearBuffer(fBufferSize); + port->ClearBuffer(buffer_size); } } @@ -296,18 +306,16 @@ jack_port_id_t JackGraphManager::AllocatePortAux(int refnum, const char* port_na } // Server -jack_port_id_t JackGraphManager::AllocatePort(int refnum, const char* port_name, const char* port_type, JackPortFlags flags) +jack_port_id_t JackGraphManager::AllocatePort(int refnum, const char* port_name, const char* port_type, JackPortFlags flags, jack_nframes_t buffer_size) { JackLock lock(this); JackConnectionManager* manager = WriteNextStateStart(); jack_port_id_t port_index = AllocatePortAux(refnum, port_name, port_type, flags); - assert(fBufferSize != 0); - if (port_index != NO_PORT) { JackPort* port = GetPort(port_index); assert(port); - port->ClearBuffer(fBufferSize); + port->ClearBuffer(buffer_size); int res; if (flags & JackPortIsOutput) { diff --git a/common/JackGraphManager.h b/common/JackGraphManager.h index 2c217c1c..2e00fcf2 100644 --- a/common/JackGraphManager.h +++ b/common/JackGraphManager.h @@ -42,18 +42,17 @@ class JackGraphManager : public JackShmMem, public JackAtomicStatefName, i + 1); - if ((port_index = fGraphManager->AllocatePort(fClientControl->fRefNum, buf, JACK_DEFAULT_AUDIO_TYPE, (JackPortFlags)port_flags)) == NO_PORT) { + if ((port_index = fGraphManager->AllocatePort(fClientControl->fRefNum, buf, JACK_DEFAULT_AUDIO_TYPE, (JackPortFlags)port_flags, fEngineControl->fBufferSize)) == NO_PORT) { jack_error("driver: cannot register port for %s", buf); return -1; } @@ -2135,7 +2135,7 @@ int JackAlsaDriver::Attach() for (int i = 0; i < fPlaybackChannels; i++) { snprintf(buf, sizeof(buf) - 1, "%s:playback_%u", fClientControl->fName, i + 1); - if ((port_index = fGraphManager->AllocatePort(fClientControl->fRefNum, buf, JACK_DEFAULT_AUDIO_TYPE, (JackPortFlags)port_flags)) == NO_PORT) { + if ((port_index = fGraphManager->AllocatePort(fClientControl->fRefNum, buf, JACK_DEFAULT_AUDIO_TYPE, (JackPortFlags)port_flags, fEngineControl->fBufferSize)) == NO_PORT) { jack_error("driver: cannot register port for %s", buf); return -1; } @@ -2149,7 +2149,7 @@ int JackAlsaDriver::Attach() if (fWithMonitorPorts) { JackLog("Create monitor port \n"); snprintf(buf, sizeof(buf) - 1, "%s:monitor_%lu",fClientControl->fName, i + 1); - if ((port_index = fGraphManager->AllocatePort(fClientControl->fRefNum, buf, JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput)) == NO_PORT) { + if ((port_index = fGraphManager->AllocatePort(fClientControl->fRefNum, buf, JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, fEngineControl->fBufferSize)) == NO_PORT) { jack_error ("ALSA: cannot register monitor port for %s", buf); } else { port = fGraphManager->GetPort(port_index); @@ -2356,7 +2356,7 @@ int JackAlsaDriver::create_thread(pthread_t *thread, int priority, int realtime, int JackAlsaDriver::port_register(const char *port_name, const char *port_type, unsigned long flags, unsigned long buf_size) { - return fGraphManager->AllocatePort(fClientControl->fRefNum, port_name, port_type, (JackPortFlags) flags); + return fGraphManager->AllocatePort(fClientControl->fRefNum, port_name, port_type, (JackPortFlags) flags, fEngineControl->fBufferSize); } int JackAlsaDriver::port_unregister(int port) diff --git a/linux/firewire/JackFFADODriver.cpp b/linux/firewire/JackFFADODriver.cpp index 564431b2..f72b6003 100644 --- a/linux/firewire/JackFFADODriver.cpp +++ b/linux/firewire/JackFFADODriver.cpp @@ -746,7 +746,8 @@ int JackFFADODriver::Attach() if ((port_index = fGraphManager->AllocatePort(fClientControl->fRefNum, buf, JACK_DEFAULT_AUDIO_TYPE, - (JackPortFlags)port_flags)) == NO_PORT) { + (JackPortFlags)port_flags, + fEngineControl->fBufferSize)) == NO_PORT) { jack_error("driver: cannot register port for %s", buf); return -1; } @@ -779,7 +780,8 @@ int JackFFADODriver::Attach() printMessage ("Registering playback port %s", buf); if ((port_index = fGraphManager->AllocatePort(fClientControl->fRefNum, buf, JACK_DEFAULT_AUDIO_TYPE, - (JackPortFlags)port_flags)) == NO_PORT) { + (JackPortFlags)port_flags, + fEngineControl->fBufferSize)) == NO_PORT) { jack_error("driver: cannot register port for %s", buf); return -1; } diff --git a/linux/freebob/JackFreebobDriver.cpp b/linux/freebob/JackFreebobDriver.cpp index 902b11f0..b934c706 100644 --- a/linux/freebob/JackFreebobDriver.cpp +++ b/linux/freebob/JackFreebobDriver.cpp @@ -735,7 +735,8 @@ int JackFreebobDriver::Attach() if ((port_index = fGraphManager->AllocatePort(fClientControl->fRefNum, buf, JACK_DEFAULT_AUDIO_TYPE, - (JackPortFlags)port_flags)) == NO_PORT) { + (JackPortFlags)port_flags, + fEngineControl->fBufferSize)) == NO_PORT) { jack_error("driver: cannot register port for %s", buf); return -1; } @@ -764,7 +765,8 @@ int JackFreebobDriver::Attach() printMessage ("Registering playback port %s", buf); if ((port_index = fGraphManager->AllocatePort(fClientControl->fRefNum, buf, JACK_DEFAULT_AUDIO_TYPE, - (JackPortFlags)port_flags)) == NO_PORT) { + (JackPortFlags)port_flags, + fEngineControl->fBufferSize)) == NO_PORT) { jack_error("driver: cannot register port for %s", buf); return -1; } diff --git a/macosx/JackCoreAudioDriver.cpp b/macosx/JackCoreAudioDriver.cpp index 930e2a97..3f2ddc38 100644 --- a/macosx/JackCoreAudioDriver.cpp +++ b/macosx/JackCoreAudioDriver.cpp @@ -960,7 +960,7 @@ int JackCoreAudioDriver::Attach() snprintf(buf, sizeof(buf) - 1, "%s:%s:out%u", fClientControl->fName, fCaptureDriverName, i + 1); } - if ((port_index = fGraphManager->AllocatePort(fClientControl->fRefNum, buf, JACK_DEFAULT_AUDIO_TYPE, (JackPortFlags)port_flags)) == NO_PORT) { + if ((port_index = fGraphManager->AllocatePort(fClientControl->fRefNum, buf, JACK_DEFAULT_AUDIO_TYPE, (JackPortFlags)port_flags, fEngineControl->fBufferSize)) == NO_PORT) { jack_error("Cannot register port for %s", buf); return -1; } @@ -978,6 +978,7 @@ int JackCoreAudioDriver::Attach() port = fGraphManager->GetPort(port_index); port->Rename("system:capture_%d", i + 1); port->SetLatency(fEngineControl->fBufferSize + value1 + value2 + fCaptureLatency); + JackLog("Latency = %ld \n", port->GetLatency()); fCapturePortList[i] = port_index; } @@ -997,7 +998,7 @@ int JackCoreAudioDriver::Attach() snprintf(buf, sizeof(buf) - 1, "%s:%s:in%u", fClientControl->fName, fPlaybackDriverName, i + 1); } - if ((port_index = fGraphManager->AllocatePort(fClientControl->fRefNum, buf, JACK_DEFAULT_AUDIO_TYPE, (JackPortFlags)port_flags)) == NO_PORT) { + if ((port_index = fGraphManager->AllocatePort(fClientControl->fRefNum, buf, JACK_DEFAULT_AUDIO_TYPE, (JackPortFlags)port_flags, fEngineControl->fBufferSize)) == NO_PORT) { jack_error("Cannot register port for %s", buf); return -1; } @@ -1015,13 +1016,14 @@ int JackCoreAudioDriver::Attach() port = fGraphManager->GetPort(port_index); port->Rename("system:playback_%d", i + 1); port->SetLatency(fEngineControl->fBufferSize + value1 + value2 + fPlaybackLatency); + JackLog("Latency = %ld \n", port->GetLatency()); fPlaybackPortList[i] = port_index; // Monitor ports if (fWithMonitorPorts) { JackLog("Create monitor port \n"); snprintf(buf, sizeof(buf) - 1, "%s:%s:monitor_%u", fClientControl->fName, fPlaybackDriverName, i + 1); - if ((port_index = fGraphManager->AllocatePort(fClientControl->fRefNum, buf, JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput)) == NO_PORT) { + if ((port_index = fGraphManager->AllocatePort(fClientControl->fRefNum, buf, JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, fEngineControl->fBufferSize)) == NO_PORT) { jack_error("Cannot register monitor port for %s", buf); return -1; } else { diff --git a/tests/jack_test.cpp b/tests/jack_test.cpp index c169f31a..ded1552f 100644 --- a/tests/jack_test.cpp +++ b/tests/jack_test.cpp @@ -104,7 +104,8 @@ jack_position_t request_pos; int silent_error = 0; // jack silent mode int verbose_mode = 0; int transport_mode = 1; -int ext_latency = 0; // test latency for PHY devices +jack_nframes_t input_ext_latency = 0; // test latency for PHY devices +jack_nframes_t output_ext_latency = 0; // test latency for PHY devices int sync_called = 0; int starting_state = 1; @@ -1509,8 +1510,9 @@ int main (int argc, char *argv[]) inports = jack_get_ports(client1, NULL, NULL, JackPortIsPhysical | JackPortIsInput); outports = jack_get_ports(client1, NULL, NULL, JackPortIsPhysical | JackPortIsOutput); if (inports[0] != NULL) { - ext_latency = jack_port_get_latency (jack_port_by_name(client1, inports[0])); - if (ext_latency != jack_port_get_total_latency(client1, jack_port_by_name(client1, inports[0]))) { + output_ext_latency = jack_port_get_latency (jack_port_by_name(client1, inports[0])); // from client to out driver (which has "inputs" ports..) + input_ext_latency = jack_port_get_latency (jack_port_by_name(client1, outports[0])); // from in driver (which has "output" ports..) to client + if (output_ext_latency != jack_port_get_total_latency(client1, jack_port_by_name(client1, inports[0]))) { t_error = 1; printf("!!! ERROR !!! get_latency & get_all_latency for a PHY device (unconnected) didn't return the same value !\n"); } @@ -1524,24 +1526,24 @@ int main (int argc, char *argv[]) if ((jack_port_get_latency (output_port1) != 0) || (jack_port_get_total_latency(client1, output_port1) != 0) || - (jack_port_get_latency (jack_port_by_name(client1, inports[0])) != (ext_latency)) || - (jack_port_get_total_latency(client1, jack_port_by_name(client1, inports[0])) != (ext_latency + 256)) || - (jack_port_get_total_latency(client1, output_port2) != (ext_latency + 256)) || + (jack_port_get_latency (jack_port_by_name(client1, inports[0])) != (output_ext_latency)) || + (jack_port_get_total_latency(client1, jack_port_by_name(client1, inports[0])) != (output_ext_latency + 256)) || + (jack_port_get_total_latency(client1, output_port2) != (output_ext_latency + 256)) || (jack_port_get_total_latency(client1, input_port2) != 0) || - (jack_port_get_total_latency(client1, input_port1) != ext_latency) || - (jack_port_get_latency (jack_port_by_name(client1, outports[0])) != ext_latency) || - (jack_port_get_total_latency(client1, jack_port_by_name(client1, outports[0])) != ext_latency) + (jack_port_get_total_latency(client1, input_port1) != input_ext_latency) || + (jack_port_get_latency (jack_port_by_name(client1, outports[0])) != input_ext_latency) || + (jack_port_get_total_latency(client1, jack_port_by_name(client1, outports[0])) != input_ext_latency) ) { printf("!!! WARNING !!! get_latency functions may have a problem : bad value returned !\n"); - printf("!!! get_latency(output_port1) : %i (must be 0)\n", jack_port_get_latency (output_port1) ); + printf("!!! get_latency(output_port1) : %i (must be 0)\n", jack_port_get_latency(output_port1)); printf("!!! get_total_latency(output_port1) : %i (must be 0)\n", jack_port_get_total_latency(client1, output_port1)); - printf("!!! get_latency(PHY[0]) : %i (must be external latency : %i)\n", jack_port_get_latency(jack_port_by_name(client1, inports[0])), ext_latency); - printf("!!! get_total_latency(PHY[0]) : %i (must be %i)\n", jack_port_get_total_latency(client1, jack_port_by_name(client1, inports[0])) , (ext_latency + 256)); - printf("!!! get_total_latency(output_port2) : %i (must be %i)\n", jack_port_get_total_latency(client1, output_port2), (ext_latency + 256)); + printf("!!! get_latency(PHY[0]) : %i (must be external latency : %i)\n", jack_port_get_latency(jack_port_by_name(client1, inports[0])), output_ext_latency); + printf("!!! get_total_latency(PHY[0]) : %i (must be %i)\n", jack_port_get_total_latency(client1, jack_port_by_name(client1, inports[0])) , (output_ext_latency + 256)); + printf("!!! get_total_latency(output_port2) : %i (must be %i)\n", jack_port_get_total_latency(client1, output_port2), (output_ext_latency + 256)); printf("!!! get_total_latency(input_port2) : %i (must be 0)\n", jack_port_get_total_latency(client1, input_port2)); - printf("!!! get_total_latency(input_port1) : %i (must be %i)\n", jack_port_get_total_latency(client1, input_port1), ext_latency); - printf("!!! get_latency(PHY[0]) : %i (must be %i)\n", jack_port_get_latency(jack_port_by_name(client1, outports[0])), ext_latency); - printf("!!! get_total_latency(PHY[0]) : %i (must be %i)\n", jack_port_get_total_latency(client1, jack_port_by_name(client1, outports[0])), ext_latency); + printf("!!! get_total_latency(input_port1) : %i (must be %i)\n", jack_port_get_total_latency(client1, input_port1), input_ext_latency); + printf("!!! get_latency(PHY[0]) : %i (must be %i)\n", jack_port_get_latency(jack_port_by_name(client1, outports[0])), input_ext_latency); + printf("!!! get_total_latency(PHY[0]) : %i (must be %i)\n", jack_port_get_total_latency(client1, jack_port_by_name(client1, outports[0])), input_ext_latency); } else { Log("get_latency & get_total_latency seems quite ok...\n"); @@ -1556,18 +1558,24 @@ int main (int argc, char *argv[]) jack_connect(client2, outports[0], jack_port_name(input_port2)); jack_connect(client2, jack_port_name(output_port1), inports[0]); jack_connect(client2, jack_port_name(output_port2), inports[0]); - jack_port_set_latency (output_port1, 256); - jack_port_set_latency (output_port2, 512); + jack_port_set_latency(output_port1, 256); + jack_port_set_latency(output_port2, 512); jack_recompute_total_latencies(client1); - if ((jack_port_get_latency (output_port1) != 256 ) || - (jack_port_get_total_latency(client1, output_port1) != (256 + ext_latency)) || - (jack_port_get_latency (output_port2) != 512) || - (jack_port_get_total_latency(client1, output_port2) != (512 + ext_latency)) || - (jack_port_get_latency (jack_port_by_name(client1, inports[0])) != ext_latency) || - (jack_port_get_total_latency(client1, jack_port_by_name(client1, inports[0])) != (512 + ext_latency)) + if ((jack_port_get_latency(output_port1) != 256 ) || + (jack_port_get_total_latency(client1, output_port1) != (256 + output_ext_latency)) || + (jack_port_get_latency(output_port2) != 512) || + (jack_port_get_total_latency(client1, output_port2) != (512 + output_ext_latency)) || + (jack_port_get_latency(jack_port_by_name(client1, inports[0])) != output_ext_latency) || + (jack_port_get_total_latency(client1, jack_port_by_name(client1, inports[0])) != (512 + output_ext_latency)) ) { printf("!!! WARNING !!! get_latency functions may have a problem : bad value returned !\n"); + printf("!!! get_latency(output_port1) : %i (must be 256)\n", jack_port_get_latency(output_port1)); + printf("!!! get_total_latency(output_port1) : %i (must be 256 + output_ext_latency)\n", jack_port_get_total_latency(client1, output_port1)); + printf("!!! get_latency(output_port2) : %i (must 512)\n", jack_port_get_latency(output_port2)); + printf("!!! get_total_latency(output_port2) : %i (must 512 + output_ext_latency)\n", jack_port_get_total_latency(client1, output_port2)); + printf("!!! get_latency(inports[0])) : %i (must output_ext_latency)\n", jack_port_get_latency(jack_port_by_name(client1, inports[0]))); + printf("!!! get_total_latency(inports[0]) : %i (must 512 + output_ext_latency)\n", jack_port_get_total_latency(client1, jack_port_by_name(client1, inports[0]))); } else { Log("get_latency & get_total_latency seems quite ok...\n"); }