summaryrefslogtreecommitdiff
path: root/libs/ardour
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2014-12-18 04:03:39 -0500
committerDavid Robillard <d@drobilla.net>2014-12-18 04:03:39 -0500
commit7eab4c6f339777a0e5bd202ff851bdce466cb183 (patch)
treee6d1aa290052628158f101455688ae052f23d56f /libs/ardour
parente584ae0bf94673bf719e661c49e8a2f2d2dd0346 (diff)
Don't assume compiler can avoid copy to const ref.
Diffstat (limited to 'libs/ardour')
-rw-r--r--libs/ardour/audio_diskstream.cc12
-rw-r--r--libs/ardour/midi_stretch.cc5
-rw-r--r--libs/ardour/source_factory.cc9
3 files changed, 16 insertions, 10 deletions
diff --git a/libs/ardour/audio_diskstream.cc b/libs/ardour/audio_diskstream.cc
index eb85538811..70ffa1831c 100644
--- a/libs/ardour/audio_diskstream.cc
+++ b/libs/ardour/audio_diskstream.cc
@@ -1771,15 +1771,15 @@ AudioDiskstream::prep_record_enable ()
for (ChannelList::iterator chan = c->begin(); chan != c->end(); ++chan) {
(*chan)->source.request_input_monitoring (!(_session.config.get_auto_input() && rolling));
capturing_sources.push_back ((*chan)->write_source);
- (*chan)->write_source->mark_streaming_write_started (
- Source::Lock((*chan)->write_source->mutex()));
+ Source::Lock lock((*chan)->write_source->mutex());
+ (*chan)->write_source->mark_streaming_write_started (lock);
}
} else {
for (ChannelList::iterator chan = c->begin(); chan != c->end(); ++chan) {
capturing_sources.push_back ((*chan)->write_source);
- (*chan)->write_source->mark_streaming_write_started (
- Source::Lock((*chan)->write_source->mutex()));
+ Source::Lock lock((*chan)->write_source->mutex());
+ (*chan)->write_source->mark_streaming_write_started (lock);
}
}
@@ -1965,8 +1965,8 @@ AudioDiskstream::reset_write_sources (bool mark_write_complete, bool /*force*/)
if ((*chan)->write_source) {
if (mark_write_complete) {
- (*chan)->write_source->mark_streaming_write_completed (
- Source::Lock((*chan)->write_source->mutex()));
+ Source::Lock lock((*chan)->write_source->mutex());
+ (*chan)->write_source->mark_streaming_write_completed (lock);
(*chan)->write_source->done_with_peakfile_writes ();
}
diff --git a/libs/ardour/midi_stretch.cc b/libs/ardour/midi_stretch.cc
index 0e75cdca1d..05635600d7 100644
--- a/libs/ardour/midi_stretch.cc
+++ b/libs/ardour/midi_stretch.cc
@@ -76,7 +76,10 @@ MidiStretch::run (boost::shared_ptr<Region> r, Progress*)
return -1;
boost::shared_ptr<MidiSource> src = region->midi_source(0);
- src->load_model(Glib::Threads::Mutex::Lock(src->mutex()));
+ {
+ Source::Lock lock(src->mutex());
+ src->load_model(lock);
+ }
boost::shared_ptr<MidiModel> old_model = src->model();
diff --git a/libs/ardour/source_factory.cc b/libs/ardour/source_factory.cc
index 4005148564..4b4a3cba33 100644
--- a/libs/ardour/source_factory.cc
+++ b/libs/ardour/source_factory.cc
@@ -205,7 +205,8 @@ SourceFactory::create (Session& s, const XMLNode& node, bool defer_peaks)
}
} else if (type == DataType::MIDI) {
boost::shared_ptr<SMFSource> src (new SMFSource (s, node));
- src->load_model (Glib::Threads::Mutex::Lock(src->mutex()), true);
+ Source::Lock lock(src->mutex());
+ src->load_model (lock, true);
#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
// boost_debug_shared_ptr_mark_interesting (src, "Source");
#endif
@@ -273,7 +274,8 @@ SourceFactory::createExternal (DataType type, Session& s, const string& path,
} else if (type == DataType::MIDI) {
boost::shared_ptr<SMFSource> src (new SMFSource (s, path));
- src->load_model (Glib::Threads::Mutex::Lock(src->mutex()), true);
+ Source::Lock lock(src->mutex());
+ src->load_model (lock, true);
#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
// boost_debug_shared_ptr_mark_interesting (src, "Source");
#endif
@@ -324,7 +326,8 @@ SourceFactory::createWritable (DataType type, Session& s, const std::string& pat
boost::shared_ptr<SMFSource> src (new SMFSource (s, path, SndFileSource::default_writable_flags));
assert (src->writable ());
- src->load_model (Glib::Threads::Mutex::Lock(src->mutex()), true);
+ Source::Lock lock(src->mutex());
+ src->load_model (lock, true);
#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
// boost_debug_shared_ptr_mark_interesting (src, "Source");
#endif