| @@ -96,17 +96,6 @@ namespace Jack | |||
| #endif | |||
| case 'l' : | |||
| fParams.fNetworkLatency = param->value.i; | |||
| /* | |||
| if (strcmp(param->value.str, "normal") == 0) { | |||
| fParams.fNetworkMode = 'n'; | |||
| } else if (strcmp(param->value.str, "slow") == 0) { | |||
| fParams.fNetworkMode = 's'; | |||
| } else if (strcmp(param->value.str, "fast") == 0) { | |||
| fParams.fNetworkMode = 'f'; | |||
| } else { | |||
| jack_error("Unknown network mode, using 'normal' mode."); | |||
| } | |||
| */ | |||
| break; | |||
| case 'q': | |||
| fQuality = param->value.ui; | |||
| @@ -185,20 +185,7 @@ namespace Jack | |||
| plot_name = string(fParams.fName); | |||
| plot_name += string("_slave"); | |||
| plot_name += (fEngineControl->fSyncMode) ? string("_sync") : string("_async"); | |||
| switch (fParams.fNetworkMode) | |||
| { | |||
| case 's' : | |||
| plot_name += string("_slow"); | |||
| break; | |||
| case 'n' : | |||
| plot_name += string("_normal"); | |||
| break; | |||
| case 'f' : | |||
| plot_name += string("_fast"); | |||
| break; | |||
| } | |||
| plot_name += string("_latency"); | |||
| fNetTimeMon = new JackGnuPlotMonitor<float>(128, 5, plot_name); | |||
| string net_time_mon_fields[] = | |||
| { | |||
| @@ -304,23 +291,8 @@ namespace Jack | |||
| } | |||
| port = fGraphManager->GetPort(port_index); | |||
| port->SetAlias(alias); | |||
| //port latency | |||
| range.min = range.max = (fParams.fNetworkLatency * fEngineControl->fBufferSize + (fEngineControl->fSyncMode) ? 0 : fEngineControl->fBufferSize); | |||
| /* | |||
| switch (fParams.fNetworkMode) | |||
| { | |||
| case 'f' : | |||
| range.min = range.max = (fEngineControl->fSyncMode) ? 0 : fEngineControl->fBufferSize; | |||
| break; | |||
| case 'n' : | |||
| range.min = range.max = (fEngineControl->fBufferSize + (fEngineControl->fSyncMode) ? 0 : fEngineControl->fBufferSize); | |||
| break; | |||
| case 's' : | |||
| range.min = range.max = (2 * fEngineControl->fBufferSize + (fEngineControl->fSyncMode) ? 0 : fEngineControl->fBufferSize); | |||
| break; | |||
| } | |||
| */ | |||
| port->SetLatencyRange(JackPlaybackLatency, &range); | |||
| fPlaybackPortList[audio_port_index] = port_index; | |||
| jack_log("JackNetDriver::AllocPorts() fPlaybackPortList[%d] audio_port_index = %ld fPortLatency = %ld", audio_port_index, port_index, port->GetLatency()); | |||
| @@ -359,20 +331,6 @@ namespace Jack | |||
| port = fGraphManager->GetPort(port_index); | |||
| //port latency | |||
| range.min = range.max = (fParams.fNetworkLatency * fEngineControl->fBufferSize + (fEngineControl->fSyncMode) ? 0 : fEngineControl->fBufferSize); | |||
| /* | |||
| switch (fParams.fNetworkMode) | |||
| { | |||
| case 'f' : | |||
| range.min = range.max = (fEngineControl->fSyncMode) ? 0 : fEngineControl->fBufferSize; | |||
| break; | |||
| case 'n' : | |||
| range.min = range.max = (fEngineControl->fBufferSize + (fEngineControl->fSyncMode) ? 0 : fEngineControl->fBufferSize); | |||
| break; | |||
| case 's' : | |||
| range.min = range.max = (2 * fEngineControl->fBufferSize + (fEngineControl->fSyncMode) ? 0 : fEngineControl->fBufferSize); | |||
| break; | |||
| } | |||
| */ | |||
| port->SetLatencyRange(JackPlaybackLatency, &range); | |||
| fMidiPlaybackPortList[midi_port_index] = port_index; | |||
| jack_log("JackNetDriver::AllocPorts() fMidiPlaybackPortList[%d] midi_port_index = %ld fPortLatency = %ld", midi_port_index, port_index, port->GetLatency()); | |||
| @@ -206,28 +206,6 @@ namespace Jack | |||
| return true; | |||
| } | |||
| /* | |||
| int JackNetMasterInterface::SetRxTimeout() | |||
| { | |||
| jack_log("JackNetMasterInterface::SetRxTimeout"); | |||
| float time = 0; | |||
| //slow or normal mode, short timeout on recv (2 audio subcycles) | |||
| if ((fParams.fNetworkMode == 's') || (fParams.fNetworkMode == 'n')) { | |||
| time = 2000000.f * ((fNetAudioCaptureBuffer) | |||
| ? fNetAudioCaptureBuffer->GetCycleDuration() | |||
| : (fNetAudioPlaybackBuffer) ? fNetAudioPlaybackBuffer->GetCycleDuration() : 0); | |||
| } | |||
| //fast mode, wait for 75% of the entire cycle duration | |||
| else if (fParams.fNetworkMode == 'f') { | |||
| time = 750000.f * (static_cast<float>(fParams.fPeriodSize) / static_cast<float>(fParams.fSampleRate)); | |||
| } | |||
| return fSocket.SetTimeOut(static_cast<int>(time)); | |||
| } | |||
| */ | |||
| int JackNetMasterInterface::SetRxTimeout() | |||
| { | |||
| jack_log("JackNetMasterInterface::SetRxTimeout"); | |||
| @@ -483,62 +461,6 @@ namespace Jack | |||
| if (fNetAudioCaptureBuffer) | |||
| fNetAudioCaptureBuffer->ActivePortsFromNetwork(fRxData, rx_head->fActivePorts); | |||
| /* | |||
| switch (fParams.fNetworkMode) | |||
| { | |||
| case 's' : | |||
| //slow mode : allow to use full bandwidth and heavy process on the slave | |||
| // - extra latency is set to two cycles, one cycle for send/receive operations + one cycle for heavy process on the slave | |||
| // - if the network is two fast, just wait the next cycle, this mode allows a shorter cycle duration for the master | |||
| // - this mode will skip the two first cycles, thus it lets time for data to be processed and queued on the socket rx buffer | |||
| //the slow mode is the safest mode because it wait twice the bandwidth relative time (send/return + process) | |||
| if (fCycleOffset < CYCLE_OFFSET_SLOW) { | |||
| return 0; | |||
| } else { | |||
| rx_bytes = Recv(rx_head->fPacketSize, 0); | |||
| } | |||
| //rx_bytes = Recv(rx_head->fPacketSize, 0); | |||
| //if (fCycleOffset != fLastfCycleOffset) | |||
| // jack_info("Warning : '%s' runs in slow network mode, but data received too late (%d cycle(s) offset)", fParams.fName, fCycleOffset); | |||
| //fLastfCycleOffset = fCycleOffset; | |||
| break; | |||
| case 'n' : | |||
| //normal use of the network : | |||
| // - extra latency is set to one cycle, what is the time needed to receive streams using full network bandwidth | |||
| // - if the network is too fast, just wait the next cycle, the benefit here is the master's cycle is shorter | |||
| // - indeed, data is supposed to be on the network rx buffer, so we don't have to wait for it | |||
| if (fCycleOffset < CYCLE_OFFSET_NORMAL) { | |||
| return 0; | |||
| } else { | |||
| rx_bytes = Recv(rx_head->fPacketSize, 0); | |||
| } | |||
| if (fCycleOffset > CYCLE_OFFSET_NORMAL) { | |||
| jack_info("'%s' can't run in normal network mode, data received too late (%d cycle(s) offset)", fParams.fName, fCycleOffset); | |||
| } | |||
| break; | |||
| case 'f' : | |||
| //fast mode suppose the network bandwith is larger than required for the transmission (only a few channels for example) | |||
| // - packets can be quickly received, quickly is here relative to the cycle duration | |||
| // - here, receive data, we can't keep it queued on the rx buffer, | |||
| // - but if there is a cycle offset, tell the user, that means we're not in fast mode anymore, network is too slow | |||
| rx_bytes = Recv(rx_head->fPacketSize, 0); | |||
| if (fCycleOffset > CYCLE_OFFSET_FAST) { | |||
| jack_info("'%s' can't run in fast network mode, data received too late (%d cycle(s) offset)", fParams.fName, fCycleOffset); | |||
| } | |||
| break; | |||
| } | |||
| */ | |||
| if (fCycleOffset < fMaxCycleOffset) { | |||
| return 0; | |||
| } else { | |||
| @@ -224,13 +224,6 @@ namespace Jack | |||
| #define MASTER_INIT_TIMEOUT 1000000 // in usec | |||
| #define SLAVE_INIT_TIMEOUT 1000000 // in usec | |||
| /* | |||
| #define CYCLE_OFFSET_FAST 0 | |||
| #define CYCLE_OFFSET_NORMAL 1 | |||
| #define CYCLE_OFFSET_SLOW 2 | |||
| //#define CYCLE_OFFSET_SLOW 30 | |||
| */ | |||
| #define CYCLE_OFFSET_SLOW 10 | |||
| #define NETWORK_MAX_LATENCY CYCLE_OFFSET_SLOW | |||
| @@ -64,18 +64,7 @@ namespace Jack | |||
| plot_name = string ( fParams.fName ); | |||
| plot_name += string ( "_master" ); | |||
| plot_name += string ( ( fParams.fSlaveSyncMode ) ? "_sync" : "_async" ); | |||
| switch ( fParams.fNetworkMode ) | |||
| { | |||
| case 's' : | |||
| plot_name += string ( "_slow" ); | |||
| break; | |||
| case 'n' : | |||
| plot_name += string ( "_normal" ); | |||
| break; | |||
| case 'f' : | |||
| plot_name += string ( "_fast" ); | |||
| break; | |||
| } | |||
| plot_name += string ( "_latency" ); | |||
| fNetTimeMon = new JackGnuPlotMonitor<float> ( 128, 4, plot_name ); | |||
| string net_time_mon_fields[] = | |||
| { | |||
| @@ -198,23 +187,6 @@ namespace Jack | |||
| //port latency | |||
| range.min = range.max = fParams.fNetworkLatency * port_latency + (fParams.fSlaveSyncMode) ? 0 : port_latency; | |||
| jack_port_set_latency_range(fAudioPlaybackPorts[i], JackPlaybackLatency, &range); | |||
| /* | |||
| switch ( fParams.fNetworkMode ) | |||
| { | |||
| case 'f' : | |||
| range.min = range.max = (fParams.fSlaveSyncMode) ? 0 : port_latency; | |||
| jack_port_set_latency_range(fAudioPlaybackPorts[i], JackPlaybackLatency, &range); | |||
| break; | |||
| case 'n' : | |||
| range.min = range.max = port_latency + (fParams.fSlaveSyncMode) ? 0 : port_latency; | |||
| jack_port_set_latency_range(fAudioPlaybackPorts[i], JackPlaybackLatency, &range); | |||
| break; | |||
| case 's' : | |||
| range.min = range.max = 2 * port_latency + (fParams.fSlaveSyncMode) ? 0 : port_latency; | |||
| jack_port_set_latency_range(fAudioPlaybackPorts[i], JackPlaybackLatency, &range); | |||
| break; | |||
| } | |||
| */ | |||
| } | |||
| //midi | |||
| @@ -235,23 +207,6 @@ namespace Jack | |||
| //port latency | |||
| range.min = range.max = fParams.fNetworkLatency * port_latency + (fParams.fSlaveSyncMode) ? 0 : port_latency; | |||
| jack_port_set_latency_range(fMidiPlaybackPorts[i], JackPlaybackLatency, &range); | |||
| /* | |||
| switch ( fParams.fNetworkMode ) | |||
| { | |||
| case 'f' : | |||
| range.min = range.max = (fParams.fSlaveSyncMode) ? 0 : port_latency; | |||
| jack_port_set_latency_range(fMidiPlaybackPorts[i], JackPlaybackLatency, &range); | |||
| break; | |||
| case 'n' : | |||
| range.min = range.max = port_latency + (fParams.fSlaveSyncMode) ? 0 : port_latency; | |||
| jack_port_set_latency_range(fMidiPlaybackPorts[i], JackPlaybackLatency, &range); | |||
| break; | |||
| case 's' : | |||
| range.min = range.max = 2 * port_latency + (fParams.fSlaveSyncMode) ? 0 : port_latency; | |||
| jack_port_set_latency_range(fMidiPlaybackPorts[i], JackPlaybackLatency, &range); | |||
| break; | |||
| } | |||
| */ | |||
| } | |||
| return 0; | |||
| } | |||