Commit Graph

16001 Commits

Author SHA1 Message Date
Robin Gareus
d3d120fa28 Prepare to allow using ALSA backend with nperiods > 3
This will still need an update for Alsa_pcmi::set_hwpar() capture
channel (which is fixed at 2, unless FRAG_NEAR is used).
2020-04-28 03:28:34 +02:00
Robin Gareus
13ed8da2bc Add flag to allow ALSA backend to fall back to nearest avail. nperiods 2020-04-28 02:51:20 +02:00
Paul Davis
30a60f45df show MTC transport master latency when computed 2020-04-27 15:44:28 -06:00
Robin Gareus
2587ad6dc3 Ignore unconnected ports for latency-compensation
This fixed a false-positive "ambiguous latency" warning for
MIDI busses:

 MIDI track -midi-> MIDI Bus w/instrument -audio|midi-> master

The master-bus only has audio inputs, so the MIDI Bus'
MIDI out is left unconnected. Its latency does not matter,
it can float freely.

Previously it was assumed to be zero. So the MIDI Bus' input
playback latency range was [0, master-bus playback-latency].
2020-04-27 23:10:21 +02:00
Paul Davis
c56e99cd09 nominal improvement for MTC master: use port latency to adjust sampletimes that MTC events "occured at" 2020-04-27 15:02:29 -06:00
Robin Gareus
24d3bf25a9 Don't call into engine for queued latency updates 2020-04-27 17:28:26 +02:00
Robin Gareus
09f9cd377d Prevent excessive latency recomputations
Session::update_latency() may be called multiple times with
the process-lock being held.
2020-04-27 16:31:40 +02:00
Robin Gareus
d6242f35f5 Remove debug message 2020-04-27 16:26:36 +02:00
Robin Gareus
8aa4ae825d Skip delayline updates if no change is required 2020-04-27 14:08:37 +02:00
Robin Gareus
1983f56592 Work around jack2's insane thread semantics
jack2 can process in parallel with calling a graph-order or
latency-callback, so Ardour takes a lock to update those in sync.

Yet jack2 can also block while port-registrations happen,
and concurrently emit latency-callback from another thread..
2020-04-27 04:10:18 +02:00
Robin Gareus
b0daa85bfb Prevent race between adding ports and IO port-lookup 2020-04-26 22:17:18 +02:00
Robin Gareus
31c39ed869 Remove duplicate i/o latency calculation
Port and connection changes always imply a latency_callback from
the engine. Worst I/O latency is updated directly in
Session::update_latency() which is called from
AudioEngine::latency_callback.

Explicit subscriptions to route->output()->changed() is not needed
to update the worst I/O latency.

Only set_block_size() needs to to update the I/O latency when
the buffer-size changes.
2020-04-26 21:34:26 +02:00
Robin Gareus
842e841e0d Remove common prefix for latency debugging
-DLatency now triggers all four:
  * LatencyCompensation (entry-points, overall flow)
  * LatencyIO (Port/IO query, set/get private/public)
  * LatencyDelayLine (Delaylines for internal sends and alignment)
  * LatencyRoute (route processor latency)
2020-04-26 21:25:07 +02:00
Robin Gareus
de819e579a Fix a deadlock (process_lock vs _update_latency_lock)
The backend may call update_latency() while at the same time
the auto-connect-port calls set_worst_io_latencies().

The latter already holds the process-lock, so update_latency()
first needs to acquire it, as well. If one already holds the
_update_latency_lock, one must not ask for the process-lock.

---

Previously Ardour's connection manager first took the process_lock
and then waited to the _update_latency_lock.
Meanwhile jack calls latency_callback(), takes the
_update_latency_lock and waits for the process_lock.
Classic deadlock.
2020-04-26 20:25:31 +02:00
Robin Gareus
3785cbbf03 Cont'd work on delayline-config (amend b196cef2) 2020-04-26 05:55:43 +02:00
Robin Gareus
0067a4596d Speed up loading sessions with synths
LV2 plugins may add a MIDNAM file when they're loaded.
This can be happen concurrently with the MidiPatchManager,
loading the system-wide patch files.

Session load should not be interrupted by the initial
background scan of patch files, which can take a very long time.
We need to allow update_custom_midnam() to grab the _lock.
2020-04-26 04:55:59 +02:00
Robin Gareus
02e5605cdd NO-OP: reduce scope, return early 2020-04-25 18:24:42 +02:00
Robin Gareus
b9c29c478c Remove unused signal 2020-04-25 17:53:49 +02:00
Robin Gareus
b196cef2c4 Prevent delay-line reconfiguration while processing
Various backends have different strategies for updating latencies,
and different thread semantics for latency update callbacks.

With jack2 it is possible that processing happens concurrently
while port latencies are being changed.

Ardour internal backends emit the latency callback from the
main process thread, serializing latency changes with processing.

