mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-21 06:06:25 +01:00
Better version of previous commit
This commit is contained in:
parent
9d063943bb
commit
d2916a1df8
2 changed files with 16 additions and 7 deletions
|
|
@ -450,6 +450,7 @@ private:
|
||||||
mutable Glib::Threads::RWLock region_lock;
|
mutable Glib::Threads::RWLock region_lock;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void freeze_locked ();
|
||||||
void setup_layering_indices (RegionList const&);
|
void setup_layering_indices (RegionList const&);
|
||||||
void coalesce_and_check_crossfades (std::list<Evoral::Range<samplepos_t> >);
|
void coalesce_and_check_crossfades (std::list<Evoral::Range<samplepos_t> >);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -453,6 +453,12 @@ Playlist::freeze ()
|
||||||
* before beginning to modify the playlist.
|
* before beginning to modify the playlist.
|
||||||
*/
|
*/
|
||||||
RegionWriteLock rlock (this);
|
RegionWriteLock rlock (this);
|
||||||
|
freeze_locked ();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Playlist::freeze_locked ()
|
||||||
|
{
|
||||||
delay_notifications ();
|
delay_notifications ();
|
||||||
g_atomic_int_inc (&ignore_state_changes);
|
g_atomic_int_inc (&ignore_state_changes);
|
||||||
}
|
}
|
||||||
|
|
@ -2224,9 +2230,9 @@ Playlist::update (const RegionListProperty::ChangeRecord& change)
|
||||||
DEBUG_TRACE (DEBUG::Properties, string_compose ("Playlist %1 updates from a change record with %2 adds %3 removes\n",
|
DEBUG_TRACE (DEBUG::Properties, string_compose ("Playlist %1 updates from a change record with %2 adds %3 removes\n",
|
||||||
name (), change.added.size (), change.removed.size ()));
|
name (), change.added.size (), change.removed.size ()));
|
||||||
|
|
||||||
freeze ();
|
|
||||||
{
|
{
|
||||||
RegionWriteLock rlock (this);
|
RegionWriteLock rlock (this);
|
||||||
|
freeze_locked ();
|
||||||
/* add the added regions */
|
/* add the added regions */
|
||||||
for (RegionListProperty::ChangeContainer::const_iterator i = change.added.begin (); i != change.added.end (); ++i) {
|
for (RegionListProperty::ChangeContainer::const_iterator i = change.added.begin (); i != change.added.end (); ++i) {
|
||||||
add_region_internal ((*i), (*i)->position (), rlock.thawlist);
|
add_region_internal ((*i), (*i)->position (), rlock.thawlist);
|
||||||
|
|
@ -2993,15 +2999,17 @@ Playlist::ripple (samplepos_t at, samplecnt_t distance, RegionList* exclude)
|
||||||
void
|
void
|
||||||
Playlist::update_after_tempo_map_change ()
|
Playlist::update_after_tempo_map_change ()
|
||||||
{
|
{
|
||||||
freeze ();
|
{
|
||||||
|
|
||||||
RegionWriteLock rlock (const_cast<Playlist*> (this));
|
RegionWriteLock rlock (const_cast<Playlist*> (this));
|
||||||
RegionList copy (regions.rlist ());
|
RegionList copy (regions.rlist ());
|
||||||
|
|
||||||
|
freeze_locked ();
|
||||||
|
|
||||||
for (RegionList::iterator i = copy.begin (); i != copy.end (); ++i) {
|
for (RegionList::iterator i = copy.begin (); i != copy.end (); ++i) {
|
||||||
rlock.thawlist.add (*i);
|
rlock.thawlist.add (*i);
|
||||||
(*i)->update_after_tempo_map_change ();
|
(*i)->update_after_tempo_map_change ();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/* possibly causes a contents changed notification (flush_notifications()) */
|
/* possibly causes a contents changed notification (flush_notifications()) */
|
||||||
thaw ();
|
thaw ();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue