Commit d3c96cf0 authored by sletz's avatar sletz
Browse files

Implement jack_recompute_total_latency and jack_recompute_total_latencies....

Implement jack_recompute_total_latency and jack_recompute_total_latencies. Remove fBufferSize field in JackGraphManager object.

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@1792 0c269be4-1314-0410-8aa9-9f06e86f4224
parent 6b812ab7
......@@ -15,7 +15,12 @@ Tim Blechmann
---------------------------
Jackdmp changes log
---------------------------
---------------------------
2008-01-29 Stephane Letz <letz@grame.fr>
* Implement jack_recompute_total_latency and jack_recompute_total_latencies.
* Remove fBufferSize field in JackGraphManager object.
2008-01-28 Stephane Letz <letz@grame.fr>
......
......@@ -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();
}
}
......
......@@ -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 {
......
......@@ -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;
......
......@@ -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) {
......
......@@ -42,18 +42,17 @@ class JackGraphManager : public JackShmMem, public JackAtomicState<JackConnectio
JackPort fPortArray[PORT_NUM];
JackClientTiming fClientTiming[CLIENT_NUM];
jack_nframes_t fBufferSize;
jack_port_id_t AllocatePortAux(int refnum, const char* port_name, const char* port_type, JackPortFlags flags);
void GetConnectionsAux(JackConnectionManager* manager, const char** res, jack_port_id_t port_index);
const char** GetPortsAux(const char* port_name_pattern, const char* type_name_pattern, unsigned long flags);
float* GetBuffer(jack_port_id_t port_index);
void* GetBufferAux(JackConnectionManager* manager, jack_port_id_t port_index, jack_nframes_t frames);
jack_nframes_t GetTotalLatencyAux(jack_port_id_t port_index, jack_port_id_t src_port_index, JackConnectionManager* manager, int hop_count);
jack_nframes_t ComputeTotalLatencyAux(jack_port_id_t port_index, jack_port_id_t src_port_index, JackConnectionManager* manager, int hop_count);
public:
JackGraphManager() : fBufferSize(0)
JackGraphManager()
{}
~JackGraphManager()
{}
......@@ -61,14 +60,15 @@ class JackGraphManager : public JackShmMem, public JackAtomicState<JackConnectio
void SetBufferSize(jack_nframes_t buffer_size);
// Ports management
jack_port_id_t AllocatePort(int refnum, const char* port_name, const char* port_type, JackPortFlags flags);
jack_port_id_t AllocatePort(int refnum, const char* port_name, const char* port_type, JackPortFlags flags, jack_nframes_t buffer_size);
int ReleasePort(int refnum, jack_port_id_t port_index);
void RemoveAllPorts(int refnum);
void DisconnectAllPorts(int refnum);
JackPort* GetPort(jack_port_id_t index);
jack_port_id_t GetPort(const char* name);
jack_nframes_t GetTotalLatency(jack_port_id_t port_index);
int ComputeTotalLatency(jack_port_id_t port_index);
int ComputeTotalLatencies();
int RequestMonitor(jack_port_id_t port_index, bool onoff);
// Connections management
......
......@@ -29,7 +29,7 @@ namespace Jack
{
JackPort::JackPort()
: fFlags(JackPortIsInput), fRefNum( -1), fLatency(0), fMonitorRequests(0), fInUse(false), fTied(NO_PORT)
: fFlags(JackPortIsInput), fRefNum( -1), fLatency(0), fTotalLatency(0), fMonitorRequests(0), fInUse(false), fTied(NO_PORT)
{}
JackPort::~JackPort()
......@@ -46,6 +46,7 @@ bool JackPort::Allocate(int refnum, const char* port_name, const char* port_type
strcpy(fName, port_name);
fInUse = true;
fLatency = 0;
fTotalLatency = 0;
fTied = NO_PORT;
// DB: At this point we do not know current buffer size in frames,
// but every time buffer will be returned to any user,
......@@ -63,6 +64,7 @@ void JackPort::Release()
fRefNum = -1;
fInUse = false;
fLatency = 0;
fTotalLatency = 0;
fTied = NO_PORT;
fAlias1[0] = '\0';
fAlias2[0] = '\0';
......@@ -88,6 +90,11 @@ jack_nframes_t JackPort::GetLatency() const
return fLatency;
}
jack_nframes_t JackPort::GetTotalLatency() const
{
return fTotalLatency;
}
void JackPort::SetLatency(jack_nframes_t nframes)
{
fLatency = nframes;
......
......@@ -49,6 +49,7 @@ class JackPort
int fRefNum;
jack_nframes_t fLatency;
jack_nframes_t fTotalLatency;
uint8_t fMonitorRequests;
bool fInUse;
......@@ -94,6 +95,7 @@ class JackPort
int UnTie();
jack_nframes_t GetLatency() const;
jack_nframes_t GetTotalLatency() const;
void SetLatency(jack_nframes_t latency);
int RequestMonitor(bool onoff);
......
......@@ -2120,7 +2120,7 @@ int JackAlsaDriver::Attach()
for (int i = 0; i < fCaptureChannels; i++) {
snprintf(buf, sizeof(buf) - 1, "%s:capture_%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;
}
......@@ -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)
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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 {
......
......@@ -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");
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment