Commit Graph

983 Commits

Author SHA1 Message Date
Robin Gareus 308d138144
Fix audible blibs due to inconsistent monitor state -- #8275
It is possible that Route::monitoring_state() returns
  (MonitoringDisk | MonitorSilence)

This lead to various cases where there were is a direct comparison
(ms == MonitoringDisk). DiskReader::run tests for MonitoringDisk
to check if the buffer needs to be zeroed while locating.

Likewise Route::process_output_buffers() also explicitly tests
for both MonitoringDisk and MonitoringDisk.

The issue was likely introduced in fbe8075117 (although
it may have been possible in earlier version when using hardware
monitoring as well).
2020-07-07 18:53:36 +02:00
Robin Gareus 7fa7df0111
Remove unused variable
SoftwareMonitoring is handled by AudioTrack::get_input_monitoring_state
2020-06-30 23:25:41 +02:00
Robin Gareus a0bdf87720
Fix potential deadlock when adding sidechain port
Previously add_remove_sidechain() released the process-lock
(to create the I/O ports), while keeping a processor writer-lock.

Meanwhile the auto-connect thread may be woken up to perform
a latency update. This thread takes the process-lock and
then stalls, waiting for a processor reader-lock.

Then add_remove_sidechain() continues and tries to re-acquire
the process-lock.
2020-06-26 17:46:57 +02:00
Robin Gareus 2685728f59
Start collecting plugin stats and recently used plugins 2020-06-24 04:02:17 +02:00
Robin Gareus fbe8075117
Update monitoring
This partially reverts 208c781248
in order to fix monitoring when using punch-in/out.

This also allows to revert to Ardour 5 style MIDI exclusive
Input or Disk monitoring when not using layered-recording.
2020-06-17 23:51:13 +02:00
Robin Gareus 0f95bf001d
Remove unused API (Input Metering)
Input metering is now handled by Track::prep_record_enabled()
explicitly setting meter positions.
2020-06-16 22:42:16 +02:00
Robin Gareus 3294b1ce08
Allow to select pan-automation lanes - #8234
The GUI uses ::axis_view_by_control() if a controllable when
the CoreSelection contains a controllable.

CoreSelection::get_stripables() saves and looks up controllable
by PBD::ID. Panorama automation controls were previously
not found, since they are not directly owned by the route.
2020-06-14 20:31:50 +02:00
Len Ovens 4bfb2ee6cd Allow foldback sends to be pre or post fader 2020-05-28 07:05:59 -07:00
Robin Gareus d3ffc4d90a
Update more messages to prefer "Track/Bus" instead of "Route" 2020-05-24 19:38:04 +02:00
Paul Davis 5a7b7b3bfb remove Route::reload_loop() and derivatives
Replacement to follow in subsequent commit
2020-05-12 11:34:37 -06:00
Robin Gareus caf057f06d
Experiment: propagate solo-state with internal-sends
So far internal-sends were explicitly special-cased, and implicit
solo-state only was only forwarded for direct up/down-stream
connections.  ...and nobody can remember why :)

This restriction is removed, so far mainly with commenting-out
code, as experiment.

Internal sends are not only more convenient, but also required
in cases where direct connections result in ambiguous latency.
2020-05-08 06:35:08 +02: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
Robin Gareus 8aa4ae825d
Skip delayline updates if no change is required 2020-04-27 14:08:37 +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 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 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 3f7de5ec8e
Do not add monitor-sends to foldback busses 2020-04-20 00:34:36 +02:00
Robin Gareus b7c7c02680
Optimize realtime listen-position change 2020-04-18 23:19:58 +02:00
Robin Gareus a90b0daadd
Support for lock-free AFL/PFL changes
Session::listen_position_changed() calls Route::listen_position_changed()
for every route in the session. Each call tool the process-lock
in turn.
2020-04-18 22:11:49 +02:00
Robin Gareus f0b25a776b
Update fan-out signal
* Signals use camelcase.
* use a static signal, independent of the route

Previously the signal was handled by RouteUI, which
caused various issues:
 * the RouteUI may not yet be available
 * There may be many RouteUIs for a single Route
   (mixer, editor-mixer, meter-bridge strips)
2020-04-02 20:27:51 +02:00
Robin Gareus 3b77472ac0
Overhaul InstrumentInfo
* Remove unused direct calls into plugin
* Assume empty model to mean plugin-provided MIDNAM (!)

The route owned Instrument-Info is the central access point used
by the GUI for MIDI name lookups.

