Commit Graph

375 Commits

Author SHA1 Message Date
Ben Loftis 9651a2c2e2 region groups: more fixes for Duplicate operations 2023-09-27 11:06:40 -05:00
Ben Loftis 72761734e8 region groups: more fixes for drag-copy and range-paste operations 2023-09-27 11:06:40 -05:00
Robin Gareus 496957efdf
Fix layering when copy/pasting regions (1/2)
Playlist::add_region, Playlist::add_region_internal always
adds the region to the top of the playlist, ignoring the
region's layer.

Note that there is also difference between
Region::layer and Region::layering_index.
2023-09-25 22:36:27 +02:00
Ben Loftis 0a12986639
Preserve existing region-group relationships
This solves several issues related to splitting or pasting regions, when
there is more than one layer.

Rather than assign a new group-id for "all the regions on the right of a
split", only ions that had a *prior* group-relationship should be
propagated into the new group.

Signed-off-by: Robin Gareus <robin@gareus.org>
2023-09-22 18:21:34 +02:00
Paul Davis 076cb86912 next iteration of changes to handle time domain bounces as undoable 2023-08-14 23:42:08 -06:00
Ben Loftis fd5dfe27c5
region groups: some operations should implicitly group new regions
* imported regions
* newly-recorded regions
* regions that result from a Split or Separate
* pasted regions
2023-08-10 16:55:25 +02:00
Ben Loftis d1ee95e886
region groups: use group-id instead of equivalent-region, when provided 2023-08-10 16:55:25 +02:00
Paul Davis aa0e882c5f regions: force position time domain when a region is added to a playlist
Q: why not length time domain also?
2023-08-02 15:23:43 -06:00
Paul Davis f1b8a98a62 remove debug output 2023-08-02 15:23:43 -06:00
Paul Davis 3d64972ca2 libardour support for propagating track time domain changes into playlists and thence regions 2023-08-02 15:23:42 -06:00
Paul Davis 4cdac29029 attempt to follow time domain changes in playlists when tracks change 2023-08-02 15:23:42 -06:00
Paul Davis c293876518 playlist IS-A TimeDomainProvider
It has Session as its initial time domain parent
2023-08-02 15:22:52 -06:00
Robin Gareus 884b4f3046
Playlist cut/copy always produces hidden playlists 2023-06-10 03:33:51 +02: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 03e0eea744
Playlist paste, always pastes on top 2023-06-09 00:48:42 +02:00
Robin Gareus c61fc45689
Retain region layering for cut/copy/paste 2023-06-09 00:03:49 +02:00
Robin Gareus d0f5fdb224
Fix deadlock and remove debug message
get_extent() takes a RegionReadLock, but ::partition_internal
already holds a RegionWriteLock (use ::_get_extent)
2023-06-08 21:32:53 +02:00
Robin Gareus c084f74fda
Remove debug message 2023-05-31 18:17:28 +02:00
Robin Gareus f58f5bef55
Remove region from playlist when the source is destroyed
This fixes the following issue:
1. Import a file to a new track
2. Delete the track
3. Editor Source list: select imported file,
   -> Remove the selected source
   -> Yes, remove the Regions and Sources

The Track and Region no longer exist in the Editor,
only the playlist still exists!

The sources to be deleted are found when iterating over whole-file
regions in `EditorSources::remove_selected_sources`. Also
RegionFactory::get_regions_using_source correctly returns
regions, _editor->remove_regions does nothing since there
is no RegionView for the given region(s). This then cashes in