Various user actions can also trigger latency changes. e.g.
with a stopped engine it is possible to re-order plugins.
2020-04-25 17:52:54 +02:00
Robin Gareus
e16ac09e54 Clean up 135814cf0, prefer PannableChanged signal
This allows to also catch cases when a panner-ui directly changes
set_linked_to_route() of the panner shell.
2020-04-25 16:26:37 +02:00
Paul Davis
afc8dd9022 fix thinko in Session::should_ignore_transport_request() and drop out of external sync if command is allowed
The semantics are that if the user configures things to allow transport commands while
using a transport master, issuing such commands first stops using the master
2020-04-24 14:22:06 -06:00
Paul Davis
58304b3a7e make Session::should_ignore_transport_request() non-const 2020-04-24 14:20:59 -06:00
Paul Davis
12b48fff76 fix parentheses around expression that prevented port flags from being set for ltc slave 2020-04-24 11:51:45 -06:00
Paul Davis
e6b12bd0aa ensure that when a Session emits Port::PortDrop, transport master ports are left in place 2020-04-24 11:50:43 -06:00
Robin Gareus
ea8d1d09d4 Fix MacOS builds (API change in 705ac7bfc5) 2020-04-24 07:06:40 +02:00
Robin Gareus
dbcbfd7b5b Fix builds, missing include 2020-04-24 01:53:59 +02:00
Alexandre Prokoudine
2aa5e90290 Update Russian translation 2020-04-24 01:06:16 +02:00
Robin Gareus
135814cf0d Expose pan-link via Send API, emit signal on change 2020-04-24 00:57:15 +02:00
Robin Gareus
e15b5c6e6b Clean up Audition realtime_overwrite
Auditioner seek calls are explicitly handled by the butler,
and DR:overwrite_existing_buffers() is called explicitly
to read MIDI data for audition.

Session::non_realtime_overwrite is no longer required.

This reverts commit 6fbcf83779
and parts of 2d11667ce3.
2020-04-23 17:08:09 +02:00
Robin Gareus
54bc1018d5 Fix MIDI auditioning
The Auditioner is not part of the session route-list and the
auditioner route's I/O latency is never updated.
Session::process_audition() does not handle pre-roll either,
so it need to be zeroed, otherwise Route::roll skips samples.

This has lead to initial samples being skipped, IFF the
auditioner's output-port had non-zero latency.

Since private port-latencies are usually only set for routes
in the route-list, and _remaining_latency_preroll is reset
at transport-stop, this *usually* worked...

Last but not least, MIDI notes need to be resolved when seeking.
2020-04-23 05:23:31 +02:00
Robin Gareus
6fbcf83779 Don't add the Auditioner to the route-list
This fixes a bug introduce in 2d11667ce3. The Auditoner
was accidentally added to the shared_ptr<> referenced RouteList.
2020-04-23 04:58:51 +02:00
Robin Gareus
40eefeddd6 Micro optimization: cache output IO latency
IO::latency iterates over the port-set retrieving the
private_latency_range of each port. Since it can only change
when connections and latency changes, we can instead cache the value.

This is also in preparation to allow the auditioner to override it.
2020-04-23 04:56:45 +02:00
Robin Gareus
6b10987e4b Fix Auditioner edge-case when synth cannot be loaded 2020-04-23 02:30:16 +02:00
Robin Gareus
c264ab6c95 Remove debug output 2020-04-23 02:29:45 +02:00
Robin Gareus
afad873a22 Fix parsing XML with blanks from memory
This is needed when the butler thread loads a plugin with
MIDNAM. xmlKeepBlanksDefault() setting is per thread.

see also df3a4ed9c6
2020-04-23 02:28:48 +02:00
Robin Gareus
705ac7bfc5 Prevent huge stack allocations for MIDNAM files
xmlParseMemory() uses a c-pointer char*.
Previously MIDNAM data on the heap were wrapped inside
a std::string only to be later accessed via c_str().
2020-04-23 02:25:38 +02:00
Robin Gareus
3d166c7789 Consolidate stack-size and priority of rt-threads 2020-04-23 01:28:58 +02:00
Luciano Iam
ea16fc51d3 WebSockets: fix guard header in json.h 2020-04-22 21:59:35 +02:00
Luciano Iam
dbb26daafa WebSockets: also json-escape strings in state messages 2020-04-22 21:59:35 +02:00
Luciano Iam
946094b25c WebSockets: also json-escape paths in manifests
Extends 3c423d9
2020-04-22 21:59:35 +02:00
Luciano Iam
c362605b49 WebSockets: add some TO DO comments 2020-04-22 21:59:35 +02:00
Luciano Iam
8b65b0a961 WebSockets: disable http caching if NDEBUG is set
This is useful while developing web surface javascript code
2020-04-22 21:59:35 +02:00
Luciano Iam
ff7b7fe6a7 WebSockets: fix a comment in server.cc 2020-04-22 21:59:34 +02:00
Paul Davis
9a93583ef7 fully initialize SMF tempo information to default (4/4, 120bpm)
Leaving CPC and 32nd-per-quarter at -1 causes arithmetic errors later if the SMF
file doesn't contain an explicit time signature meta-event
2020-04-21 21:17:14 -06:00
Robin Gareus
2d11667ce3 Fix MIDI audition and audition seeking
DiskReader::seek() no longer fills MIDI buffers.
MIDI is now read into memory via DR:overwrite_existing_buffers()

There is still some edge-case remaining to be fixed. For
some reasons the synth does not receive initial patch/program
changes when starting auditioning.
2020-04-22 05:09:30 +02:00
Robin Gareus
d03a3903a0 Take lock to add/remove custom MIDNAMs
update_custom_midnam() is usually called from the GUI or butler
thread when a LV2 plugin is instantiated, or the plugin changes
its MIDNAM. It must be exclusive with load_midnams_in_thread()
and calls from MTAV to ::maybe_use().
2020-04-22 05:02:58 +02:00
Luciano Iam
80dc3a38e0 WebSockets: let clients know if a strip is a VCA
This allows to hide the panner for example
2020-04-21 16:20:24 +02:00
Luciano Iam
68463cb591 WebSockets: add checks for VCA stripables
Also include VCAs when sending strip descriptions
2020-04-21 15:53:27 +02:00
Luciano Iam
cc08a2d945 WebSockets: compatibility fixes for Windows
Escape path strings in surfaces.json
Default to index.html in mount points
2020-04-21 15:53:27 +02:00
Robin Gareus
05650a0156 Add Lua Bindings for Internal Sends 2020-04-21 15:34:20 +02:00