At this point in time, custom settings are saved/restored by the
GUI (MidiTimeAxisView). InstrumentInfo provides a volatile store
for MIDNAM mode and model.
2020-04-01 16:31:58 +02:00
Robin Gareus bc1c3e5c21
Postpone disk-i/o setup during session-load
This fixes another assert(), caused by configuring processors,
before set_processor_state() was called.
Route::configure_processors() will be called later.

---
#3  0x00007ffff2472102 in __GI___assert_fail at assert.c:101
#4  0x00007ffff7a8ca1f in ARDOUR::Route::setup_invisible_processors() at ../libs/ardour/route.cc:5013
#5  0x00007ffff7a7a665 in ARDOUR::Route::configure_processors_unlocked at ../libs/ardour/route.cc:1870
#6  0x00007ffff7a79377 in ARDOUR::Route::configure_processors at ../libs/ardour/route.cc:1719
#7  0x00007ffff7a902c0 in ARDOUR::Route::set_disk_io_point at ../libs/ardour/route.cc:6041
#8  0x00007ffff7a7ea0a in ARDOUR::Route::set_state at ../libs/ardour/route.cc:2679
2020-03-31 19:48:17 +02:00
Robin Gareus 40e3364c66
Always delegate meter-point positioning to rt-thread
Previously set_state() -> set_meter_point() acquired the
process-lock to change meter-position, usually causing x-runs
when setting route-state.

This also fixes an issue introduced in fd414ec158. After
populating the processor list, force setting the meter-position
looks up the output streams of the processor before the meter.
However the processors are not configured. That will only happen
later from Session::post_engine_init().

---
#3 0x00007ff07b7d4102 in __GI___assert_fail at assert.c:101
#4 0x00007ff080d3224a in ARDOUR::PluginInsert::output_streams() const at ../libs/ardour/plugin_insert.cc:289
#5 0x00007ff080de8c30 in ARDOUR::Route::set_meter_point_unlocked() at ../libs/ardour/route.cc:4106
#6 0x00007ff080de8699 in ARDOUR::Route::set_meter_point(ARDOUR::MeterPoint, bool) at ../libs/ardour/route.cc:4037
#7 0x00007ff080ddfad3 in ARDOUR::Route::set_state(XMLNode const&, int) at ../libs/ardour/route.cc:269
2020-03-30 17:58:35 +02:00
Robin Gareus fd414ec158
Assert that plugins are configured before setting custom meter position
This fixes the following issue:
  On the master channel insert the waveform scope before the fader.
  Then set the meter position to custom and move the meter to the
  very beginning of the chain.

Before this change, when set_meter_point() was called the
processor list only contained the Fader (_amp) and no other
processor. _main_outs was not yet present in the list, and
Route::maybe_note_meter_position() triggered an
and assert(_processor_after_last_custom_meter.lock());

See also d0dca7daf0
2020-03-30 15:20:54 +02:00
Robin Gareus 84f8b8beae
Convert polarity invert state from v2 sessions 2020-03-25 23:58:15 +01:00
Robin Gareus 386264bd23
Pan: consolidate what_can_be_automated API 2020-03-21 19:46:39 +01:00
Robin Gareus 8f37865070
Prevent freeze/bounce of sidechain processors
This also consolidates code to test if a processor can be frozen
from various places.
2020-03-14 13:25:54 +01:00
Paul Davis 998b88b521 when inside Route::set_state() and calling set_name(), call the virtual method, rather than Route::set_name()
Without this, nothing in Track::set_name() is called, which means that tracks created from templates
do not get their name set appropriately
2020-02-19 19:21:11 -07:00
Paul Davis 585b61e58b fix paren/newline formatting 2020-02-19 19:21:11 -07:00
Robin Gareus 89bd6cafa0
Force Disk-Reader channel count to match Disk-Writer I/O.
This handles some special cases where a plugin is added after
the disk-writer but before the disk-reader.

The plugin may add/remove ports (e.g. an instrument: MIDI to audio,
or some stereo to mono processors). However we need to ensure
that any data that is recorded will be played back.

