summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2010-12-20 21:50:46 +0000
committerDavid Robillard <d@drobilla.net>2010-12-20 21:50:46 +0000
commit7e3404e2a0174d5b7b208695e57f230a174c1379 (patch)
tree20aa230a7e242d4de770179d6fc7213cc327d244
parent3f30e8093e1c78bb722196ecb48d9c7cbdd279c3 (diff)
Fix more broken whitespace.
git-svn-id: svn://localhost/ardour2/branches/3.0@8313 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r--libs/ardour/audioregion.cc124
-rw-r--r--libs/ardour/midi_diskstream.cc283
-rw-r--r--libs/ardour/region_factory.cc135
3 files changed, 269 insertions, 273 deletions
diff --git a/libs/ardour/audioregion.cc b/libs/ardour/audioregion.cc
index 9de1de1279..f3a5be9da6 100644
--- a/libs/ardour/audioregion.cc
+++ b/libs/ardour/audioregion.cc
@@ -70,17 +70,17 @@ void
AudioRegion::make_property_quarks ()
{
Properties::envelope_active.property_id = g_quark_from_static_string (X_("envelope-active"));
- DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for envelope-active = %1\n", Properties::envelope_active.property_id));
+ DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for envelope-active = %1\n", Properties::envelope_active.property_id));
Properties::default_fade_in.property_id = g_quark_from_static_string (X_("default-fade-in"));
- DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for default-fade-in = %1\n", Properties::default_fade_in.property_id));
+ DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for default-fade-in = %1\n", Properties::default_fade_in.property_id));
Properties::default_fade_out.property_id = g_quark_from_static_string (X_("default-fade-out"));
- DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for default-fade-out = %1\n", Properties::default_fade_out.property_id));
+ DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for default-fade-out = %1\n", Properties::default_fade_out.property_id));
Properties::fade_in_active.property_id = g_quark_from_static_string (X_("fade-in-active"));
- DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for fade-in-active = %1\n", Properties::fade_in_active.property_id));
+ DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for fade-in-active = %1\n", Properties::fade_in_active.property_id));
Properties::fade_out_active.property_id = g_quark_from_static_string (X_("fade-out-active"));
- DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for fade-out-active = %1\n", Properties::fade_out_active.property_id));
+ DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for fade-out-active = %1\n", Properties::fade_out_active.property_id));
Properties::scale_amplitude.property_id = g_quark_from_static_string (X_("scale-amplitude"));
- DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for scale-amplitude = %1\n", Properties::scale_amplitude.property_id));
+ DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for scale-amplitude = %1\n", Properties::scale_amplitude.property_id));
}
void
@@ -268,8 +268,8 @@ AudioRegion::connect_to_header_position_offset_changed ()
for (SourceList::const_iterator i = _sources.begin(); i != _sources.end(); ++i) {
- /* connect only once to HeaderPositionOffsetChanged, even if sources are replicated
- */
+ /* connect only once to HeaderPositionOffsetChanged, even if sources are replicated
+ */
if (unique_srcs.find (*i) == unique_srcs.end ()) {
unique_srcs.insert (*i);
@@ -360,9 +360,9 @@ AudioRegion::_read_at (const SourceList& /*srcs*/, framecnt_t limit,
framecnt_t to_read;
bool raw = (rops == ReadOpsNone);
- if (n_channels() == 0) {
- return 0;
- }
+ if (n_channels() == 0) {
+ return 0;
+ }
if (muted() && !raw) {
return 0; /* read nothing */
@@ -415,22 +415,22 @@ AudioRegion::_read_at (const SourceList& /*srcs*/, framecnt_t limit,
we don't have.
*/
- if (Config->get_replicate_missing_region_channels()) {
- /* track is N-channel, this region has less channels, so use a relevant channel
- */
-
- uint32_t channel = n_channels() % chan_n;
- boost::shared_ptr<AudioSource> src = audio_source (channel);
+ if (Config->get_replicate_missing_region_channels()) {
+ /* track is N-channel, this region has less channels, so use a relevant channel
+ */
+
+ uint32_t channel = n_channels() % chan_n;
+ boost::shared_ptr<AudioSource> src = audio_source (channel);
- if (src->read (mixdown_buffer, _start + internal_offset, to_read) != to_read) {
- return 0; /* "read nothing" */
- }
+ if (src->read (mixdown_buffer, _start + internal_offset, to_read) != to_read) {
+ return 0; /* "read nothing" */
+ }
- /* adjust read data count appropriately since this was a duplicate read */
- src->dec_read_data_count (to_read);
- } else {
- memset (mixdown_buffer, 0, sizeof (Sample) * cnt);
- }
+ /* adjust read data count appropriately since this was a duplicate read */
+ src->dec_read_data_count (to_read);
+ } else {
+ memset (mixdown_buffer, 0, sizeof (Sample) * cnt);
+ }
}
if (rops & ReadOpsFades) {
@@ -480,7 +480,7 @@ AudioRegion::_read_at (const SourceList& /*srcs*/, framecnt_t limit,
*/
- framecnt_t fade_out_length = (framecnt_t) _fade_out->back()->when;
+ framecnt_t fade_out_length = (framecnt_t) _fade_out->back()->when;
framecnt_t fade_interval_start = max(internal_offset, limit-fade_out_length);
framecnt_t fade_interval_end = min(internal_offset + to_read, limit);
@@ -624,7 +624,7 @@ AudioRegion::_set_state (const XMLNode& node, int version, PropertyChange& what_
/* Now find envelope description and other related child items */
- _envelope->freeze ();
+ _envelope->freeze ();
for (XMLNodeConstIterator niter = nlist.begin(); niter != nlist.end(); ++niter) {
XMLNode *child;
@@ -689,9 +689,9 @@ AudioRegion::_set_state (const XMLNode& node, int version, PropertyChange& what_
}
}
- _envelope->thaw ();
+ _envelope->thaw ();
resume_property_changes ();
-
+
if (send) {
send_change (what_changed);
}
@@ -725,9 +725,9 @@ AudioRegion::set_fade_out_shape (FadeShape shape)
void
AudioRegion::set_fade_in (boost::shared_ptr<AutomationList> f)
{
- _fade_in->freeze ();
+ _fade_in->freeze ();
*_fade_in = *f;
- _fade_in->thaw ();
+ _fade_in->thaw ();
send_change (PropertyChange (Properties::fade_in));
}
@@ -735,7 +735,7 @@ AudioRegion::set_fade_in (boost::shared_ptr<AutomationList> f)
void
AudioRegion::set_fade_in (FadeShape shape, framecnt_t len)
{
- _fade_in->freeze ();
+ _fade_in->freeze ();
_fade_in->clear ();
switch (shape) {
@@ -786,16 +786,16 @@ AudioRegion::set_fade_in (FadeShape shape, framecnt_t len)
break;
}
- _fade_in->thaw ();
+ _fade_in->thaw ();
send_change (PropertyChange (Properties::fade_in));
}
void
AudioRegion::set_fade_out (boost::shared_ptr<AutomationList> f)
{
- _fade_out->freeze ();
+ _fade_out->freeze ();
*_fade_out = *f;
- _fade_out->thaw ();
+ _fade_out->thaw ();
send_change (PropertyChange (Properties::fade_in));
}
@@ -803,7 +803,7 @@ AudioRegion::set_fade_out (boost::shared_ptr<AutomationList> f)
void
AudioRegion::set_fade_out (FadeShape shape, framecnt_t len)
{
- _fade_out->freeze ();
+ _fade_out->freeze ();
_fade_out->clear ();
switch (shape) {
@@ -852,7 +852,7 @@ AudioRegion::set_fade_out (FadeShape shape, framecnt_t len)
break;
}
- _fade_out->thaw ();
+ _fade_out->thaw ();
send_change (PropertyChange (Properties::fade_in));
}
@@ -943,11 +943,11 @@ AudioRegion::set_default_fades ()
void
AudioRegion::set_default_envelope ()
{
- _envelope->freeze ();
+ _envelope->freeze ();
_envelope->clear ();
_envelope->fast_simple_add (0, 1.0f);
_envelope->fast_simple_add (_length, 1.0f);
- _envelope->thaw ();
+ _envelope->thaw ();
}
void
@@ -957,21 +957,21 @@ AudioRegion::recompute_at_end ()
based on the the existing curve.
*/
- _envelope->freeze ();
+ _envelope->freeze ();
_envelope->truncate_end (_length);
_envelope->set_max_xval (_length);
- _envelope->thaw ();
+ _envelope->thaw ();
suspend_property_changes();
- if (_left_of_split) {
- set_default_fade_out ();
- _left_of_split = false;
- } else if (_fade_out->back()->when > _length) {
- _fade_out->extend_to (_length);
- send_change (PropertyChange (Properties::fade_out));
- }
-
+ if (_left_of_split) {
+ set_default_fade_out ();
+ _left_of_split = false;
+ } else if (_fade_out->back()->when > _length) {
+ _fade_out->extend_to (_length);
+ send_change (PropertyChange (Properties::fade_out));
+ }
+
if (_fade_in->back()->when > _length) {
_fade_in->extend_to (_length);
send_change (PropertyChange (Properties::fade_in));
@@ -989,10 +989,10 @@ AudioRegion::recompute_at_start ()
suspend_property_changes();
- if (_right_of_split) {
- set_default_fade_in ();
- _right_of_split = false;
- } else if (_fade_in->back()->when > _length) {
+ if (_right_of_split) {
+ set_default_fade_in ();
+ _right_of_split = false;
+ } else if (_fade_in->back()->when > _length) {
_fade_in->extend_to (_length);
send_change (PropertyChange (Properties::fade_in));
}
@@ -1424,11 +1424,11 @@ AudioRegion::get_transients (AnalysisFeatureList& results, bool force_new)
/* no existing/complete transient info */
- static bool analyse_dialog_shown = false; /* global per instance of Ardour */
+ static bool analyse_dialog_shown = false; /* global per instance of Ardour */
if (!Config->get_auto_analyse_audio()) {
- if (!analyse_dialog_shown) {
- pl->session().Dialog (_("\
+ if (!analyse_dialog_shown) {
+ pl->session().Dialog (_("\
You have requested an operation that requires audio analysis.\n\n\
You currently have \"auto-analyse-audio\" disabled, which means \
that transient data must be generated every time it is required.\n\n\
@@ -1438,8 +1438,8 @@ then quit ardour and restart.\n\n\
This dialog will not display again. But you may notice a slight delay \
in this and future transient-detection operations.\n\
"));
- analyse_dialog_shown = true;
- }
+ analyse_dialog_shown = true;
+ }
}
TransientDetector t (pl->session().frame_rate());
@@ -1507,11 +1507,11 @@ AudioRegion::find_silence (Sample threshold, framecnt_t min_length, InterThreadI
{
framecnt_t const block_size = 64 * 1024;
boost::scoped_array<Sample> loudest (new Sample[block_size]);
- boost::scoped_array<Sample> buf (new Sample[block_size]);
+ boost::scoped_array<Sample> buf (new Sample[block_size]);
framepos_t pos = _start;
framepos_t const end = _start + _length - 1;
-
+
AudioIntervalResult silent_periods;
bool in_silence = false;
@@ -1547,7 +1547,7 @@ AudioRegion::find_silence (Sample threshold, framecnt_t min_length, InterThreadI
}
pos += block_size;
- itt.progress = (end-pos)/(double)_length;
+ itt.progress = (end-pos)/(double)_length;
}
if (in_silence && end - 1 - silence_start >= min_length) {
@@ -1555,7 +1555,7 @@ AudioRegion::find_silence (Sample threshold, framecnt_t min_length, InterThreadI
silent_periods.push_back (std::make_pair (silence_start, end));
}
- itt.done = true;
+ itt.done = true;
return silent_periods;
}
diff --git a/libs/ardour/midi_diskstream.cc b/libs/ardour/midi_diskstream.cc
index 1e28186fb0..7227c8ba2e 100644
--- a/libs/ardour/midi_diskstream.cc
+++ b/libs/ardour/midi_diskstream.cc
@@ -85,7 +85,7 @@ MidiDiskstream::MidiDiskstream (Session &sess, const string &name, Diskstream::F
init ();
use_new_playlist ();
- use_new_write_source (0);
+ use_new_write_source (0);
in_set_state = false;
@@ -111,7 +111,7 @@ MidiDiskstream::MidiDiskstream (Session& sess, const XMLNode& node)
throw failed_constructor();
}
- use_new_write_source (0);
+ use_new_write_source (0);
in_set_state = false;
}
@@ -184,10 +184,10 @@ MidiDiskstream::non_realtime_input_change ()
/* implicit unlock */
}
- /* unlike with audio, there is never any need to reset write sources
- based on input configuration changes because ... a MIDI track
- has just 1 MIDI port as input, always.
- */
+ /* unlike with audio, there is never any need to reset write sources
+ based on input configuration changes because ... a MIDI track
+ has just 1 MIDI port as input, always.
+ */
/* now refill channel buffers */
@@ -496,7 +496,7 @@ MidiDiskstream::process (framepos_t transport_frame, pframes_t nframes, bool can
bool nominally_recording;
bool re = record_enabled ();
- playback_distance = 0;
+ playback_distance = 0;
check_record_status (transport_frame, can_record);
@@ -506,9 +506,9 @@ MidiDiskstream::process (framepos_t transport_frame, pframes_t nframes, bool can
return 0;
}
- Glib::Mutex::Lock sm (state_lock, Glib::TRY_LOCK);
+ Glib::Mutex::Lock sm (state_lock, Glib::TRY_LOCK);
- if (!sm.locked()) {
+ if (!sm.locked()) {
return 1;
}
@@ -546,7 +546,7 @@ MidiDiskstream::process (framepos_t transport_frame, pframes_t nframes, bool can
for (MidiBuffer::iterator i = buf.begin(); i != buf.end(); ++i) {
copy->push_back ((*i).time() + transport_frame, (*i).size(), (*i).buffer());
}
-
+
DataRecorded (copy, _write_source); /* EMIT SIGNAL */
}
@@ -580,9 +580,9 @@ MidiDiskstream::process (framepos_t transport_frame, pframes_t nframes, bool can
ret = 0;
- if (commit (nframes)) {
- need_butler = true;
- }
+ if (commit (nframes)) {
+ need_butler = true;
+ }
return ret;
}
@@ -634,7 +634,7 @@ MidiDiskstream::overwrite_existing_buffers ()
g_atomic_int_set (&_frames_read_from_ringbuffer, 0);
g_atomic_int_set (&_frames_written_to_ringbuffer, 0);
-
+
read (overwrite_frame, disk_io_chunk_frames, false);
overwrite_queued = false;
_pending_overwrite = false;
@@ -881,8 +881,8 @@ MidiDiskstream::do_flush (RunContext /*context*/, bool force_flush)
assert(!destructive());
- if (record_enabled() &&
- ((_session.transport_frame() - _last_flush_frame > disk_io_chunk_frames) ||
+ if (record_enabled() &&
+ ((_session.transport_frame() - _last_flush_frame > disk_io_chunk_frames) ||
force_flush)) {
if ((!_write_source) || _write_source->midi_write (*_capture_buf, get_capture_start_frame (0), to_write) != to_write) {
error << string_compose(_("MidiDiskstream %1: cannot write to disk"), _id) << endmsg;
@@ -915,14 +915,14 @@ MidiDiskstream::transport_stopped_wallclock (struct tm& /*when*/, time_t /*twhen
while (more_work && !err) {
switch (do_flush (TransportContext, true)) {
- case 0:
- more_work = false;
- break;
- case 1:
- break;
- case -1:
- error << string_compose(_("MidiDiskstream \"%1\": cannot flush captured data to disk!"), _name) << endmsg;
- err++;
+ case 0:
+ more_work = false;
+ break;
+ case 1:
+ break;
+ case -1:
+ error << string_compose(_("MidiDiskstream \"%1\": cannot flush captured data to disk!"), _name) << endmsg;
+ err++;
}
}
@@ -936,7 +936,6 @@ MidiDiskstream::transport_stopped_wallclock (struct tm& /*when*/, time_t /*twhen
if (abort_capture) {
if (_write_source) {
-
_write_source->mark_for_remove ();
_write_source.reset();
}
@@ -952,117 +951,117 @@ MidiDiskstream::transport_stopped_wallclock (struct tm& /*when*/, time_t /*twhen
total_capture += (*ci)->frames;
}
- if (_write_source->length (capture_info.front()->start) != 0) {
-
- /* phew, we have data */
-
- /* figure out the name for this take */
-
- srcs.push_back (_write_source);
-
- _write_source->set_timeline_position (capture_info.front()->start);
- _write_source->set_captured_for (_name);
-
- /* flush to disk: this step differs from the audio path,
- where all the data is already on disk.
- */
-
- _write_source->mark_streaming_write_completed ();
-
- /* make it not a stub anymore */
-
- _write_source->unstubify ();
-
- /* we will want to be able to keep (over)writing the source
- but we don't want it to be removable. this also differs
- from the audio situation, where the source at this point
- must be considered immutable. luckily, we can rely on
- MidiSource::mark_streaming_write_completed() to have
- already done the necessary work for that.
- */
-
- string whole_file_region_name;
- whole_file_region_name = region_name_from_path (_write_source->name(), true);
-
- /* Register a new region with the Session that
- describes the entire source. Do this first
- so that any sub-regions will obviously be
- children of this one (later!)
- */
-
- try {
- PropertyList plist;
-
- plist.add (Properties::name, whole_file_region_name);
- plist.add (Properties::whole_file, true);
- plist.add (Properties::automatic, true);
- plist.add (Properties::start, 0);
- plist.add (Properties::length, total_capture);
- plist.add (Properties::layer, 0);
-
- boost::shared_ptr<Region> rx (RegionFactory::create (srcs, plist));
-
- region = boost::dynamic_pointer_cast<MidiRegion> (rx);
- region->special_set_position (capture_info.front()->start);
- }
-
-
- catch (failed_constructor& err) {
- error << string_compose(_("%1: could not create region for complete midi file"), _name) << endmsg;
- /* XXX what now? */
- }
-
- _last_capture_sources.insert (_last_capture_sources.end(), srcs.begin(), srcs.end());
-
- _playlist->clear_changes ();
- _playlist->freeze ();
+ if (_write_source->length (capture_info.front()->start) != 0) {
+
+ /* phew, we have data */
+
+ /* figure out the name for this take */
+
+ srcs.push_back (_write_source);
+
+ _write_source->set_timeline_position (capture_info.front()->start);
+ _write_source->set_captured_for (_name);
+
+ /* flush to disk: this step differs from the audio path,
+ where all the data is already on disk.
+ */
+
+ _write_source->mark_streaming_write_completed ();
+
+ /* make it not a stub anymore */
+
+ _write_source->unstubify ();
+
+ /* we will want to be able to keep (over)writing the source
+ but we don't want it to be removable. this also differs
+ from the audio situation, where the source at this point
+ must be considered immutable. luckily, we can rely on
+ MidiSource::mark_streaming_write_completed() to have
+ already done the necessary work for that.
+ */
+
+ string whole_file_region_name;
+ whole_file_region_name = region_name_from_path (_write_source->name(), true);
+
+ /* Register a new region with the Session that
+ describes the entire source. Do this first
+ so that any sub-regions will obviously be
+ children of this one (later!)
+ */
+
+ try {
+ PropertyList plist;
+
+ plist.add (Properties::name, whole_file_region_name);
+ plist.add (Properties::whole_file, true);
+ plist.add (Properties::automatic, true);
+ plist.add (Properties::start, 0);
+ plist.add (Properties::length, total_capture);
+ plist.add (Properties::layer, 0);
+
+ boost::shared_ptr<Region> rx (RegionFactory::create (srcs, plist));
+
+ region = boost::dynamic_pointer_cast<MidiRegion> (rx);
+ region->special_set_position (capture_info.front()->start);
+ }
+
+
+ catch (failed_constructor& err) {
+ error << string_compose(_("%1: could not create region for complete midi file"), _name) << endmsg;
+ /* XXX what now? */
+ }
+
+ _last_capture_sources.insert (_last_capture_sources.end(), srcs.begin(), srcs.end());
+
+ _playlist->clear_changes ();
+ _playlist->freeze ();
/* Session frame time of the initial capture in this pass, which is where the source starts */
framepos_t initial_capture = 0;
if (!capture_info.empty()) {
initial_capture = capture_info.front()->start;
}
-
- for (ci = capture_info.begin(); ci != capture_info.end(); ++ci) {
- string region_name;
+ for (ci = capture_info.begin(); ci != capture_info.end(); ++ci) {
+
+ string region_name;
- RegionFactory::region_name (region_name, _write_source->name(), false);
+ RegionFactory::region_name (region_name, _write_source->name(), false);
- // cerr << _name << ": based on ci of " << (*ci)->start << " for " << (*ci)->frames << " add a region\n";
+ // cerr << _name << ": based on ci of " << (*ci)->start << " for " << (*ci)->frames << " add a region\n";
- try {
- PropertyList plist;
+ try {
+ PropertyList plist;
/* start of this region is the offset between the start of its capture and the start of the whole pass */
- plist.add (Properties::start, (*ci)->start - initial_capture);
- plist.add (Properties::length, (*ci)->frames);
- plist.add (Properties::name, region_name);
-
- boost::shared_ptr<Region> rx (RegionFactory::create (srcs, plist));
- region = boost::dynamic_pointer_cast<MidiRegion> (rx);
- }
+ plist.add (Properties::start, (*ci)->start - initial_capture);
+ plist.add (Properties::length, (*ci)->frames);
+ plist.add (Properties::name, region_name);
- catch (failed_constructor& err) {
- error << _("MidiDiskstream: could not create region for captured midi!") << endmsg;
- continue; /* XXX is this OK? */
- }
+ boost::shared_ptr<Region> rx (RegionFactory::create (srcs, plist));
+ region = boost::dynamic_pointer_cast<MidiRegion> (rx);
+ }
- // cerr << "add new region, buffer position = " << buffer_position << " @ " << (*ci)->start << endl;
+ catch (failed_constructor& err) {
+ error << _("MidiDiskstream: could not create region for captured midi!") << endmsg;
+ continue; /* XXX is this OK? */
+ }
- i_am_the_modifier++;
- _playlist->add_region (region, (*ci)->start);
- i_am_the_modifier--;
- }
+ // cerr << "add new region, buffer position = " << buffer_position << " @ " << (*ci)->start << endl;
- _playlist->thaw ();
- _session.add_command (new StatefulDiffCommand(_playlist));
- }
+ i_am_the_modifier++;
+ _playlist->add_region (region, (*ci)->start);
+ i_am_the_modifier--;
+ }
+
+ _playlist->thaw ();
+ _session.add_command (new StatefulDiffCommand(_playlist));
+ }
- mark_write_completed = true;
+ mark_write_completed = true;
}
- use_new_write_source (0);
+ use_new_write_source (0);
for (ci = capture_info.begin(); ci != capture_info.end(); ++ci) {
delete *ci;
@@ -1336,16 +1335,16 @@ MidiDiskstream::use_new_write_source (uint32_t n)
assert(n == 0);
- _write_source.reset();
+ _write_source.reset();
try {
- /* file starts off as a stub file, it will be converted
- when we're done with a capture pass, or when "stolen"
- by the GUI.
- */
+ /* file starts off as a stub file, it will be converted
+ when we're done with a capture pass, or when "stolen"
+ by the GUI.
+ */
_write_source = boost::dynamic_pointer_cast<SMFSource>(
- _session.create_midi_source_for_session (0, name (), true));
+ _session.create_midi_source_for_session (0, name (), true));
if (!_write_source) {
throw failed_constructor();
@@ -1363,31 +1362,31 @@ MidiDiskstream::use_new_write_source (uint32_t n)
return 0;
}
-list<boost::shared_ptr<Source> >
+list<boost::shared_ptr<Source> >
MidiDiskstream::steal_write_sources()
{
- list<boost::shared_ptr<Source> > ret;
+ list<boost::shared_ptr<Source> > ret;
+
+ /* put some data on the disk, even if its just a header for an empty file.
+ XXX should we not have a more direct method for doing this? Maybe not
+ since we don't want to mess around with the model/disk relationship
+ that the Source has to pay attention to.
+ */
- /* put some data on the disk, even if its just a header for an empty file.
- XXX should we not have a more direct method for doing this? Maybe not
- since we don't want to mess around with the model/disk relationship
- that the Source has to pay attention to.
- */
-
- boost::dynamic_pointer_cast<MidiSource>(_write_source)->session_saved ();
+ boost::dynamic_pointer_cast<MidiSource>(_write_source)->session_saved ();
- /* make it visible/present */
- _write_source->unstubify ();
- /* never let it go away */
- _write_source->mark_nonremovable ();
+ /* make it visible/present */
+ _write_source->unstubify ();
+ /* never let it go away */
+ _write_source->mark_nonremovable ();
- ret.push_back (_write_source);
+ ret.push_back (_write_source);
- /* get a new one */
+ /* get a new one */
- use_new_write_source (0);
+ use_new_write_source (0);
- return ret;
+ return ret;
}
void
@@ -1399,8 +1398,8 @@ MidiDiskstream::reset_write_sources (bool mark_write_complete, bool /*force*/)
if (_write_source && mark_write_complete) {
_write_source->mark_streaming_write_completed ();
- }
- use_new_write_source (0);
+ }
+ use_new_write_source (0);
}
int
diff --git a/libs/ardour/region_factory.cc b/libs/ardour/region_factory.cc
index 6f49d8c5b3..459f993676 100644
--- a/libs/ardour/region_factory.cc
+++ b/libs/ardour/region_factory.cc
@@ -38,11 +38,11 @@ using namespace ARDOUR;
using namespace PBD;
PBD::Signal1<void,boost::shared_ptr<Region> > RegionFactory::CheckNewRegion;
-Glib::StaticMutex RegionFactory::region_map_lock;
-RegionFactory::RegionMap RegionFactory::region_map;
-PBD::ScopedConnectionList RegionFactory::region_list_connections;
-Glib::StaticMutex RegionFactory::region_name_map_lock;
-std::map<std::string, uint32_t> RegionFactory::region_name_map;
+Glib::StaticMutex RegionFactory::region_map_lock;
+RegionFactory::RegionMap RegionFactory::region_map;
+PBD::ScopedConnectionList RegionFactory::region_list_connections;
+Glib::StaticMutex RegionFactory::region_name_map_lock;
+std::map<std::string, uint32_t> RegionFactory::region_name_map;
boost::shared_ptr<Region>
RegionFactory::create (boost::shared_ptr<const Region> region, bool announce)
@@ -273,12 +273,12 @@ RegionFactory::map_add (boost::shared_ptr<Region> r)
p.first = r->id();
p.second = r;
- {
- Glib::Mutex::Lock lm (region_map_lock);
- region_map.insert (p);
- }
+ {
+ Glib::Mutex::Lock lm (region_map_lock);
+ region_map.insert (p);
+ }
- r->DropReferences.connect_same_thread (region_list_connections, boost::bind (&RegionFactory::map_remove, r));
+ r->DropReferences.connect_same_thread (region_list_connections, boost::bind (&RegionFactory::map_remove, r));
r->PropertyChanged.connect_same_thread (
region_list_connections,
@@ -291,34 +291,31 @@ RegionFactory::map_add (boost::shared_ptr<Region> r)
void
RegionFactory::map_remove (boost::shared_ptr<Region> r)
{
- Glib::Mutex::Lock lm (region_map_lock);
- RegionMap::iterator i = region_map.find (r->id());
-
- if (i != region_map.end()) {
- region_map.erase (i);
- }
+ Glib::Mutex::Lock lm (region_map_lock);
+ RegionMap::iterator i = region_map.find (r->id());
+ if (i != region_map.end()) {
+ region_map.erase (i);
+ }
}
void
RegionFactory::map_remove_with_equivalents (boost::shared_ptr<Region> r)
{
- Glib::Mutex::Lock lm (region_map_lock);
-
- for (RegionMap::iterator i = region_map.begin(); i != region_map.end(); ) {
- RegionMap::iterator tmp = i;
- ++tmp;
+ Glib::Mutex::Lock lm (region_map_lock);
- if (r->region_list_equivalent (i->second)) {
- region_map.erase (i);
- } else if (r == i->second) {
- region_map.erase (i);
- }
-
- i = tmp;
- }
+ for (RegionMap::iterator i = region_map.begin(); i != region_map.end(); ) {
+ RegionMap::iterator tmp = i;
+ ++tmp;
+ if (r->region_list_equivalent (i->second)) {
+ region_map.erase (i);
+ } else if (r == i->second) {
+ region_map.erase (i);
+ }
+ i = tmp;
+ }
}
boost::shared_ptr<Region>
@@ -336,66 +333,66 @@ RegionFactory::region_by_id (const PBD::ID& id)
boost::shared_ptr<Region>
RegionFactory::wholefile_region_by_name (const std::string& name)
{
- for (RegionMap::iterator i = region_map.begin(); i != region_map.end(); ++i) {
- if (i->second->whole_file() && i->second->name() == name) {
- return i->second;
- }
- }
- return boost::shared_ptr<Region>();
+ for (RegionMap::iterator i = region_map.begin(); i != region_map.end(); ++i) {
+ if (i->second->whole_file() && i->second->name() == name) {
+ return i->second;
+ }
+ }
+ return boost::shared_ptr<Region>();
}
boost::shared_ptr<Region>
RegionFactory::region_by_name (const std::string& name)
{
- for (RegionMap::iterator i = region_map.begin(); i != region_map.end(); ++i) {
- if (i->second->name() == name) {
- return i->second;
- }
- }
- return boost::shared_ptr<Region>();
+ for (RegionMap::iterator i = region_map.begin(); i != region_map.end(); ++i) {
+ if (i->second->name() == name) {
+ return i->second;
+ }
+ }
+ return boost::shared_ptr<Region>();
}
void
RegionFactory::clear_map ()
{
- region_list_connections.drop_connections ();
+ region_list_connections.drop_connections ();
- {
- Glib::Mutex::Lock lm (region_map_lock);
- region_map.clear ();
- }
+ {
+ Glib::Mutex::Lock lm (region_map_lock);
+ region_map.clear ();
+ }
}
void
RegionFactory::delete_all_regions ()
{
- RegionMap copy;
+ RegionMap copy;
- /* copy region list */
- {
- Glib::Mutex::Lock lm (region_map_lock);
- copy = region_map;
- }
+ /* copy region list */
+ {
+ Glib::Mutex::Lock lm (region_map_lock);
+ copy = region_map;
+ }
- /* clear existing map */
- clear_map ();
+ /* clear existing map */
+ clear_map ();
- /* tell everyone to drop references */
- for (RegionMap::iterator i = copy.begin(); i != copy.end(); ++i) {
- i->second->drop_references ();
- }
+ /* tell everyone to drop references */
+ for (RegionMap::iterator i = copy.begin(); i != copy.end(); ++i) {
+ i->second->drop_references ();
+ }
- /* the copy should now hold the only references, which will
- vanish as we leave this scope, thus calling all destructors.
- */
+ /* the copy should now hold the only references, which will
+ vanish as we leave this scope, thus calling all destructors.
+ */
}
uint32_t
RegionFactory::nregions ()
{
- Glib::Mutex::Lock lm (region_map_lock);
- return region_map.size ();
+ Glib::Mutex::Lock lm (region_map_lock);
+ return region_map.size ();
}
void
@@ -538,11 +535,11 @@ RegionFactory::new_region_name (string old)
void
RegionFactory::get_regions_using_source (boost::shared_ptr<Source> s, std::set<boost::shared_ptr<Region> >& r)
{
- Glib::Mutex::Lock lm (region_map_lock);
+ Glib::Mutex::Lock lm (region_map_lock);
- for (RegionMap::iterator i = region_map.begin(); i != region_map.end(); ++i) {
- if (i->second->uses_source (s)) {
- r.insert (i->second);
- }
- }
+ for (RegionMap::iterator i = region_map.begin(); i != region_map.end(); ++i) {
+ if (i->second->uses_source (s)) {
+ r.insert (i->second);
+ }
+ }
}