summaryrefslogtreecommitdiff
path: root/libs/ardour/smf_source.cc
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-10-19 18:11:31 +0000
committerDavid Robillard <d@drobilla.net>2011-10-19 18:11:31 +0000
commit18c2ee4a26f3991c7283744bd7e12cdae33a1297 (patch)
treeff480e67c8af5bcceadb0894986248fa403b8413 /libs/ardour/smf_source.cc
parenta189d3e43bcde3e1b95db8b7d9345ca3e5b9dcaa (diff)
Remove dubious Evoral::Event methods that exposed non-const references to members.
git-svn-id: svn://localhost/ardour2/branches/3.0@10239 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/smf_source.cc')
-rw-r--r--libs/ardour/smf_source.cc10
1 files changed, 4 insertions, 6 deletions
diff --git a/libs/ardour/smf_source.cc b/libs/ardour/smf_source.cc
index 9e777b6ae5..877882abcb 100644
--- a/libs/ardour/smf_source.cc
+++ b/libs/ardour/smf_source.cc
@@ -497,7 +497,7 @@ SMFSource::load_model (bool lock, bool force_reload)
uint64_t time = 0; /* in SMF ticks */
Evoral::Event<double> ev;
- size_t scratch_size = 0; // keep track of scratch and minimize reallocs
+ uint32_t scratch_size = 0; // keep track of scratch and minimize reallocs
uint32_t delta_t = 0;
uint32_t size = 0;
@@ -547,11 +547,9 @@ SMFSource::load_model (bool lock, bool force_reload)
_model->append (ev, event_id);
- if (ev.size() > scratch_size) {
- scratch_size = ev.size();
- }
-
- ev.size() = scratch_size; // ensure read_event only allocates if necessary
+ // Set size to max capacity to minimize allocs in read_event
+ scratch_size = std::max(size, scratch_size);
+ size = scratch_size;
_length_beats = max(_length_beats, ev.time());
}