This is a new take replacing b2bc934e2.
2020-02-20 01:57:14 +01:00
Robin Gareus 4337e2b054
NO-OP: remove old comment and debug code 2020-02-20 01:57:07 +01:00
Paul Davis 95773f6bb7 fix compiler warning about dynamic_cast<T*>(ptr_to_T)
This is in a Route method, so it is obvious that dynamic_cast<Route*>(this) will return true
2020-02-19 15:07:42 -07:00
Robin Gareus 45ff356819
Fix Mixbus well-known filter controls (HP/LP freq) 2020-02-13 17:21:38 +01:00
Robin Gareus 46a6f47362
Address sidechain-port name uniqueness
[Re]name sidechain port directly when a plugin is added.

Usually plugins are constructed without an Route (owner is unset).
PluginInsert c'tor may already create a side-chain port, at the
time of construction the sidechain port will be created using
the port-name "toBeRenamed".

Previously the plugin had to be added to a route using "add_processor",
in order to set a unique name, before a new plugin with sidechain
could be constructed.

ProcessorBox::use_plugins() did that in the correct sequence,
however there may have been cases where this didn't work, and
Route::add_processors() was called directly..
2020-02-13 00:47:18 +01:00
Ben Loftis a9b614fc18 Fix a potential case where PresentationInfo type flag is not set (see comment for details) 2020-02-04 13:08:21 -06:00
Robin Gareus cfea85b496
Use session-version when loading processor state
Stateful::loading_state_version vs.
Stateful::current_state_version

See also 0a5837ec71
2020-01-30 18:52:32 +01:00
Robin Gareus 6452f62d64
Cont'd work on loading old route templates
This builds on top of 51d2bb:
 * v6 routes templates/states have a version per <Route>
 * older route-states are assumed to be from ardour-5
   Stateful::loading_state_version 3002,
   unless specified otherwise
2020-01-30 01:08:57 +01:00
Robin Gareus 51d2bb36ce
Save/Use state-version with route templates
Currently using Ardour-5 route templates (state version "3002")
with Ardour6 fails. As opposed to session-templates, Route
templates were not versioned.

This ensures future compatibility (and may allow to interpret
unversioned templates as "3002")
2020-01-29 23:20:37 +01:00
Robin Gareus 00150e105c
Fix AFL position
* update AFL position when preference changes
* "after post-fader processors (before pan)" is before
  the main-out (not at the end).
* Fix "immediately post-fader":
  The amp, when added was the last element. ++after_end then
  made the iterator point to .end()

This likely worked in the past when the monitor send was added
immediately after adding the fader/amp before any other processors.
2020-01-11 17:48:42 +01:00
Robin Gareus 2c24e6af36
Remove cruft, unused API 2019-12-16 23:37:57 +01:00
Robin Gareus 0a5837ec71
Fix loading plugin state from sessions
While loading a session XML state, set_state must use
`Stateful::loading_state_version`.

When later copying processor state,
`Stateful::current_state_version` is correct.
2019-12-11 16:25:08 +01:00
Robin Gareus 21f682164e
Fix automation alignment for latent plugins
This also solves bi-stable automation for plugins where latency
can change due to automation. e.g.

