13
0

Work around jack input monitoring

This works around JACK not allowing to directly access physical
input buffers by creating an explicit connection.

Ardour access input-buffers directly without connection
for input meters and AFL. This work in general since data
on those ports are always read unconditionally at the start of
each process cycle.

 jack_port_get_buffer (jack_port_by_name (c, "system:capture_1"), n);

However with jack this fails if the given port is not connected.
Due to an internal jack optimization collecting input data is
skipped for ports that have no connections.
This commit is contained in:
Robin Gareus 2021-03-21 00:06:44 +01:00
parent d4a80c18c5
commit 954edb7bd8
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 16 additions and 0 deletions

View File

@ -47,6 +47,12 @@ CONFIG_VARIABLE (AutoConnectOption, output_auto_connect, "output-auto-connect",
CONFIG_VARIABLE (AutoConnectOption, input_auto_connect, "input-auto-connect", AutoConnectPhysical)
CONFIG_VARIABLE (bool, strict_io, "strict-io", true)
/* Connect all physical inputs to a dummy port, this makes raw input data available.
* `jack_port_get_buffer (jack_port_by_name (c, "system:capture_1") , n_samples);`
* nees to work for input-monitoring (recorder page).
*/
CONFIG_VARIABLE (bool, work_around_jack_no_copy_optimization, "work-around-jack-no-copy-optimization", true)
/* Naming */
CONFIG_VARIABLE (TracksAutoNamingRule, tracks_auto_naming, "tracks-auto-naming", UseDefaultNames)

View File

@ -737,6 +737,16 @@ PortManager::reestablish_ports ()
set_pretty_names (port_names, DataType::MIDI, false);
}
if (Config->get_work_around_jack_no_copy_optimization () && AudioEngine::instance()->current_backend_name() == X_("JACK")) {
PortEngine::PortHandle ph = port_engine().register_port (X_("physical_input_monitor_enable"), DataType::AUDIO, ARDOUR::PortFlags (IsInput|IsTerminal|Hidden));
std::vector<std::string> audio_ports;
get_physical_inputs (DataType::AUDIO, audio_ports);
for (std::vector<std::string>::iterator p = audio_ports.begin(); p != audio_ports.end(); ++p) {
port_engine().connect (ph, *p);
}
}
update_input_ports (true);
return 0;
}