Commit Graph

1323 Commits

Author SHA1 Message Date
Robin Gareus 6b3f25eb2a
Update Lua instances (2/4)
This is effectively a NO-OP.
2023-10-04 02:48:26 +02:00
Robin Gareus dfd44c2ebf
Fix 3-point edit undo/redo #9464
Playlist::split can result in removal of a region
(adding two others instead). In this case the state
of the removed region (if modified) is not saved.
2023-10-02 03:13:31 +02:00
Mads Kiilerich 80ffa58c81 temporal: introduce Temporal::reset() with TempoMap initialization
Ardour uses some global variables and singletons. These global variables
can be initialized with a value prior to program execution (especially
if they are const), but some of the static variables are modified, and
it is crucial that they always are reset when switching to another
session. To keep things simple and explicit and consistent, we thus
introduce Temporal::reset() to reset TempoMap (and later on also the
superclock rate). This is somewhat similar to Temporal::init(), which
usually only is invoked once (on program start) to initialize singletons
(such as the TempoMap).

9964f20c added TempoMap initialization to Session::create() ... but only
when not using a template. This create method is mainly preparing the
filesystem for a new session, and TempoMap initialization doesn't seem
like a perfect fit for it. It also seemed odd that it only initialized
TempoMap for clean new sessions, while existing sessions and templates
initialized it elsewhere.

Instead, invoke the TempoMap initialization early in the Session
creation process. This might introduce an extra and unnecessary TempoMap
initialization when loading an existing session or using a template, but
that will be cheap and do no harm, while providing a guarantee that we
always use the same default value.
2023-09-20 12:30:53 -06:00
Mads Kiilerich 51333165e8 session: clarify comment about reading sample rate from templates 2023-09-20 12:30:53 -06:00
Robin Gareus f5fabb595a
Section operations need to use audio-time
cut/copy section does copy the tempo-map, so copying
a 4 Bar MIDI section will be 4 Bars after the paste.

This does not work the other way around:
With a tempo-map, 4 bars may correspond to 10 seconds
at the source position. While 4 bars at the target
position may correspond to a different audio-time
duration. This can lead to gaps or overlaps.
2023-09-18 17:14:40 +02:00
Robin Gareus 5c888f2b90
Fix deadlock when cut/pasting section to itself 2023-09-05 23:08:29 +02:00
Paul Davis 69cfe9d3f9 add missing ripple during cut/copy/paste of sections 2023-08-31 18:21:56 -06:00
Paul Davis 7aa1863c0f somewhat working tempo map cut/copy/paste 2023-08-30 14:16:21 -06:00
Paul Davis a5055a2227 various changes related to tempo map copy/cut/paste section
Tempo map is currently still excluded from the editor operation
2023-08-30 14:16:21 -06:00
Paul Davis 076cb86912 next iteration of changes to handle time domain bounces as undoable 2023-08-14 23:42:08 -06:00
Paul Davis 1b9f4999df locations now follow session time domain, always (probably) 2023-08-02 15:23:42 -06:00
Paul Davis df188996ec session has a default time domain 2023-08-02 15:22:52 -06:00
Paul Davis 3b565693c8 objects don't have a time domain, they have a time domain provider (libs) 2023-08-02 15:22:52 -06:00
Paul Davis 2bbf06c8cc class name change to clearly disambiguate Evoral::ControlList (a list of time/value pairs) from lists of Controls in libardour 2023-08-02 15:22:45 -06:00
Robin Gareus 25f5b275f4
Auto-connect metronome when using a device the first time 2023-06-26 21:46:24 +02:00
Paul Davis 50232a23a7 temporal: hide superclock_t variant of TempoMap::metric_at()
This fixes several callsites that were passing samplepos_t to get a TempoMetric,
some of them somewhat significant (e.g. VST plugins that want tempo information).

Bad API design on my part, apologies.