cycle 1: run (t): automation (t) = on: -> increase latency
cycle 2: run (t-latency): automation (t-latency) = off -> decrease latency
repeat.
2019-12-09 18:54:44 +01:00
Robin Gareus 7d94e1e1f9
Fix well-known control LPF/HPF order. 2019-12-05 16:43:20 +01:00
Paul Davis 1a2665e25f redesign of declicking and fades around loop boundaries 2019-11-22 23:41:56 -07:00
Robin Gareus d4ecfc7d85
Use new boost::optional API
get_value_or() has been deprecated since boost 1.56
2019-11-21 17:48:56 +01:00
Robin Gareus bd90499532
Ignore latency of inactive routes 2019-11-08 17:50:26 +01:00
Robin Gareus 41ad43fa5f
Remove unused signal 2019-11-08 17:50:23 +01:00
Robin Gareus 9694f89966
Use strict-i/o on master-bus by default
This precludes issues with multi-out-plugins adding an excessive
number of ports and changing master-panning.
2019-11-06 20:05:50 +01:00
Paul Davis f61f938503 remove debug message 2019-11-06 09:28:23 -07:00
Robin Gareus 27a3b93152
Update latency-compensation when re-ordering processors
When re-ordering processors, the route's own latency does not
change (at first).
But it might if sends or plugins with side-chains a involved.
2019-10-30 23:51:53 +01:00
Robin Gareus e2f5ce6f61
NO-OP: whitespace/comments 2019-10-30 23:45:27 +01:00
Paul Davis 7d3c2a4fee provide a mechanism to decide if Session::update_latency_compensation() is being called as part of a callback from the backend.
If it is, do not call AudioEngine::update_latencies() to avoid JACK1-style deadlock
2019-10-28 17:23:54 -06:00
Robin Gareus 7060ba4c1d
Fix strict-i/o override on session-load (amend 31847f88ef)
Plugins may override strict-i/o, and in order to know do this
the plugin needs to be instantiate first.
2019-10-23 01:36:33 +02:00
Robin Gareus 0daee87803
Ardour::IO is not latent by itself 2019-09-29 18:25:14 +02:00
Paul Davis 5ec5bc4523 goodbye USE_TRACKS_CODE_FEATURES and is_tracks_build 2019-09-25 12:16:13 -06:00
Robin Gareus d10c4c651c
Consolidate and extend "well-known" controls:
* Add new common strip controls (inspired from Mixbus)
* Remove duplicate documentation, document virtual API only.
* "azimuth" not "azi"
2019-09-25 14:02:45 +02:00
Paul Davis ba9e6ab869 add const and tweak variable name 2019-09-22 12:23:54 -06:00
Robin Gareus e8822e76d6
Add abstract API for latency compensated sends
This is in preparation for MixbusSends that are not derived from
Delivery : IOProcessor.
2019-09-20 21:27:16 +02:00
Len Ovens 220fa45d35 Add signal for foldback send add or remove 2019-08-26 17:48:22 -07:00
Robin Gareus b858b3b692
Detect monitor-send by instance, not name 2019-08-23 01:05:57 +02:00
Len Ovens a5828ba472 foldback may be mono don't set panner type 2019-08-06 11:13:30 -07:00
Robin Gareus a22f918d9d
Update libardour GPL boilerplate and (C) from git log 2019-08-03 15:53:16 +02:00
Robin Gareus 9cfcb0bd92
Mixbus uses K14 (not K20) master meter by default (see also 297ed001d) 2019-07-02 20:18:26 +02:00
Robin Gareus 297ed001d0
Mixbus/master is always using K20 by default
This only affects the meter-bridge, toolbar and editor track-header
(Mixbus' mixer is always using DPM, which is always enabled).
2019-07-02 16:12:06 +02:00
Robin Gareus cd5b0819bf
Consolidate meter-type state and API
In theory different UIs can show different meter-types, so it
can make sense to maintain the type in different places.
MeterType is a bit-set and PeakMeter implementation provides for this.

However, this is not being used, and the current implementation
was rather fragmented, cross-connected signals to keep types in sync,
allowed inconsistent meter-types in GUI and backend.

MeterType is now kept by meter itself, however it is still
saved/restored as part of the Route state.

N.B. This change breaks the API, various methods have been renamed
for consistency.
2019-06-09 19:56:15 +02:00
Robin Gareus ef283ed29c
NO-OP: Unclutter -DGraph 2019-05-08 19:49:01 +02:00
Robin Gareus bf3e91e5cf
NO-OP: whitespace 2019-04-13 17:06:29 +02:00
Robin Gareus ff3b59fb4f
NO-OP: whitespace 2019-04-12 21:38:06 +02:00
Robin Gareus 4199156263
More Ardour/Mixbus codebase unification
Note Presentation-Info bits used by Mixbus to prevent conflicts
when sharing sessions.
2019-04-12 21:37:51 +02:00
Robin Gareus 5c94bd00b5
NO-OP: mixbus codebase unification 2019-04-12 19:22:59 +02:00
Robin Gareus 1ba391ab11
Fix bounce-process: skip all processors before disk-reader 2019-04-07 19:52:12 +02:00
Robin Gareus 73816d3e38
Bounce process always uses speed 1.0 2019-04-07 19:52:02 +02:00
Robin Gareus 60262275af
Do not create automation when shifting (insert/remove time)
This fixes a bug when shift() creates automation for parameters that
can not have any automation (hidden parameters, Mixbus PRE).

The GUI (RTAV) aborts() when it finds an automation lane for
a hidden parameter.

This also cleans up shift() operations in general. Empty automation
lanes should be left alone, no guard-point at zero should be added.
2019-03-25 17:05:19 +01:00
Paul Davis 851388e0b4 remove "rename_playlist" argument from Route::set_name_in_state().
We no longer find playlists by name when constructing tracks, so
the name of the playlist is not relevant
2019-03-20 20:02:07 -07:00
Robin Gareus 3fa3437c38
Remove unneeded calls to configure_processors during session-load
Those are superseded by b890cf73ad, which is done after
all IOChanges have been processed.
2019-03-17 17:32:06 +01:00
Robin Gareus 2f09f72b3d
Amend 883ee9c2, setup required invisible processor
This fixes a potential silent master-bus when re-loading a session
("mains_out" may be skipped).
2019-03-15 15:54:07 +01:00
Robin Gareus 883ee9c2a0
Allow to call set_state() on existing routes
Delaylines are not saved in the XML and internal-return is an
invisible processor not explicitly re-added when the state is restored.

They are [re]inserted during Route::setup_invisible_processors().
So this method need to be called after restoring processor state
(indirectly via configure_processors_unlocked as needed).

PS. During route creation this call happens explicitly and on session load
hookup_io() -> Route::output_change_handler() implicitly sets this up.
2019-03-06 00:57:49 +01:00
Robin Gareus 6a7750a55d
Tweak, optimize route setup
Speed up route creation: add_processor() takes a process-lock
and calls configure_processors() but this is done explicitly at the
end of init() already.
2019-03-06 00:03:46 +01:00
Robin Gareus 2cf57e9257
Fix recursive WriteLock crash due to signal emission
Route::processors_changed() signal connects to a same thread session-slot
Session::route_processors_changed() which can end up iterating over
Routes and Processors to re-calculate latency.
This takes a ReadLock after WriteLock, which eventually leads a duplicate
unlock and segfault.
2019-03-05 00:25:53 +01:00
Nikolaus Gullotta 711965b1a9 Amend d61efbee3 - remove check for Mixbus 2019-02-26 09:45:58 -06:00
Nikolaus Gullotta d61efbee3e Route::save_as_template() needs call state() with true, and add modified-with node to state for template-files 2019-02-26 09:42:30 -06:00
Paul Davis 63fdfd9e85 remove PostTransportWorkCurveReallocate (no longer used) 2019-02-22 14:54:34 -07:00
Robin Gareus 3cffaeac74
Prepare to allow to disable latency-compensation
Previously "zero custom/user latency" meant "default plugin latency".
This is now saved in a separate boolean allowing a user to reduce a
processor's latency to zero.

This also prepares for a global switch to use zero latency throughout
the whole session.
2019-02-16 01:10:50 +01:00
Len Ovens da347c3b37 Hmm, balanced panner didn't seem to make it in 2019-01-18 10:24:13 -08:00
Len Ovens 80df6b84b0 foldback sends should have unlinked balanced panner
Or 1+2 for mono sends.
2019-01-18 10:24:13 -08:00
Robin Gareus 9ec031cfce
Remove duplicate automation shift
Amp, Trim are now processors, moving processor-automation takes care
of gain automation.
2018-12-21 17:33:51 +01:00
Robin Gareus 81857a947c
Consolidate ambiguous engine API calls
available(), connected(), running() were ill-defined and
used interchangeably.
2018-11-28 15:24:47 +01:00
Robin Gareus 2e3e183204 Load audition synth on demand
This saves some memory (gmsynth loads a 30MB soundfont), and also
re-initializes the synth every time to gm defaults in case some
.mid changes patches or parameters.
2018-11-23 22:00:04 +01:00
Len Ovens f27ca29d6c Changed send/deliver role "Personal" to "Foldback" so bus type can match 2018-11-12 22:30:32 -08:00
Johannes Mueller 732fd75f9b Update names of sidechains.
When a PluginInsert is created it does not have an owner right away. That's why
a we need to set the sidechains name once the owner is known, in order to
include owner's name into the name.

Furthermore we need to follow renames of the owner.
2018-11-01 18:53:27 +01:00
Robin Gareus 5bd9bf868f Safe-guard non-rt-safe sidechain operations
This is required by 7d8b93ad for showing error when actively recording.
It also prevents other UIs (OSC, Lua,..) to change re-configuring
sidechain ports/plugins while recording.
2018-10-29 21:52:47 +01:00
Len Ovens 777fe3c68f Add personal monitor sends 2018-10-19 08:51:29 -07:00
Len Ovens 87ab15c862 OSC: personal monitor send hidden follows aux hidden 2018-10-16 13:56:52 -07:00
Robin Gareus 5c47ce32ec Fix master_send_enable_controllable for Mixbusses 2018-10-10 22:41:49 +02:00
Robin Gareus 87559a6054 Fix Mixbus master-bus tape-saturation controllable 2018-09-30 15:34:59 +02:00
Robin Gareus f4c1166651 Fix track rename oddity, don't skip over current name.
ensure_track_or_route_name() can produce the current name.

This fixes the following issue:
Create a two audio tracks. Their names are "Audio" and "Audio 1".
Try to rename "Audio 1" to "Audio", its name becomes "Audio 2".
2018-08-06 19:52:51 +02:00
Robin Gareus cdec333bfe move rt-stop to route
currently this is only used to resolve midi events for plugins
(this is conceptually not correct, note offs should be resolved by
the disk-reader only), but it calls into all processors now (incl
disk-reader if present), which is handy (e.g. flush delaylins)
2018-07-09 17:30:38 +02:00
Robin Gareus 249640267c Remove global declick API
De-click will be per disk-reader, latency compensated and buffer-size
independent. Cue-monitoring should not be affected by de-click.
2018-07-09 17:30:38 +02:00
Ben Loftis 208c781248 Auto-monitor == Cue for MIDI tracks. 2018-02-14 18:04:57 -06:00
Ben Loftis e6da4c4846 SoloSelection: libardour part. 2018-02-11 09:39:36 -06:00
Robin Gareus 9fc68378c6 Process Panner Automatables (emit Changed)
Pan-automation is evaluated directly from the control-list.
::distribute_automated() does not update the controls.

However, the *owner* of each automation-control is responsible to
evaluate automation of automated automation-controls (and emit Changed()
signals to notify the GUI and slaved controls).

This follow the same concept as PluginInsert: The Changed signal
is called on demand when evaluating automation.

This fixes pan-automation-sliders (automation-lane header) not updating.
2017-12-31 18:15:34 +01:00
Robin Gareus e02952a26c Sidechain latency compensation - part one
This properly sets the port-latencies of PluginInsert owned ports as well
as handles external sends (send-target playback latency).

NB. This needs more work to ensure that Sidechain input port playback
latency is set before the feeding send queries it the connected latency.
Re-ordering process may change sidechain or external-send latencies,
but since re-ordering does not change the route's latency,
engine.update_latency() may not be called.
2017-11-26 09:51:00 +01:00
Robin Gareus 5fdd6ca21e Clean up delayline API: don't use 'get_' for accessor method-name 2017-11-04 07:14:12 +01:00
Robin Gareus 0c041dc372 Fix polarity-control size (and crash during audition)
Also initialize new polarity-invert with gain 1.0, not inverted.
Don't fade-in.
2017-11-03 03:06:22 +01:00
Robin Gareus 79b1275b7c Fix set_loop() return value (amend 00a4ad) 2017-10-31 22:00:22 +01:00
Robin Gareus 8cf323c15d Relax assertion to allow rolling backwards into 0. 2017-10-31 19:54:08 +01:00
Robin Gareus 00a4ad712c Move Loop Location to Processors
The processors will becomes responsible to know about loop-positions
and map latency-compensated start_sample, end_sample into the loop-range
as needed.
2017-10-31 18:32:26 +01:00
Robin Gareus 3b785b9d35 Small steps towards rolling backwards.. 2017-10-31 03:51:08 +01:00
Robin Gareus 9a2433eacf Migrate to Polarity-inversion processor & fix proc positions
* invert polarity after disk i/o proc or return
* fix position of export-proc (after polarity)
* fix input-meter (before disk-writer or after return)
2017-10-31 03:18:59 +01:00
John Emmas 63b6ab1101 'Route::tape_drive_controllable()' needs to return something 2017-10-21 11:23:05 +01:00
Ben Loftis 23c2b751aa US2400: map knobs for mixbus strips, when selected. 2017-10-19 11:53:55 -05:00
Robin Gareus 47246c86e2 add missing lock (for audition + mon section) 2017-10-10 22:12:54 +02:00
John Emmas ad226cf2bb For 'Route::send_pan_azi_controllable()' (when building non-Mixbus) I'm assuming the intention was to return an empty object
(i.e. similar to 'Route::send_enable_controllable()')
2017-10-07 10:11:12 +01:00
Ben Loftis 28d8f2f6b9 US2400: send_pan_azimuth lookup function (currently mb-only) 2017-10-05 09:59:03 -05:00
Robin Gareus e31f5d9998 Clean up State API:
* Processor implement get_state(), classes derived from Processor
  implement protected ::state() -- as documented in processor.h
* likewise for Route, Track: make ::state() a protected interface
* removal of "full_state", use explicit "template_save"
* use RAII/Unwind to skip saving automation-state
2017-10-04 00:54:55 +02:00
Robin Gareus eb0dded095 Immediate-event/out-of-band injection update & tweak clearing buffers
Immediate events are used for MIDI-Panic and to inject GUI generated
events e.g. patch-changes, note-events from the track-header
(scroomer-keyboard) and patch-change audition.

Current behavior:

- snapshot copy immediate events from ringbuffer into a buffer at
  the beginning of each the cycle.
- Inject immediate events into input-buffer directly after reading the input
- process "normally"
- pass immediate event-buffer to disk-writer, so it can skip them
  (don't write immediate events to disk)
- if the Route is not monitoring input: clear buffer before disk-reader
  and re-inject (original) immediate events after the disk-reader
- immediate events process normally and are also sent to outputs.
2017-09-30 23:16:04 +02:00
Robin Gareus 56edd3767c NO-OP, re-order code, put all *roll() methods next to each other. 2017-09-30 18:54:47 +02:00
Robin Gareus dec10f2f3c First part of consolidating ::roll(), ::no_roll()
This moves common code (get and fill buffers) into ::passthru()
and renames ::passthru() to ::run_route().

passthru_silence() is no longer used (it was only needed A5 style
Track::no_roll_unlocked for no-roll + disk-monitoring)
2017-09-30 18:53:02 +02:00
Robin Gareus 0fc3bbddb2 remove unused Route::_silent 2017-09-30 18:46:24 +02:00
Robin Gareus de4c0eb27c Remove Input-meter special-case
Now that disk is no longer topper-most but a processor, the special
case is no longer needed.
2017-09-30 18:01:45 +02:00
Robin Gareus 5fa9f8b399 Towards fixing no_roll()
Currently ::roll() may actually be a ::no_roll() under some circumstances.

This can also happen during count-in:
  transport_stopped () == transport_rolling()

and during latency-preroll:
   Global session-transport speed != 0, some tracks already roll,
   read data from disk and feed latent plugins.
   but other non-latent tracks or busses don't roll and still have to
   behave like the switch from no_roll() to roll() has not yet happened.

This changes the game WRT to monitoring as well, previously, Route:roll()
called Route::no_roll_unlocked () for conditions outlined above.
Now Track::no_roll_unlocked is called and in some cases wrongly clears
the buffers before the signal hits the disk-writer. (more work is needed
related to 61f8e53b)

On the upside this also fixes an issue with MidiTrack::no_roll not keeping
a lock while pushing data into the step-edit-ringbuffer.

This is also a step towards consolidating all entry points:
::roll(), ::no_roll(), ::silent_roll() in the Route class.
2017-09-30 16:45:45 +02:00
Robin Gareus 697d29cdc2 Fix thinko in 8139becb -- route split cycle
Individual Routes cannot split the process-cycle in no_roll(); roll()
by themselves. Each of the calls will flush output buffers (and offset
port-buffers). If a route feeds another route the inputs of the other
route will only see partial data.
2017-09-30 13:10:17 +02:00
Robin Gareus 72fb8a5342 Align punch in/out recording with latency-compensation 2017-09-30 02:45:13 +02:00
Robin Gareus ccedb2d44e Remove unused punch+preroll API
This API was not used, also superseded by record w/preroll.
2017-09-29 21:02:22 +02:00
Robin Gareus 2b20f30d81 Aux-Send Latency compensation, part 2 & code-consolidation 2017-09-29 05:03:48 +02:00
Robin Gareus ddd4e3cf1d Aux-Send Latency compensation, part 1: latent sources 2017-09-29 05:03:48 +02:00
Robin Gareus 5a2ea4d0e2 Delayline naming -- for debug purposes 2017-09-29 05:03:48 +02:00
Robin Gareus 8139becb18 Ongoing work on latency compensation
The general goal is to align transport-sample to be the audible frame
and use that as "anchor" for all processing.

transport_sample cannot become negative (00:00:00:00 is the first audible
frame).

Internally transport pre-rolls (read-ahead) before the transport starts
to move. This allows inputs and disk to prefill the pipeline.

When starting to roll, the session counts down a global "remaning preroll"
counter, which is the worst-latency from in-to-out.
Each route in turn will start processing at its own output-latency.

Route::process_output_buffers() - which does the actual processing
incl disk i/o - begins by offsetting the "current sample" by the
route's process-latency and decrements the offset for each latent
processor.  At the end of the function the output will be aligned
and match  transport-sample - downstream-playback-latency (if any).

PS. This commit is a first step only: transport looping & vari-speed have
not yet been implemented/updated.
2017-09-29 05:03:48 +02:00
Robin Gareus 69b9ad6bcc Prepare removal of initial_delay 2017-09-29 05:03:48 +02:00
Robin Gareus 3d1e1d7213 clean up route header, NO-OP (except variable re-order) 2017-09-29 05:03:48 +02:00
Robin Gareus abb7cb90e7 NO-OP: Whitespace 2017-09-29 05:03:48 +02:00
Robin Gareus d98f87d542 No more disk-reader roll-delay
It was not working in sdio/6.0-pre anyway and with upcoming changes to
latency compensation the concept of per disk[stream/reader] will go away.
2017-09-29 05:03:48 +02:00
Robin Gareus 13cf4da011 Consolidate check for internal/non-removable processors 2017-09-23 00:34:01 +02:00
Robin Gareus aac8040e95 Enforce disk-reader to be after the disk-writer
If disk-monitoring is disabled: disk-reader position is not relevant.
If Rec-arm is off: disk-writer position is not relevant.

But...

   Play -> [plugins] -> Record

is basically a bounce and best done using the bounce operation.
(faster than realtime).

   Input + Play -> Record -> Output

Ardour would need to align playback with the Input to be recorded
and at the same time align it with output, so that a player can play
along on the same track. That's not possible without a time-machine (or
a 2nd play processor).

While it can work in theory under some special circumstances, allowing
the disk-reader before the disk-writer is really just confusing,
error prone and valid uses cases are better handled by dedicated
operations.
2017-09-22 03:47:38 +02:00
Paul Davis 48d11000e5 attempt to fix roll delay logic by moving it into DiskReader (the only place it matters) 2017-09-19 18:53:27 -04:00
Robin Gareus 21aa2f529f Fix nightly typos'n'thinkos: initial-delay calculation 2017-09-19 17:03:28 +02:00
Robin Gareus 29e553ab86 Amend c8a9b28d3 and 40aebce. Fix gain automation edge-cases:
* drop Trim/Fader automation for bypassed processor
* Trim/Fader automation for Busses is always active when rolling
2017-09-19 04:54:42 +02:00
Paul Davis c8a9b28d3b remove getter for Amp::_apply_automation_gain; reset member to false after use, and true after ::setup_automation_gain
runs successfully
2017-09-18 22:21:27 -04:00
Paul Davis 40aebce699 consolidate roll methods into Route::roll()
We want Track to shrink, and logic consolidation is always good. Route already knew about
disk_reader and disk_writer, now it knows about _monitoring_control too
2017-09-18 21:28:02 -04:00
Robin Gareus 10b76ae631 Various updates and fixes for Latency Compensation
* centralize signal_latency_at_***_position to processors
* update initial-delay/roll-delay when processor order changes
* consolidate signal-latency calculation: use the same method
  for processor-changes and session's post_playback_latency.
* include relative output-delay in roll-delay
* fix capture processor position & optimize stem-export latency

(roll-delay fixes pending Route:roll() update)
2017-09-19 02:11:22 +02:00
Paul Davis 0a53b13de5 Disk IO "pre-fader" means pre-trim, not post-trim 2017-09-18 13:41:28 -04:00
Paul Davis 30b087ab3d globally change all use of "frame" to refer to audio into "sample".
Generated by tools/f2s. Some hand-editing will be required in a few places to fix up comments related to timecode
and video in order to keep the legible
2017-09-18 12:39:17 -04:00
Paul Davis 24df2b5594 NO-OP: mark various state property names as explicitly non-translated 2017-09-18 11:40:53 -04:00
Paul Davis 13d44c4d76 move disk_{writer,reader} into Route to allow for simple, sensible implementation of DiskIOPoint 2017-09-18 11:40:53 -04:00
Paul Davis 6038ef44f9 auditioner always runs at normal speed, independent of transport speed 2017-09-18 11:40:53 -04:00
Paul Davis 4bfc5ddf71 mechanism to allow Track (or other Route-derived type) to add its own processors at the right time 2017-09-18 11:40:53 -04:00
Paul Davis dc4f730ac9 initial (incomplete) framework for DiskIOPoint manipulation 2017-09-18 11:40:53 -04:00
Paul Davis 79abf3dfa6 set + store signal chain latency for all processors; DiskWriter sets its capture_offset appropriately 2017-09-18 11:40:53 -04:00