From 0c4c6e031a3624cfc74c2eef6e79527b7c49eca8 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Thu, 9 Nov 2006 20:38:39 +0000 Subject: first pass on track mode switch; fixes to dangling region refs after capture; destroy region menu item removed; small fix to SConstruct for missing C++ case; playlist selection mechanism modified ; new Selection operation added (Add); handle crashing situation with align style change handling caused by recursion git-svn-id: svn://localhost/ardour2/trunk@1099 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/SConscript | 1 - libs/ardour/ardour/audio_diskstream.h | 3 ++ libs/ardour/ardour/audio_track.h | 2 + libs/ardour/ardour/audioregion.h | 2 + libs/ardour/ardour/diskstream.h | 5 ++- libs/ardour/ardour/playlist.h | 17 ++++----- libs/ardour/ardour/region.h | 5 +-- libs/ardour/ardour/session.h | 5 ++- libs/ardour/ardour/source.h | 12 ++++++ libs/ardour/ardour/track.h | 8 ++-- libs/ardour/audio_diskstream.cc | 71 +++++++++++++++++++++++++++++++++-- libs/ardour/audio_playlist.cc | 21 +++++++++-- libs/ardour/audio_track.cc | 17 +++++++++ libs/ardour/audioregion.cc | 41 ++++++++++++++++++-- libs/ardour/diskstream.cc | 16 ++++---- libs/ardour/playlist.cc | 28 ++++++++++---- libs/ardour/region_factory.cc | 3 +- libs/ardour/session.cc | 54 +++++++++++++++++--------- libs/ardour/session_state.cc | 3 +- libs/ardour/sndfilesource.cc | 6 ++- libs/ardour/source.cc | 24 ++++++++++++ libs/ardour/track.cc | 12 ------ libs/gtkmm2ext/barcontroller.cc | 1 + 23 files changed, 277 insertions(+), 80 deletions(-) (limited to 'libs') diff --git a/libs/ardour/SConscript b/libs/ardour/SConscript index 8c6bd36c2d..7d1520a98c 100644 --- a/libs/ardour/SConscript +++ b/libs/ardour/SConscript @@ -274,7 +274,6 @@ if env['NLS']: env.Alias('install', env.Install(os.path.join(install_prefix, 'lib/ardour2'), libardour)) -env.AlwaysBuild ('version.cc') env.Alias('version', ardour.VersionBuild(['version.cc', 'ardour/version.h'], 'SConscript')) env.Alias('tarball', env.Distribute (env['DISTTREE'], diff --git a/libs/ardour/ardour/audio_diskstream.h b/libs/ardour/ardour/audio_diskstream.h index 4dee5e9b00..74c804e5bb 100644 --- a/libs/ardour/ardour/audio_diskstream.h +++ b/libs/ardour/ardour/audio_diskstream.h @@ -77,6 +77,7 @@ class AudioDiskstream : public Diskstream } void set_record_enabled (bool yn); + int set_destructive (bool yn); float peak_power(uint32_t n=0) { float x = channels[n].peak_power; @@ -251,6 +252,8 @@ class AudioDiskstream : public Diskstream typedef vector ChannelList; ChannelList channels; + + bool can_become_destructive () const; }; } // namespace ARDOUR diff --git a/libs/ardour/ardour/audio_track.h b/libs/ardour/ardour/audio_track.h index 66fcd16a56..ae299dae4a 100644 --- a/libs/ardour/ardour/audio_track.h +++ b/libs/ardour/ardour/audio_track.h @@ -37,6 +37,8 @@ class AudioTrack : public Track AudioTrack (Session&, const XMLNode&); ~AudioTrack (); + int set_mode (TrackMode m); + int roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame, nframes_t offset, int declick, bool can_record, bool rec_monitors_input); diff --git a/libs/ardour/ardour/audioregion.h b/libs/ardour/ardour/audioregion.h index 4be5d27a6b..b739935d96 100644 --- a/libs/ardour/ardour/audioregion.h +++ b/libs/ardour/ardour/audioregion.h @@ -136,6 +136,8 @@ class AudioRegion : public Region void resume_fade_in (); void resume_fade_out (); + void set_playlist (Playlist *); + private: friend class RegionFactory; diff --git a/libs/ardour/ardour/diskstream.h b/libs/ardour/ardour/diskstream.h index 0afed75348..4cee6d1268 100644 --- a/libs/ardour/ardour/diskstream.h +++ b/libs/ardour/ardour/diskstream.h @@ -90,7 +90,7 @@ class IO; virtual void set_record_enabled (bool yn) = 0; bool destructive() const { return _flags & Destructive; } - virtual void set_destructive (bool yn); + virtual int set_destructive (bool yn) { return -1; } bool hidden() const { return _flags & Hidden; } bool recordable() const { return _flags & Recordable; } @@ -138,6 +138,8 @@ class IO; void handle_input_change (IOChange, void *src); + void remove_region_from_last_capture (boost::weak_ptr wregion); + sigc::signal RecordEnableChanged; sigc::signal SpeedChanged; sigc::signal ReverseChanged; @@ -224,6 +226,7 @@ class IO; virtual bool realtime_set_speed (double, bool global_change); std::list > _last_capture_regions; + virtual int use_pending_capture_data (XMLNode& node) = 0; virtual void get_input_sources () = 0; diff --git a/libs/ardour/ardour/playlist.h b/libs/ardour/ardour/playlist.h index 9cc3f86f0b..7b9ae718bc 100644 --- a/libs/ardour/ardour/playlist.h +++ b/libs/ardour/ardour/playlist.h @@ -62,14 +62,15 @@ class Playlist : public PBD::StatefulDestructible { void unref(); uint32_t refcnt() const { return _refcnt; } - const string& name() const { return _name; } - void set_name (const string& str); + std::string name() const { return _name; } + void set_name (std::string str); bool frozen() const { return _frozen; } void set_frozen (bool yn); bool hidden() const { return _hidden; } bool empty() const; + uint32_t n_regions() const; nframes_t get_maximum_extent () const; layer_t top_layer() const; @@ -88,19 +89,15 @@ class Playlist : public PBD::StatefulDestructible { void duplicate (boost::shared_ptr, nframes_t position, float times); void nudge_after (nframes_t start, nframes_t distance, bool forwards); - boost::shared_ptr find_region (const PBD::ID&) const; - Playlist* cut (list&, bool result_is_hidden = true); Playlist* copy (list&, bool result_is_hidden = true); int paste (Playlist&, nframes_t position, float times); - uint32_t read_data_count() { return _read_data_count; } - - RegionList* regions_at (nframes_t frame); - RegionList* regions_touched (nframes_t start, nframes_t end); + RegionList* regions_at (nframes_t frame); + RegionList* regions_touched (nframes_t start, nframes_t end); + boost::shared_ptr find_region (const PBD::ID&) const; boost::shared_ptr top_region_at (nframes_t frame); - - boost::shared_ptr find_next_region (nframes_t frame, RegionPoint point, int dir); + boost::shared_ptr find_next_region (nframes_t frame, RegionPoint point, int dir); template void foreach_region (T *t, void (T::*func)(boost::shared_ptr, void *), void *arg); template void foreach_region (T *t, void (T::*func)(boost::shared_ptr)); diff --git a/libs/ardour/ardour/region.h b/libs/ardour/ardour/region.h index 67e00d0ee8..7f511c4dd4 100644 --- a/libs/ardour/ardour/region.h +++ b/libs/ardour/ardour/region.h @@ -163,10 +163,7 @@ class Region : public PBD::StatefulDestructible, public boost::enable_shared_fro ARDOUR::Playlist* playlist() const { return _playlist; } - void set_playlist (ARDOUR::Playlist*); - - virtual void lock_sources () {} - virtual void unlock_sources () {} + virtual void set_playlist (ARDOUR::Playlist*); /* serialization */ diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index 85c0ef508c..93c093ec85 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -542,8 +542,8 @@ class Session : public PBD::StatefulDestructible /* region info */ - sigc::signal > AudioRegionAdded; - sigc::signal > AudioRegionRemoved; + sigc::signal > AudioRegionAdded; + sigc::signal > AudioRegionRemoved; int region_name (string& result, string base = string(""), bool newlevel = false) const; string new_region_name (string); @@ -630,6 +630,7 @@ class Session : public PBD::StatefulDestructible uint32_t n_playlists() const; template void foreach_playlist (T *obj, void (T::*func)(Playlist *)); + void get_playlists (std::vector&); /* named selections */ diff --git a/libs/ardour/ardour/source.h b/libs/ardour/ardour/source.h index 7e05e628ac..15e814e946 100644 --- a/libs/ardour/ardour/source.h +++ b/libs/ardour/ardour/source.h @@ -22,6 +22,7 @@ #define __ardour_source_h__ #include +#include #include @@ -32,6 +33,7 @@ namespace ARDOUR { class Session; +class Playlist; class Source : public PBD::StatefulDestructible { @@ -49,13 +51,23 @@ class Source : public PBD::StatefulDestructible XMLNode& get_state (); int set_state (const XMLNode&); + void use () { _in_use++; } + void disuse () { if (_in_use) { _in_use--; } } + + void add_playlist (ARDOUR::Playlist*); + void remove_playlist (ARDOUR::Playlist*); + + uint32_t used() const; protected: Session& _session; string _name; time_t _timestamp; + std::set _playlists; + private: + uint32_t _in_use; }; } diff --git a/libs/ardour/ardour/track.h b/libs/ardour/ardour/track.h index cf380de153..a24b614157 100644 --- a/libs/ardour/ardour/track.h +++ b/libs/ardour/ardour/track.h @@ -39,6 +39,10 @@ class Track : public Route int set_name (string str, void *src); + TrackMode mode () const { return _mode; } + virtual int set_mode (TrackMode m) { return false; } + sigc::signal TrackModeChanged; + virtual int roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame, nframes_t offset, int declick, bool can_record, bool rec_monitors_input) = 0; @@ -57,9 +61,6 @@ class Track : public Route virtual int use_diskstream (string name) = 0; virtual int use_diskstream (const PBD::ID& id) = 0; - TrackMode mode() const { return _mode; } - void set_mode (TrackMode m); - nframes_t update_total_latency(); void set_latency_delay (nframes_t); @@ -88,7 +89,6 @@ class Track : public Route void set_meter_point (MeterPoint, void* src); - sigc::signal ModeChanged; sigc::signal DiskstreamChanged; sigc::signal FreezeChange; diff --git a/libs/ardour/audio_diskstream.cc b/libs/ardour/audio_diskstream.cc index ad9fec2d41..7e753fa601 100644 --- a/libs/ardour/audio_diskstream.cc +++ b/libs/ardour/audio_diskstream.cc @@ -381,7 +381,7 @@ AudioDiskstream::setup_destructive_playlist () void AudioDiskstream::use_destructive_playlist () { - /* this is called from the XML-based constructor. when its done, + /* this is called from the XML-based constructor or ::set_destructive. when called, we already have a playlist and a region, but we need to set up our sources for write. we use the sources associated with the (presumed single, full-extent) region. @@ -400,6 +400,10 @@ AudioDiskstream::use_destructive_playlist () throw failed_constructor(); } + /* be sure to stretch the region out to the maximum length */ + + region->set_length (max_frames - region->position(), this); + uint32_t n; ChannelList::iterator chan; @@ -407,6 +411,10 @@ AudioDiskstream::use_destructive_playlist () (*chan).write_source = boost::dynamic_pointer_cast(region->source (n)); assert((*chan).write_source); (*chan).write_source->set_allow_remove_if_empty (false); + + /* this might be false if we switched modes, so force it */ + + (*chan).write_source->set_destructive (true); } /* the source list will never be reset for a destructive track */ @@ -1584,9 +1592,9 @@ AudioDiskstream::transport_stopped (struct tm& when, time_t twhen, bool abort_ca continue; /* XXX is this OK? */ } - _last_capture_regions.push_back (region); + region->GoingAway.connect (bind (mem_fun (*this, &Diskstream::remove_region_from_last_capture), boost::weak_ptr(region))); - // cerr << "add new region, buffer position = " << buffer_position << " @ " << (*ci)->start << endl; + _last_capture_regions.push_back (region); i_am_the_modifier++; _playlist->add_region (region, (*ci)->start); @@ -2228,3 +2236,60 @@ AudioDiskstream::use_pending_capture_data (XMLNode& node) return 0; } + +int +AudioDiskstream::set_destructive (bool yn) +{ + if (yn != destructive()) { + + if (yn) { + if (!can_become_destructive ()) { + return -1; + } + _flags |= Destructive; + use_destructive_playlist (); + } else { + _flags &= ~Destructive; + reset_write_sources (true, true); + } + } + + return 0; +} + +bool +AudioDiskstream::can_become_destructive () const +{ + if (!_playlist) { + return false; + } + + /* is there only one region ? */ + + if (_playlist->n_regions() != 1) { + return false; + } + + boost::shared_ptr first = _playlist->find_next_region (_session.current_start_frame(), Start, 1); + assert (first); + + /* do the source(s) for the region cover the session start position ? */ + + if (first->position() != _session.current_start_frame()) { + if (first->start() > _session.current_start_frame()) { + return false; + } + } + + /* is the source used by only 1 playlist ? */ + + boost::shared_ptr afirst = boost::dynamic_pointer_cast (first); + + assert (afirst); + + if (afirst->source()->used() > 1) { + return false; + } + + return true; +} diff --git a/libs/ardour/audio_playlist.cc b/libs/ardour/audio_playlist.cc index 290907746b..5118aab684 100644 --- a/libs/ardour/audio_playlist.cc +++ b/libs/ardour/audio_playlist.cc @@ -624,12 +624,10 @@ AudioPlaylist::destroy_region (boost::shared_ptr region) { RegionLock rlock (this); - RegionList::iterator i; - RegionList::iterator tmp; - for (i = regions.begin(); i != regions.end(); ) { + for (RegionList::iterator i = regions.begin(); i != regions.end(); ) { - tmp = i; + RegionList::iterator tmp = i; ++tmp; if ((*i) == region) { @@ -639,6 +637,21 @@ AudioPlaylist::destroy_region (boost::shared_ptr region) i = tmp; } + + for (set >::iterator x = all_regions.begin(); x != all_regions.end(); ) { + + set >::iterator xtmp = x; + ++xtmp; + + if ((*x) == region) { + all_regions.erase (x); + changed = true; + } + + x = xtmp; + } + + region->set_playlist (0); } for (c = _crossfades.begin(); c != _crossfades.end(); ) { diff --git a/libs/ardour/audio_track.cc b/libs/ardour/audio_track.cc index 23ece02fa8..9c5020e9aa 100644 --- a/libs/ardour/audio_track.cc +++ b/libs/ardour/audio_track.cc @@ -72,6 +72,23 @@ AudioTrack::~AudioTrack () { } +int +AudioTrack::set_mode (TrackMode m) +{ + if (m != _mode) { + + if (_diskstream->set_destructive (m == Destructive)) { + return -1; + } + + _mode = m; + + TrackModeChanged (); /* EMIT SIGNAL */ + } + + return 0; +} + int AudioTrack::deprecated_use_diskstream_connections () { diff --git a/libs/ardour/audioregion.cc b/libs/ardour/audioregion.cc index 2f0ae03f2d..a3ba886e38 100644 --- a/libs/ardour/audioregion.cc +++ b/libs/ardour/audioregion.cc @@ -306,6 +306,12 @@ AudioRegion::AudioRegion (SourceList& srcs, const XMLNode& node) AudioRegion::~AudioRegion () { + if (_playlist) { + for (SourceList::const_iterator i = sources.begin(); i != sources.end(); ++i) { + (*i)->remove_playlist (_playlist); + } + } + notify_callbacks (); GoingAway (); /* EMIT SIGNAL */ } @@ -1145,8 +1151,6 @@ AudioRegion::exportme (Session& session, AudioExportSpecification& spec) boost::shared_ptr AudioRegion::get_parent() { - boost::shared_ptr r; - if (_playlist) { boost::shared_ptr ar; boost::shared_ptr grrr2 = boost::dynamic_pointer_cast (shared_from_this()); @@ -1156,7 +1160,7 @@ AudioRegion::get_parent() } } - return r; + return boost::shared_ptr(); } void @@ -1305,6 +1309,37 @@ AudioRegion::source_offset_changed () } } +void +AudioRegion::set_playlist (Playlist* pl) +{ + if (pl == _playlist) { + return; + } + + Playlist* old_playlist = _playlist; + + Region::set_playlist (pl); + + if (pl) { + if (old_playlist) { + for (SourceList::const_iterator i = sources.begin(); i != sources.end(); ++i) { + (*i)->remove_playlist (old_playlist); + (*i)->add_playlist (_playlist); + } + } else { + for (SourceList::const_iterator i = sources.begin(); i != sources.end(); ++i) { + (*i)->add_playlist (_playlist); + } + } + } else { + if (old_playlist) { + for (SourceList::const_iterator i = sources.begin(); i != sources.end(); ++i) { + (*i)->remove_playlist (old_playlist); + } + } + } +} + extern "C" { int region_read_peaks_from_c (void *arg, uint32_t npeaks, uint32_t start, uint32_t cnt, intptr_t data, uint32_t n_chan, double samples_per_unit) diff --git a/libs/ardour/diskstream.cc b/libs/ardour/diskstream.cc index 9e83c5e21a..7b3db9aab4 100644 --- a/libs/ardour/diskstream.cc +++ b/libs/ardour/diskstream.cc @@ -392,14 +392,14 @@ Diskstream::set_name (string str) } void -Diskstream::set_destructive (bool yn) +Diskstream::remove_region_from_last_capture (boost::weak_ptr wregion) { - if (yn != destructive()) { - reset_write_sources (true, true); - if (yn) { - _flags |= Destructive; - } else { - _flags &= ~Destructive; - } + boost::shared_ptr region (wregion.lock()); + + if (!region) { + return; } + + _last_capture_regions.remove (region); } + diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc index 713558f15e..a06fe2b5fd 100644 --- a/libs/ardour/playlist.cc +++ b/libs/ardour/playlist.cc @@ -85,10 +85,8 @@ Playlist::Playlist (Session& sess, const XMLNode& node, bool hide) { init (hide); _name = "unnamed"; /* reset by set_state */ - - if (set_state (node)) { - throw failed_constructor(); - } + + /* derived class calls set_state() */ } Playlist::Playlist (const Playlist& other, string namestr, bool hide) @@ -257,11 +255,19 @@ Playlist::Playlist (Playlist& pl) Playlist::~Playlist () { + { + RegionLock rl (this); + + for (set >::iterator i = all_regions.begin(); i != all_regions.end(); ++i) { + (*i)->set_playlist (0); + } + } + /* GoingAway must be emitted by derived classes */ } void -Playlist::set_name (const string& str) +Playlist::set_name (string str) { /* in a typical situation, a playlist is being used by one diskstream and also is referenced by the @@ -1442,13 +1448,21 @@ Playlist::state (bool full_state) bool Playlist::empty() const { + RegionLock rlock (const_cast(this), false); return regions.empty(); } +uint32_t +Playlist::n_regions() const +{ + RegionLock rlock (const_cast(this), false); + return regions.size(); +} + nframes_t Playlist::get_maximum_extent () const { - RegionLock rlock (const_cast(this)); + RegionLock rlock (const_cast(this), false); return _get_maximum_extent (); } @@ -1475,7 +1489,7 @@ Playlist::bump_name (string name, Session &session) do { newname = Playlist::bump_name_once (newname); - } while (session.playlist_by_name(newname)!=NULL); + } while (session.playlist_by_name (newname)!=NULL); return newname; } diff --git a/libs/ardour/region_factory.cc b/libs/ardour/region_factory.cc index 313bb31f2a..5bcbdb8b80 100644 --- a/libs/ardour/region_factory.cc +++ b/libs/ardour/region_factory.cc @@ -93,8 +93,7 @@ RegionFactory::create (Session& session, XMLNode& node, bool yn) boost::shared_ptr RegionFactory::create (SourceList& srcs, nframes_t start, nframes_t length, const string& name, layer_t layer, Region::Flag flags, bool announce) { - AudioRegion* ar = new AudioRegion (srcs, start, length, name, layer, flags); - boost::shared_ptr arp (ar); + boost::shared_ptr arp (new AudioRegion (srcs, start, length, name, layer, flags)); boost::shared_ptr ret (boost::static_pointer_cast (arp)); if (announce) { CheckNewRegion (ret); diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index b2705c2cbd..a4def58bb4 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -2535,7 +2535,7 @@ Session::remove_region (boost::weak_ptr weak_region) set_dirty(); if (removed) { - AudioRegionRemoved(ar); /* EMIT SIGNAL */ + AudioRegionRemoved (ar); /* EMIT SIGNAL */ } } @@ -2571,32 +2571,38 @@ Session::find_equivalent_playlist_regions (boost::shared_ptr region, vec int Session::destroy_region (boost::shared_ptr region) { - boost::shared_ptr aregion; - - if ((aregion = boost::dynamic_pointer_cast (region)) == 0) { - return 0; - } - - if (aregion->playlist()) { - aregion->playlist()->destroy_region (region); - } - vector > srcs; - - for (uint32_t n = 0; n < aregion->n_channels(); ++n) { - srcs.push_back (aregion->source (n)); + + { + boost::shared_ptr aregion; + + if ((aregion = boost::dynamic_pointer_cast (region)) == 0) { + return 0; + } + + if (aregion->playlist()) { + aregion->playlist()->destroy_region (region); + } + + for (uint32_t n = 0; n < aregion->n_channels(); ++n) { + srcs.push_back (aregion->source (n)); + } } + region->drop_references (); + for (vector >::iterator i = srcs.begin(); i != srcs.end(); ++i) { - - if ((*i).use_count() == 1) { - boost::shared_ptr afs = boost::dynamic_pointer_cast(*i); + if (!(*i)->used()) { + boost::shared_ptr afs = boost::dynamic_pointer_cast(*i); + if (afs) { (afs)->mark_for_remove (); } (*i)->drop_references (); + + cerr << "source was not used by any playlist\n"; } } @@ -2988,6 +2994,20 @@ Session::add_playlist (Playlist* playlist) PlaylistAdded (playlist); /* EMIT SIGNAL */ } +void +Session::get_playlists (vector& s) +{ + { + Glib::Mutex::Lock lm (playlist_lock); + for (PlaylistList::iterator i = playlists.begin(); i != playlists.end(); ++i) { + s.push_back (*i); + } + for (PlaylistList::iterator i = unused_playlists.begin(); i != unused_playlists.end(); ++i) { + s.push_back (*i); + } + } +} + void Session::track_playlist (Playlist* pl, bool inuse) { diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index 763f8b9c01..f80c9e9a82 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -520,7 +520,6 @@ Session::create (bool& new_session, string* mix_template, nframes_t initial_leng _state_of_the_state = Clean; if (save_state (_current_snapshot_name)) { - save_history (_current_snapshot_name); return -1; } @@ -2456,6 +2455,8 @@ Session::cleanup_sources (Session::cleanup_report& rep) capture files. */ + cerr << "checking out source " << i->second->name() << " use_count = " << i->second.use_count() << endl; + if (i->second.use_count() == 1 && i->second->length() > 0) { dead_sources.push_back (i->second); diff --git a/libs/ardour/sndfilesource.cc b/libs/ardour/sndfilesource.cc index 3c3798c8ab..4b9c7ff33b 100644 --- a/libs/ardour/sndfilesource.cc +++ b/libs/ardour/sndfilesource.cc @@ -212,7 +212,7 @@ SndFileSource::init (string idstr) _capture_end = false; file_pos = 0; - if (destructive()) { + if (destructive()) { xfade_buf = new Sample[xfade_frames]; timeline_position = header_position_offset; } @@ -680,11 +680,15 @@ SndFileSource::set_destructive (bool yn) { if (yn) { _flags = Flag (_flags | Destructive); + if (!xfade_buf) { + xfade_buf = new Sample[xfade_frames]; + } clear_capture_marks (); timeline_position = header_position_offset; } else { _flags = Flag (_flags & ~Destructive); timeline_position = 0; + /* leave xfade buf alone in case we need it again later */ } return true; diff --git a/libs/ardour/source.cc b/libs/ardour/source.cc index 7ade8a8573..74ca0afcd4 100644 --- a/libs/ardour/source.cc +++ b/libs/ardour/source.cc @@ -34,6 +34,7 @@ #include #include +#include #include "i18n.h" @@ -47,12 +48,14 @@ Source::Source (Session& s, string name) { _name = name; _timestamp = 0; + _in_use = 0; } Source::Source (Session& s, const XMLNode& node) : _session (s) { _timestamp = 0; + _in_use = 0; if (set_state (node)) { throw failed_constructor(); @@ -106,3 +109,24 @@ Source::set_state (const XMLNode& node) return 0; } +void +Source::add_playlist (Playlist* pl) +{ + _playlists.insert (pl); +} + +void +Source::remove_playlist (Playlist* pl) +{ + std::set::iterator x; + + if ((x = _playlists.find (pl)) != _playlists.end()) { + _playlists.erase (x); + } +} + +uint32_t +Source::used () const +{ + return _playlists.size(); +} diff --git a/libs/ardour/track.cc b/libs/ardour/track.cc index 2c3d7c9151..95e21e6735 100644 --- a/libs/ardour/track.cc +++ b/libs/ardour/track.cc @@ -183,18 +183,6 @@ Track::set_record_enable (bool yn, void *src) _rec_enable_control.Changed (); } -void -Track::set_mode (TrackMode m) -{ - if (_diskstream) { - if (_mode != m) { - _mode = m; - _diskstream->set_destructive (m == Destructive); - ModeChanged(); - } - } -} - int Track::set_name (string str, void *src) { diff --git a/libs/gtkmm2ext/barcontroller.cc b/libs/gtkmm2ext/barcontroller.cc index eefe6ca843..734c4b77e2 100644 --- a/libs/gtkmm2ext/barcontroller.cc +++ b/libs/gtkmm2ext/barcontroller.cc @@ -423,6 +423,7 @@ BarController::switch_to_spinner () remove (); add (spinner); spinner.show (); + spinner.select_region (0, spinner.get_text_length()); spinner.grab_focus (); switching = false; -- cgit v1.2.3