Allow const operatons on time-selection

This commit is contained in:
Robin Gareus 2020-07-21 00:39:03 +02:00
parent ba0dac92f2
commit 666cb250df
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 8 additions and 8 deletions

View File

@ -70,7 +70,7 @@ TimeSelection::consolidate ()
}
samplepos_t
TimeSelection::start ()
TimeSelection::start () const
{
if (empty()) {
return 0;
@ -78,7 +78,7 @@ TimeSelection::start ()
samplepos_t first = max_samplepos;
for (std::list<AudioRange>::iterator i = begin(); i != end(); ++i) {
for (std::list<AudioRange>::const_iterator i = begin(); i != end(); ++i) {
if ((*i).start < first) {
first = (*i).start;
}
@ -87,13 +87,13 @@ TimeSelection::start ()
}
samplepos_t
TimeSelection::end_sample ()
TimeSelection::end_sample () const
{
samplepos_t last = 0;
/* XXX make this work like RegionSelection: no linear search needed */
for (std::list<AudioRange>::iterator i = begin(); i != end(); ++i) {
for (std::list<AudioRange>::const_iterator i = begin(); i != end(); ++i) {
if ((*i).end > last) {
last = (*i).end;
}
@ -102,7 +102,7 @@ TimeSelection::end_sample ()
}
samplecnt_t
TimeSelection::length()
TimeSelection::length() const
{
if (empty()) {
return 0;

View File

@ -33,9 +33,9 @@ class TimeSelection : public std::list<ARDOUR::AudioRange>
public:
ARDOUR::AudioRange& operator[](uint32_t);
ARDOUR::samplepos_t start();
ARDOUR::samplepos_t end_sample();
ARDOUR::samplepos_t length();
ARDOUR::samplepos_t start() const;
ARDOUR::samplepos_t end_sample() const;
ARDOUR::samplepos_t length() const;
bool consolidate ();
};