Commit Graph

1247 Commits

Author SHA1 Message Date
Ben Loftis 00bd313e6e Mixer Scenes: fix code thinkos for sparsely-populated vector of scenes
* don't create a new MixerScene if one already exists
* only resize the vector when necessary
* adding a new scene at position N should not shrink the vector size
2022-06-01 08:53:50 -05:00
Robin Gareus ce7d8ed8a1
Fix consolidating to FLAC file(s)
FLAC file needs to be re-opened read-only. FLAC files do not have a
read/write mode.
2022-05-30 20:46:23 +02:00
Paul Davis cc2e6b3cf8 libardour: change API of Session::request_locate() to include "force" argument
No behavior should be changed by this modification; the argument has a default value of false, which
matches previous semantics, and every instance where the argument is specified, it is given as false.
2022-05-27 18:49:11 -06:00
Robin Gareus 927562678b
Do not emit MixerScene signal with locked mutex (fixes ndeadlck) 2022-05-26 16:18:00 +02:00
Robin Gareus baa30262b8
Be more specific about RouteProcessorChange signals
Session::route_processors_changed accumulates signals emitted
in realtime and processing is delegated to a dedicated rt-safe
thread. Previously this resulted in any changed to be converted
to a `GeneralChange`, which unconditionally triggered a route-reorder.

Record-arming a track causes a MeterPointChange (meters change to "in"),
and this caused routes to be resorted and a latency-update.

While the former is reasonable (Ardour prefers to process
rec-armed routes first), the latter certainly is not.
2022-05-24 02:26:56 +02:00
Robin Gareus 48fdfbab53
Implement Session support for Mixer Scenes 2022-05-19 23:31:54 +02:00
luz paz 1e640563d6
Fix source comment typos in `libs/ardour`
Found via `codespell`
2022-05-11 00:14:28 +02:00
Robin Gareus a97e910b70
Debug efficiency of latency and graph order callbacks 2022-05-09 17:39:05 +02:00
Robin Gareus 3f1420880b
Implement IOPlug processing using the Process Graph 2022-05-09 17:39:05 +02:00
Robin Gareus c45a6b80c7
Session support to add/remove save/load IOPlugs 2022-05-09 17:39:05 +02:00
Robin Gareus f5b280a850
Generalize graph processing
This allows to pass any GraphChain to the Graph to process.
It removes the need to use a mutex to swap two dedicated
chains (setup-chain <> active-chain, pending-chain).

Also various special cases pertaining to graph interaction
while auditioning and route-deletion can be removed.

This also unconditionally creates a graph-thread for GraphChains
to be processed, even if the main callback uses a special-cased
sorted RouteList if there is only one process thread.
2022-05-06 17:43:01 +02:00
Robin Gareus 9ad154f265
Untangle Graph from Route
The process-graph should only be concerned with GraphNodes,
which may or may not be Routes.

This also removes intrinsic connection information from
the graph-node. Connection information is to be kept separate
from the nodes.

When the graph is re-calculated in the background, old information
has to be retained until the new graph becomes active.

Previously *new* information was already stored in the nodes
while the graph is sorted, even though the new graph was not
active.
2022-05-06 14:02:34 +02:00
Robin Gareus 078e652859
Implement rt-safe deletion - delegate to butler 2022-05-06 14:02:32 +02:00
Robin Gareus 98bfede1fc
Restore connections when using templates
This also fixes an issue when duplicating tracks. Saved
connections were ignored and tracks were auto-connected.
2022-04-26 15:36:51 +02:00
Paul Davis 91e1083cb1 fix typo 2022-04-09 18:35:16 -06:00
Paul Davis bdc8264fda given 217519b1b4, revert 5bbfac23 and cleanup DEBUG_TRACE output 2022-04-09 18:33:24 -06:00
Paul Davis 7c3268d12f temporal: TempoMap::use() returns a const ptr to enforce semantics (library version)
This commit leaves two issues outstanding:

