diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2006-05-31 02:46:04 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2006-05-31 02:46:04 +0000 |
commit | 415d3a5018738287c9175d84ce8346a7b47da4ff (patch) | |
tree | 6b4600a2045f493978a0409d68c6975f16ada401 /libs/ardour | |
parent | 0354401e0016060701cf4869557cff3004511733 (diff) |
unfinished work on selection/HiG details, restore range ops destroyed by autoscroll changes
git-svn-id: svn://localhost/trunk/ardour2@544 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour')
-rw-r--r-- | libs/ardour/ardour/audioregion.h | 9 | ||||
-rw-r--r-- | libs/ardour/ardour/configuration_vars.h | 3 | ||||
-rw-r--r-- | libs/ardour/ardour/location.h | 3 | ||||
-rw-r--r-- | libs/ardour/audio_playlist.cc | 10 | ||||
-rw-r--r-- | libs/ardour/audioregion.cc | 16 | ||||
-rw-r--r-- | libs/ardour/location.cc | 74 | ||||
-rw-r--r-- | libs/ardour/utils.cc | 9 |
7 files changed, 109 insertions, 15 deletions
diff --git a/libs/ardour/ardour/audioregion.h b/libs/ardour/ardour/audioregion.h index a146a20417..f210fa595b 100644 --- a/libs/ardour/ardour/audioregion.h +++ b/libs/ardour/ardour/audioregion.h @@ -75,10 +75,11 @@ class AudioRegion : public Region AudioRegion (SourceList &, const XMLNode&); ~AudioRegion(); - bool region_list_equivalent (const AudioRegion&); - bool source_equivalent (const AudioRegion&); - bool equivalent (const AudioRegion&); - bool size_equivalent (const AudioRegion&); + bool region_list_equivalent (const AudioRegion&) const ; + bool source_equivalent (const AudioRegion&) const; + bool equivalent (const AudioRegion&) const; + bool size_equivalent (const AudioRegion&) const; + bool overlap_equivalent (const AudioRegion&) const; bool speed_mismatch (float) const; diff --git a/libs/ardour/ardour/configuration_vars.h b/libs/ardour/ardour/configuration_vars.h index 65ede9886b..85c7897026 100644 --- a/libs/ardour/ardour/configuration_vars.h +++ b/libs/ardour/ardour/configuration_vars.h @@ -42,12 +42,13 @@ CONFIG_VARIABLE(HeaderFormat, native_file_header_format, "native-file-header-fo CONFIG_VARIABLE(bool, use_tranzport, "use-tranzport", false) CONFIG_VARIABLE(uint32_t, osc_port, "osc-port", 3819) CONFIG_VARIABLE(bool, use_osc, "use-osc", true) +CONFIG_VARIABLE(bool, use_overlap_equivalency, "use-overlap-equivalency", true) CONFIG_VARIABLE(bool, meter_falloff_off, "meter-falloff-off", false) CONFIG_VARIABLE(bool, meter_falloff_slowest, "meter-falloff-slowest", false) CONFIG_VARIABLE(bool, meter_falloff_slower, "meter-falloff-slower", false) CONFIG_VARIABLE(bool, meter_falloff_slow, "meter-falloff-slow", false) CONFIG_VARIABLE(bool, meter_falloff_medium, "meter-falloff-medium", false) -CONFIG_VARIABLE(bool, meter_falloff_fast, "meter-falloff-fast", false) +CONFIG_VARIABLE(bool, meter_falloff_fast, "meter-falloff-fast", true) CONFIG_VARIABLE(bool, meter_falloff_faster, "meter-falloff-faster", false) CONFIG_VARIABLE(bool, meter_falloff_fastest, "meter-falloff-fastest", false) CONFIG_VARIABLE(bool, meter_hold_off, "meter-hold-off", false) diff --git a/libs/ardour/ardour/location.h b/libs/ardour/ardour/location.h index ee55adb600..bb744c95be 100644 --- a/libs/ardour/ardour/location.h +++ b/libs/ardour/ardour/location.h @@ -159,6 +159,9 @@ class Locations : public Stateful, public StateManager Location *first_location_before (jack_nframes_t); Location *first_location_after (jack_nframes_t); + jack_nframes_t first_mark_before (jack_nframes_t); + jack_nframes_t first_mark_after (jack_nframes_t); + sigc::signal<void,Location*> current_changed; sigc::signal<void> changed; sigc::signal<void,Location*> added; diff --git a/libs/ardour/audio_playlist.cc b/libs/ardour/audio_playlist.cc index 53aa173ffd..a0d43d5575 100644 --- a/libs/ardour/audio_playlist.cc +++ b/libs/ardour/audio_playlist.cc @@ -886,8 +886,14 @@ AudioPlaylist::get_equivalent_regions (const AudioRegion& other, vector<AudioReg AudioRegion* ar = dynamic_cast<AudioRegion*> (*i); - if (ar && ar->equivalent (other)) { - results.push_back (ar); + if (ar) { + if (Config->get_use_overlap_equivalency()) { + if (ar->overlap_equivalent (other)) { + results.push_back (ar); + } else if (ar->equivalent (other)) { + results.push_back (ar); + } + } } } } diff --git a/libs/ardour/audioregion.cc b/libs/ardour/audioregion.cc index 95201ab6f7..eb8dfbc123 100644 --- a/libs/ardour/audioregion.cc +++ b/libs/ardour/audioregion.cc @@ -1139,15 +1139,15 @@ AudioRegion::master_source_names () } bool -AudioRegion::region_list_equivalent (const AudioRegion& other) +AudioRegion::region_list_equivalent (const AudioRegion& other) const { return size_equivalent (other) && source_equivalent (other) && _name == other._name; } bool -AudioRegion::source_equivalent (const AudioRegion& other) +AudioRegion::source_equivalent (const AudioRegion& other) const { - SourceList::iterator i; + SourceList::const_iterator i; SourceList::const_iterator io; for (i = sources.begin(), io = other.sources.begin(); i != sources.end() && io != other.sources.end(); ++i, ++io) { @@ -1166,7 +1166,13 @@ AudioRegion::source_equivalent (const AudioRegion& other) } bool -AudioRegion::equivalent (const AudioRegion& other) +AudioRegion::overlap_equivalent (const AudioRegion& other) const +{ + return coverage (other.first_frame(), other.last_frame()) != OverlapNone; +} + +bool +AudioRegion::equivalent (const AudioRegion& other) const { return _start == other._start && _position == other._position && @@ -1174,7 +1180,7 @@ AudioRegion::equivalent (const AudioRegion& other) } bool -AudioRegion::size_equivalent (const AudioRegion& other) +AudioRegion::size_equivalent (const AudioRegion& other) const { return _start == other._start && _length == other._length; diff --git a/libs/ardour/location.cc b/libs/ardour/location.cc index 87a27e5c3d..7d479637e3 100644 --- a/libs/ardour/location.cc +++ b/libs/ardour/location.cc @@ -656,6 +656,80 @@ Locations::first_location_after (jack_nframes_t frame) return 0; } +jack_nframes_t +Locations::first_mark_before (jack_nframes_t frame) +{ + LocationList locs; + + { + LockMonitor lm (lock, __LINE__, __FILE__); + locs = locations; + } + + LocationStartLaterComparison cmp; + locs.sort (cmp); + + /* locs is now sorted latest..earliest */ + + for (LocationList::iterator i = locs.begin(); i != locs.end(); ++i) { + if (!(*i)->is_hidden()) { + if ((*i)->is_mark()) { + /* MARK: start == end */ + if ((*i)->start() < frame) { + return (*i)->start(); + } + } else { + /* RANGE: start != end, compare start and end */ + if ((*i)->end() < frame) { + return (*i)->end(); + } + if ((*i)->start () < frame) { + return (*i)->start(); + } + } + } + } + + return 0; +} + +jack_nframes_t +Locations::first_mark_after (jack_nframes_t frame) +{ + LocationList locs; + + { + LockMonitor lm (lock, __LINE__, __FILE__); + locs = locations; + } + + LocationStartEarlierComparison cmp; + locs.sort (cmp); + + /* locs is now sorted earliest..latest */ + + for (LocationList::iterator i = locs.begin(); i != locs.end(); ++i) { + if (!(*i)->is_hidden()) { + if ((*i)->is_mark()) { + /* MARK, start == end so just compare start */ + if ((*i)->start() > frame) { + return (*i)->start(); + } + } else { + /* RANGE, start != end, compare start and end */ + if ((*i)->start() > frame ) { + return (*i)->start (); + } + if ((*i)->end() > frame) { + return (*i)->end (); + } + } + } + } + + return max_frames; +} + Location* Locations::end_location () const { diff --git a/libs/ardour/utils.cc b/libs/ardour/utils.cc index 8e9a36de59..15d0c6be81 100644 --- a/libs/ardour/utils.cc +++ b/libs/ardour/utils.cc @@ -175,10 +175,13 @@ tokenize_fullpath (string fullpath, string& path, string& name) } int -touch_file(string path) +touch_file (string path) { - FILE* file = fopen(path.c_str(), "a"); - fclose(file); + int fd = open (path.c_str(), O_RDONLY|O_CREAT); + if (fd >= 0) { + close (fd); + return 0; + } return 1; } |