```
libs/ardour/playlist.cc:2400: virtual XMLNode& ARDOUR::Playlist::state(bool) const: Assertion `r->sources ().size () > 0 && r->master_sources ().size () > 0' failed.
```
2023-05-31 15:39:00 +02:00
Robin Gareus 5a0531df01
Sync `all_regions` after region removal
The eventual goal is to keep the set of used regions
in sync, and allow to remove explicit calls to
`sync_all_regions_with_regions`.

This prevents `all_regions` to retain a reference to
a region that has been destroyed.
2023-05-31 01:20:29 +02:00
Robin Gareus bfed3f5d42
NO-OP: white-space 2023-05-31 01:16:15 +02:00
Robin Gareus 331efe835f
Debug region/source removal 2023-05-30 18:19:48 +02:00
Robin Gareus 39ac0c5e19
Remove unused Region::remove_dependents API 2023-05-28 01:52:42 +02:00
Robin Gareus 83555ec290
Consolidate playlist block & ignore notifications
Despite the names suggesting otherwise
`block_notifications` and `ignore_state_changes` are used
for the same purpose.

The only difference is that ::freeze ::thaw explicitly
modified `ignore_state_changes` **in addition** to
`block_notifications`.
2023-05-14 20:42:32 +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 45490bf43f more functional tempo mapping 2023-03-24 14:19:16 -06:00
Paul Davis 1cd1430975 skeleton code for global temporal domain change during tempo mapping 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
Robin Gareus 5453e6f1f7
Fix distance calculation during relayer (#9286)
Due to rounding (r->position_sample() - start.samples())
can become negative even if (r->position () >= start).

with k = start_division and start_division < 0 this
caused an invalid vector access `layers[j-1][k]`.
2023-03-22 01:42:14 +01:00
Paul Davis d93c8d64bc MIDI region combine: fix conceptual errors 2022-10-31 14:22:17 -06:00
David Robillard bdacfb8724 Fix invalid use of Doxygen "@param" command
This is never for inline references to parameters, only for starting parameter
documentation blocks.  The "@p" command is for this, although unfortunately
Doxygen doesn't actually do anything with it and it's just an alias for code
text.
2022-10-30 20:44:28 -04:00
Paul Davis 8d866f58a2 fix mis-use of locally-scopped variable name in auto for loop 2022-10-12 16:51:04 -06:00
Paul Davis 88396347e6 increment/decrement name changes ... out with old in with the new (libs 2022-10-07 17:30:35 -06:00
Paul Davis be9fdd9873 libs: use {de,in}crement_by_domain() instead of {de,in} (libs) 2022-10-07 16:24:46 -06:00
Robin Gareus 8d045e15dc Do not add whole-file regions to playlists
Various operations, notably time-stretch and other filters, directly
added the generated whole-file region to the playlist.
The editor has not listed the generated Region in the RegionList.
2022-10-07 00:36:57 +02:00
Robin Gareus e40f58c106 Inherit Region Properties
This also adds special cases when splitting or splicing locked regions.
2022-10-07 00:36:10 +02:00
Paul Davis 3f812ca1a3 fix behavior of region gain envelope when performing a separate action (2-point split)
This was a simple typo, using pos1 rather than pos2. Also removed now-irrelevant comment line
2022-09-26 16:40:08 -06:00
Robin Gareus 38c5ae4237
Reread MIDI region when time-domain changes
This effectively triggers a Session::request_overwrite_buffer
via Playlist::notify_contents_changed when the time-domain of a
Region changes.

When the time domain of a MIDI region changes, Region boundaries
and events positions change ever so slightly. The playlist has
to be rendered again to take this into account.

When MIDI regions with different time-domains are layered, notes
may not be resolved in correct order. Previously changing time-domains
to address this did not result in the playlist being reread.
2022-09-11 00:57:12 +02:00
Robin Gareus e62f1093ea
Add playlist APIs to find audible regions
This traverses the layered region stack at a given time,
taking both mute and transparency into account.
2022-09-09 17:31:20 +02:00
Paul Davis 9d197c0702 fix copy-n-paste of audio region envelopes and other automation data
Constructing a playlist from another playlist plus an offset used the wrong
RegionFactory::create method. By failing to pass in the offset to the region
constructor, the newly created region gets its envelope (and possibly other
automation data) from the start of the existing region, not its own start.
2022-07-28 18:01:14 -06:00
Paul Davis 39248d682d add ::time_domain() methods to Playlist and Region
These are heuristics based on data type for now. That may evolve over time,
but it's a reasonable place to begin
2022-05-27 15:56:13 -06:00
Paul Davis c8feef51ab convert use of operator* for tim::line types with ::scale(ratio_t) 2022-05-27 12:47:44 -06:00
Ben Loftis a899136cae Fix egregious playlist copy+paste thinko
* when you copy a Range into a playlist, the playlist's 'timeline' should
 begin at the start of the selected Range.  Regions should retain the
 offset they had from the Range's start.
2022-05-13 12:05:04 -05:00
luz paz 1e640563d6
Fix source comment typos in `libs/ardour`
Found via `codespell`
2022-05-11 00:14:28 +02:00
Paul Davis 7bf89ce109 Constification: make Stateful::get_state() const, with all other required const-ness added (libs) 2022-04-06 21:56:59 -06:00
Paul Davis c0eb86b586 hide debug iteration inside #ifdef 2022-04-05 20:52:10 -06:00
Robin Gareus d841b13673
Fix moving automation with region
This issue was introduced in
eae9d276fe
by using the incorrect new nutempo methods for the case at hand.
2022-03-28 19:39:45 +02:00
Paul Davis 54367e5aef playlist: use C++11 style iterators wherever possible 2022-03-14 14:52:46 -06:00
Robin Gareus 1462590ace
Fix setting session-range when regions move
Since cc6c0f1263 there is no Properties::position event
when a region is moved. So notify_region_moved() or
notify_region_start_trimmed() was never emitted and
Session::maybe_update_session_range() was not called.
2022-03-04 22:37:28 +01:00