1. unclear/ugly semantics for drag operations that reset the GUI thread's tempo map to the writable copy
2. undo/redo for the tempo map

These will be addressed in future commits
2022-04-08 11:58:04 -06:00
Paul Davis bc38f8d424 MidiSource: change thread mutual exclusion object from Mutex to a RWLock
This allows two reader threads to proceed without blocking each other, as can
happen when the butler renders a MIDI track into an RT-safe buffer while the
GUI reads the same MidiModel/Source for visual display.
2022-04-05 20:52:09 -06:00
Paul Davis a803dd0df8 superclock_ticks_per_second: use an (inline) accessor, change value
We do not want a value as large as the previous one, which limits the time
range that can be represented in 62 bits unnecessarily. The new value is
9 times smaller than the previous value, and loses only 384000 as a significant
factor.

This commit also switches to using an (inline) accessor for superclock_ticks_per_second,
making it possible in debug/testing phases to spot early/illegal uses of the value.
2022-03-17 14:15:59 -06:00
Robin Gareus 3ae73eb242
Extend Session::Exported signal
Include timespan start position. This will allow to re-import
the file at the export-position.
2022-03-15 22:52:58 +01:00
Paul Davis a336e87df8 when loading a session, catch up on tb_with_filled_slots correctly 2022-03-14 14:10:29 -06:00
Paul Davis 2ea75e88a2 sync cue markers when tempo map changes
This generates the _cue_events list, which is timestamped in samples, from all
current locations that are cue markers
2022-03-14 14:03:07 -06:00
Paul Davis 22b50c1716 ensure that Session handles tempo map changes synchronously in the main RT process thread 2022-03-14 14:03:07 -06:00
Paul Davis 00d8b08300 triggerbox: track empty slot status and ignore stop-at-session-end when appropriate 2022-03-14 14:03:07 -06:00
Robin Gareus 020051772e
Extend Session::Exported signal
Indicate if exported file should-be re-imported.
2022-03-11 04:55:24 +01:00
Robin Gareus 2328df23e5
Collect and postpone send delayline updates
In order to detect if route delaylines need to be updated,
aux-send delaylines need to be updated first. This was previously
done directly in the latency-callback, which may be concurrent
with processing.

Now only the information (pending_delay) is set, and the actual
change happens later at the end of process().
2022-02-07 04:31:42 +01:00
Robin Gareus 31b7e18d7d
Fix edge-case race initialize_latencies() vs process()
Due to _init_countdown when the engine starts, it is
extremely unlikely that Session::initialize_latencies(),
which is invoked by AudioEngine::Running runs concurrently
with Session::process, but at least in theory it would be possible.
2022-02-06 00:45:49 +01:00
Robin Gareus 77bfba1281
Revert "Fix playback of initial notes during MIDI audition"
This reverts commit 617697a823.
2022-02-05 19:16:44 +01:00
Robin Gareus 617697a823
Fix playback of initial notes during MIDI audition 2022-02-04 19:32:34 +01:00
Robin Gareus 6900facef2
Fix potential deadlock
block_processing() may hold the process-lock, waiting
for the latency-lock. at the same time audio-engine
may hold the latter, trying to acquire the former.
2022-02-02 14:16:50 +01:00
Paul Davis 1ab49bcc32 change MidiStateTracker to MidiNoteTracker
The old name will become a bigger class/object that tracks all MIDI state,
not just notes
2022-02-01 18:06:40 -07:00
Robin Gareus f103b984ab
Fix bounce + callback concurrency
Prevent Session::write_one_track to commence while latency
callback is already in progress. See also
* 19067f8c87
* 2eaa0183ef
2022-02-02 00:27:35 +01:00
Ben Loftis 63e134097c Session::trigger_by_id finds a trigger from its pbd::id 2022-01-27 13:15:27 -06:00
Robin Gareus 729ff35faf
Mark session as modified when stripable order chanes
Previously this was handled by the Editor/Mixer Treeviews,
centralizing it in Session makes more sense.
2022-01-27 01:28:49 +01:00
Robin Gareus bdb91a434a
Simplify call to find_route_name()
Use std::string directly. There's no need to create a temporary
std::string from a char* when the API can use it directly.
2022-01-24 21:25:20 +01:00
Robin Gareus 670e1f9025
NO-OP: clarify variable name (1/2) 2022-01-15 00:06:26 +01:00
Robin Gareus 76facc0b13
Unconditionally create Triggerbox for each Track
This addresses and issue when loading old sessions or creating
tracks from [old] templates.
2022-01-14 22:46:50 +01:00
Paul Davis a187b5e1fb triggerbox: reimplement timeline cues without session events 2022-01-06 00:23:27 -07:00
Paul Davis 93b30976e5 cue events: some basic handling framework for syncing cue markers with session events that implement them
This doesn't actually do anything yet
2022-01-05 13:27:47 -07:00
Robin Gareus b72268f6e1
triggerbox: rename sidechain port when track's name chanes
Just like PluginInsert::update_sidechain_name, the name is
implicitly set, using the owning route's name, suffixed with the
[i18n localized] Processor name.