This commit combines libs/ and gtk2_ardour because the new private status
of the ::metric_at() call would be a blocking point for git bisect
2023-06-12 12:36:16 -06:00
Robin Gareus f95c9216b1
Fix playlist use-count 2/2
* Use an atomic reference count since the freeze-thread
  can call use_playlist.
* Remove explicit argument to construct unused playlist
  because playlists are unused by default. This also
  lead to use-count becoming negative (or rather UINT32_MAX)
2023-06-10 03:33:51 +02:00
Robin Gareus ad49de022a
Too many drop-references handlers (#9363)
This fixes a random crash with stop-and-forget capture.

When aborting capture, the disk-writer can emit
 midi_write_source->drop_references ()
in the butler thread, which leads to a direct call to
Session::remove_source.

This can happen before or after Region::source_deleted
is called which is initiated from the same signal.

Furthermore it was possible that Region::source deleted
was called concurrently from the UI thread via SourceRemoved
for whole file regions, which lead to memory corruption.
2023-06-09 16:17:37 +02:00
Robin Gareus 49aa046824
Cut/Copy Section also needs to operate on unused playlists 2023-06-08 20:42:07 +02:00
Robin Gareus 4529a17617
Implement Section Delete/Insert 2023-06-06 02:42:43 +02:00
Robin Gareus ad5d355fb5
Fix remove_source assert()
With empty MIDI regions it can happen that the GUI
still retains a reference (rec_regions)
2023-06-04 21:26:41 +02:00
Robin Gareus f3ee7fdf88
Fix crash when trying to undo region operations across source deletion
Record, move recorded region(s), delete the recorded source, undo.

Undo would undo the region-move, of a region that no longer
exists and has no source.
2023-05-31 15:46:59 +02:00
Robin Gareus f07361b34e
Session::add_source cannot fail 2023-05-31 01:15:28 +02:00
Robin Gareus d7f631757a
Tweak Source removal
* Do not emit signal with source-lock mutex held
* explicitly drop references when called directly; notably from
  EditorSources::remove_selected_sources
2023-05-31 01:14:53 +02:00
Robin Gareus d5cc5b0586
Auto-connect master/monitor when switching backends 2023-05-27 00:08:48 +02:00
Robin Gareus 63e0ac11ad
Prepare cut/copy/paste tempo-map sections
This currently asserts in Range::subtract, also ripple
is not yet implemented.
2023-05-07 02:04:47 +02:00
Robin Gareus 161d82869a
CPM: Implement automatic ctrl-surface activision 2023-05-04 00:20:15 +02:00
Robin Gareus 2bdf51e02d
Implement cut/paste section markers
This does not include partial ranges (selection only
include either range-start or range-end).

Copy/paste also remains to be done
2023-05-02 23:36:51 +02:00
Robin Gareus 4ccaa81671
Fix cut/copy section: ripple requires a region split 2023-04-28 22:55:54 +02:00
Robin Gareus dd969dfe8c
Fix worst-case and I/O latency report
In case there are any unconnected tracks, the track's output is
assumed to align to the master bus (see Route::update_signal_latency).

For this to work correctly the master bus port's public latency
has to be set first.

This fixes e.g. the following issue: add a latent plugin to
the monitor section. Then toggle its bypass or remove it.
Previously the worst-case latency remained unchanged.
2023-04-27 01:43:20 +02:00
Damien Zammit 4620d138ee import_pt: Look up tracks by name instead of by number
This allows existing tracks with correct names to be the target for import.
2023-04-22 10:09:55 +10:00
Paul Davis 909a2ad639 Revert "modify API of MIDI Clock ticker to use ProcessedRange"
This reverts commit 720102f98a.
2023-04-18 13:48:59 -06:00
Robin Gareus dde366d6ef
Fix Wreturn-std-move 2023-04-09 00:52:29 +02:00
Robin Gareus 295dbd8e1e
Make RCU reader return a const pointer (omnibus commit) 2023-04-08 00:15:37 +02:00
Robin Gareus f3e13848fa
Do not modify read-only RCU copy of routelist
RCU reader returns a shared ptr to the current object which
can also be used in other places at the same time.

Sorting the shared-ptr list invalidates iterators which can
throw off other users of the same object.

This fixes a bug in PT-import which calls get_nth_audio_track().
2023-04-07 19:37:30 +02:00
Robin Gareus 8b59bf47df
Add a dedicated PlaylistSet type
This is to consolidate various locations that use
`typedef std::set<std::shared_ptr<Playlist>>`
throughout the codebase.
2023-04-06 02:12:32 +02:00
Paul Davis 720102f98a modify API of MIDI Clock ticker to use ProcessedRange
This solves the faulty MClk output when we locate due to a loop end.
2023-03-24 14:19:16 -06:00
Paul Davis a486fba3e9 std::atomic - 2nd batch of changes to convert from glib to std::atomic 2023-03-24 14:19:15 -06:00
Paul Davis 4ba4cd69ff switch from glib atomic to std::atomic (libs edition) 2023-03-24 14:19:15 -06:00
Paul Davis b35518e212 switch from boost::{shared,weak}_ptr to std::{shared,weak}_ptr
This is mostly a simple lexical search+replace but the absence of operator< for
std::weak_ptr<T> leads to some complications, particularly with Evoral::Sequence
and ExportPortChannel.
2023-03-24 14:19:15 -06:00
Marijn Kruisselbrink 8810c36c6e
Fix audio source names when importing files with > 2 and <= 26 channels.
This code presumably intended to name sources "foo%a", "foo%b" etc, but
since it was incorrectly appending the character as an integer sources
instead ended up being named "foo%97", "foo%98" etc.

Also changes the branching logic to use this branch upto 26 channels,
rather than just upto 25 channels, as that seems to have been the
intention.
2023-03-11 18:53:26 +01:00
Robin Gareus 339d3e1265
Drop another debug message 2023-03-09 18:23:20 +01:00
Paul Davis 27205c7639 midi clock: provide option to quantize incoming BPM values 2023-02-23 12:15:26 -07:00
Paul Davis e430d13d53 midi clock: allow user to "quantize" MIDI clock resolution 2023-02-23 10:17:47 -07:00
Robin Gareus 054e1c3c12
Retain pending state after recovery (#9215)
After recovering from a crash, the user still needs to
retain the option to ignore the changes that were done
just before the crash after investigating them (or save them
into a snapshot).

Previously crash recovery unconditionally overwrote the
session file (see discussion on bug tracker).
2023-02-03 07:50:32 +01:00
Robin Gareus 72995741bb
Adjust resampler quality when sample-rate mismatches
This also ensures that engine/session resampling is possible
when the config `port-resampler-quality` is 0.
2023-01-31 01:07:04 +01:00
Robin Gareus d89162745f
Consolidate base and nominal SR
Now that mismatched sample-rates are resampled, there is
no distinction between base and nominal sample-rate.
2023-01-31 00:54:28 +01:00
Robin Gareus 349d25a2d2 Update latency compensation when sends are added or removed
Previously only adding an aux-send triggered a graph-reorder but copying
or deleting sends did nothing.

Adding/removing an aux-send may not even change the graph, but
both upstream/downstream latency can change and delaylines need to be
configured (which is done by calling update_latency_compensation with
force_whole_graph = true).

This fixes an issue with incorrect initial latency compensation after
copying a send (any later change to connections will correctly
recalculate it).
2023-01-27 23:13:52 +01:00
Robin Gareus 38c613cd9a Towards arranging sections
This allows to move or copy whole sections of the timline (everything
you hear) to a differnt position on the timeline.

NB. Markers and tempo-map are not yet moved, and interpolated MIDI
events are lost.
2023-01-23 04:07:46 +01:00
Robin Gareus 79033d8ee5 Resample when engine and session sample-rates mismatch 2023-01-22 20:51:44 +01:00