This fixes an issue if a track is renamed and a new track with
the old name is created. This commonly happens during File Import:
For each ImportAsTrack a generic named track (e.g. "Audio") is created
before it is renamed.

Previously this lead to
Failed to register port "Audio 1-trig/midi_in 1", reason is unknown from here
2022-01-04 01:22:34 +01:00
Paul Davis ff89d998b2 triggerbox: steps toward sane trigger stopping API and design 2021-12-22 17:27:26 -07:00
Paul Davis f3fe31da27 session: fix for creation of new/default tempo map 2021-12-21 17:38:42 -07:00
Paul Davis 722a159ac1 Session constructor should create a new tempo map
This may be the wrong place to do this. It might be more appropriate in ::set_state(0
so that we either use existing XML state or a default tempo map
2021-12-21 17:38:42 -07:00
Robin Gareus 3b5dbf2252
Mark new Tracks with TB to present them 2021-12-01 23:10:07 +01:00
Robin Gareus ee8e8da614
Stop auto-connect thread before terminating ctrl surfaces
This works around a race-condition, calling d'tors from
two threads concurrently.

The GUI thread destroys ctrl surfaces. ~~MIDIControllable()
calls ::drop_external_control() -> ::midi_forget()
This unsubscribes from signals (notably MIDI::Parser events)
by calling ScopedConnection::disconnect(), Connection::disconnect().

At the same time auto_connect_thread can call
PortManager::clear_pending_port_deletions() which removes
the MIDI port and destorys the MIDI::Parser.

~Parser() calls Connection::signal_going_away() to invalidate
connected signals.

This can deadlock if it is called concurrently with
Connection::disconnect() on the same signal.

see also
https://discourse.ardour.org/t/ardour-session-close-hangs/106523/10
2021-11-20 23:14:42 +01:00
Paul Davis 91a28b78c4 modify and extend both Session and TriggerBox API to allow better transport control
This allows a stop transport request to first stop all active triggers and then stop the transport
2021-11-10 15:55:58 -07:00
Paul Davis 241948635b new session event type for triggering scene changes 2021-11-03 22:58:17 -06:00
Paul Davis 62c80e1430 Add the definition of Session::AfterConnect 2021-11-03 15:18:59 -06:00
Paul Davis 62f9edfc07 Remove TransportMasterManager::reconnect_ports().
PortManager::reconnect_ports() covers all ports, and this method was only
used directly after a call to PortManager::reconnect_ports().
2021-11-03 15:15:54 -06:00
Paul Davis 016206e18a Remove all IO code that handled deferred connections
When loading a session, we now just set up port state, which will
populate the Port::_connections member, and then once all ports have
been created, use PortManager::reconnect_ports() to get everything connected.
2021-11-03 15:06:16 -06:00