Fix a bunch of the ol' trivial audio-specific-for-no-particular-reason things.

Re-addition of this sort of thing is now officially punishable by death ;)


git-svn-id: svn://localhost/ardour2/branches/3.0@4603 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
David Robillard 2009-02-16 07:04:27 +00:00
parent f12cfb3d87
commit 64bf6f004a
12 changed files with 104 additions and 171 deletions

View file

@ -200,12 +200,11 @@ AudioRegionView::init (Gdk::Color& basic_color, bool wfd)
set_fade_visibility (false); set_fade_visibility (false);
} }
string line_name = _region->name(); const string line_name = _region->name() + ":gain";
line_name += ':';
line_name += "gain";
if (!Profile->get_sae()) { if (!Profile->get_sae()) {
gain_line = new AudioRegionGainLine (line_name, trackview.session(), *this, *group, audio_region()->envelope()); gain_line = new AudioRegionGainLine (line_name, trackview.session(), *this, *group,
audio_region()->envelope());
} }
if (!(_flags & EnvelopeVisible)) { if (!(_flags & EnvelopeVisible)) {

View file

@ -142,10 +142,7 @@ AutomationRegionView::set_height (double h)
bool bool
AutomationRegionView::set_position (nframes_t pos, void* src, double* ignored) AutomationRegionView::set_position (nframes_t pos, void* src, double* ignored)
{ {
// Do nothing, region parent will move us return RegionView::set_position(pos, src, ignored);
//return false;
return RegionView::set_position(pos, src, ignored); // FIXME: eventually...
} }

View file

@ -4966,21 +4966,18 @@ Editor::get_regions_at (RegionSelection& rs, nframes64_t where, const TrackSelec
} }
for (TrackSelection::const_iterator t = tracks->begin(); t != tracks->end(); ++t) { for (TrackSelection::const_iterator t = tracks->begin(); t != tracks->end(); ++t) {
RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*>(*t);
AudioTimeAxisView* atv = dynamic_cast<AudioTimeAxisView*>(*t); if (rtv) {
if (atv) {
boost::shared_ptr<Diskstream> ds; boost::shared_ptr<Diskstream> ds;
boost::shared_ptr<Playlist> pl; boost::shared_ptr<Playlist> pl;
if ((ds = atv->get_diskstream()) && ((pl = ds->playlist()))) { if ((ds = rtv->get_diskstream()) && ((pl = ds->playlist()))) {
Playlist::RegionList* regions = pl->regions_at ((nframes64_t) floor ( (double)where * ds->speed())); Playlist::RegionList* regions = pl->regions_at (
(nframes64_t) floor ( (double)where * ds->speed()));
for (Playlist::RegionList::iterator i = regions->begin(); i != regions->end(); ++i) { for (Playlist::RegionList::iterator i = regions->begin(); i != regions->end(); ++i) {
RegionView* rv = rtv->view()->find_view (*i);
RegionView* rv = atv->audio_view()->find_view (*i);
if (rv) { if (rv) {
rs.add (rv); rs.add (rv);
} }
@ -5004,20 +5001,19 @@ Editor::get_regions_after (RegionSelection& rs, nframes64_t where, const TrackSe
} }
for (TrackSelection::const_iterator t = tracks->begin(); t != tracks->end(); ++t) { for (TrackSelection::const_iterator t = tracks->begin(); t != tracks->end(); ++t) {
RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*>(*t);
AudioTimeAxisView* atv = dynamic_cast<AudioTimeAxisView*>(*t); if (rtv) {
if (atv) {
boost::shared_ptr<Diskstream> ds; boost::shared_ptr<Diskstream> ds;
boost::shared_ptr<Playlist> pl; boost::shared_ptr<Playlist> pl;
if ((ds = atv->get_diskstream()) && ((pl = ds->playlist()))) { if ((ds = rtv->get_diskstream()) && ((pl = ds->playlist()))) {
Playlist::RegionList* regions = pl->regions_touched ((nframes64_t) floor ( (double)where * ds->speed()), max_frames); Playlist::RegionList* regions = pl->regions_touched (
(nframes64_t) floor ( (double)where * ds->speed()), max_frames);
for (Playlist::RegionList::iterator i = regions->begin(); i != regions->end(); ++i) { for (Playlist::RegionList::iterator i = regions->begin(); i != regions->end(); ++i) {
RegionView* rv = atv->audio_view()->find_view (*i); RegionView* rv = rtv->view()->find_view (*i);
if (rv) { if (rv) {
rs.push_back (rv); rs.push_back (rv);

View file

@ -462,7 +462,7 @@ Editor::idle_drop_paths (vector<ustring> paths, nframes64_t frame, double ypos)
void void
Editor::drop_paths_part_two (const vector<ustring>& paths, nframes64_t frame, double ypos) Editor::drop_paths_part_two (const vector<ustring>& paths, nframes64_t frame, double ypos)
{ {
AudioTimeAxisView* tv; RouteTimeAxisView* tv;
std::pair<TimeAxisView*, int> const tvp = trackview_by_y_position (ypos); std::pair<TimeAxisView*, int> const tvp = trackview_by_y_position (ypos);
if (tvp.first == 0) { if (tvp.first == 0) {
@ -477,7 +477,7 @@ Editor::drop_paths_part_two (const vector<ustring>& paths, nframes64_t frame, do
do_embed (paths, Editing::ImportDistinctFiles, ImportAsTrack, frame); do_embed (paths, Editing::ImportDistinctFiles, ImportAsTrack, frame);
} }
} else if ((tv = dynamic_cast<AudioTimeAxisView*> (tvp.first)) != 0) { } else if ((tv = dynamic_cast<RouteTimeAxisView*> (tvp.first)) != 0) {
/* check that its an audio track, not a bus */ /* check that its an audio track, not a bus */

View file

@ -174,26 +174,26 @@ Editor::split_regions_at (nframes64_t where, RegionSelection& regions)
} }
AudioRegionView* const arv = dynamic_cast<AudioRegionView*>(*a); AudioRegionView* const arv = dynamic_cast<AudioRegionView*>(*a);
if (arv) { if (arv) {
_new_regionviews_show_envelope = arv->envelope_visible(); _new_regionviews_show_envelope = arv->envelope_visible();
} }
if (pl) { if (pl) {
XMLNode &before = pl->get_state(); XMLNode &before = pl->get_state();
pl->split_region ((*a)->region(), where); pl->split_region ((*a)->region(), where);
XMLNode &after = pl->get_state(); XMLNode &after = pl->get_state();
session->add_command(new MementoCommand<Playlist>(*pl, &before, &after)); session->add_command(new MementoCommand<Playlist>(*pl, &before, &after));
} }
a = tmp; a = tmp;
} }
while (used_playlists.size() > 0) {
while (used_playlists.size() > 0) {
list <boost::shared_ptr<Playlist > >::iterator i = used_playlists.begin(); list <boost::shared_ptr<Playlist > >::iterator i = used_playlists.begin();
(*i)->thaw(); (*i)->thaw();
used_playlists.pop_front(); used_playlists.pop_front();
} }
commit_reversible_command (); commit_reversible_command ();
_new_regionviews_show_envelope = false; _new_regionviews_show_envelope = false;
} }
@ -1157,11 +1157,11 @@ Editor::selected_marker_to_region_point (RegionPoint point, int32_t dir)
} }
float speed = 1.0f; float speed = 1.0f;
AudioTimeAxisView *atav; RouteTimeAxisView *rtav;
if ( ontrack != 0 && (atav = dynamic_cast<AudioTimeAxisView*>(ontrack)) != 0 ) { if (ontrack != 0 && (rtav = dynamic_cast<RouteTimeAxisView*>(ontrack)) != 0) {
if (atav->get_diskstream() != 0) { if (rtav->get_diskstream() != 0) {
speed = atav->get_diskstream()->speed(); speed = rtav->get_diskstream()->speed();
} }
} }
@ -2761,10 +2761,8 @@ Editor::region_from_selection ()
nframes64_t selection_cnt = end - start + 1; nframes64_t selection_cnt = end - start + 1;
for (TrackSelection::iterator i = selection->tracks.begin(); i != selection->tracks.end(); ++i) { for (TrackSelection::iterator i = selection->tracks.begin(); i != selection->tracks.end(); ++i) {
boost::shared_ptr<AudioRegion> current; boost::shared_ptr<Region> current;
boost::shared_ptr<Region> current_r;
boost::shared_ptr<Playlist> pl; boost::shared_ptr<Playlist> pl;
nframes64_t internal_start; nframes64_t internal_start;
string new_name; string new_name;
@ -2772,17 +2770,14 @@ Editor::region_from_selection ()
continue; continue;
} }
if ((current_r = pl->top_region_at (start)) == 0) { if ((current = pl->top_region_at (start)) == 0) {
continue; continue;
} }
current = boost::dynamic_pointer_cast<AudioRegion> (current_r); internal_start = start - current->position();
assert(current); // FIXME session->region_name (new_name, current->name(), true);
if (current != 0) { boost::shared_ptr<Region> region (RegionFactory::create (current,
internal_start = start - current->position(); internal_start, selection_cnt, new_name));
session->region_name (new_name, current->name(), true);
boost::shared_ptr<Region> region (RegionFactory::create (current, internal_start, selection_cnt, new_name));
}
} }
} }
@ -2799,9 +2794,7 @@ Editor::create_region_from_selection (vector<boost::shared_ptr<Region> >& new_re
sort_track_selection (); sort_track_selection ();
for (TrackSelection::iterator i = selection->tracks.begin(); i != selection->tracks.end(); ++i) { for (TrackSelection::iterator i = selection->tracks.begin(); i != selection->tracks.end(); ++i) {
boost::shared_ptr<Region> current;
boost::shared_ptr<AudioRegion> current;
boost::shared_ptr<Region> current_r;
boost::shared_ptr<Playlist> playlist; boost::shared_ptr<Playlist> playlist;
nframes64_t internal_start; nframes64_t internal_start;
string new_name; string new_name;
@ -2810,18 +2803,15 @@ Editor::create_region_from_selection (vector<boost::shared_ptr<Region> >& new_re
continue; continue;
} }
if ((current_r = playlist->top_region_at(start)) == 0) { if ((current = playlist->top_region_at(start)) == 0) {
continue; continue;
} }
if ((current = boost::dynamic_pointer_cast<AudioRegion>(current_r)) == 0) {
continue;
}
internal_start = start - current->position(); internal_start = start - current->position();
session->region_name (new_name, current->name(), true); session->region_name (new_name, current->name(), true);
new_regions.push_back (boost::dynamic_pointer_cast<AudioRegion> (RegionFactory::create (current, internal_start, end - start + 1, new_name))); new_regions.push_back (RegionFactory::create (current,
internal_start, end - start + 1, new_name));
} }
} }
@ -2836,17 +2826,10 @@ Editor::split_multichannel_region ()
return; return;
} }
vector<boost::shared_ptr<AudioRegion> > v; vector< boost::shared_ptr<Region> > v;
for (list<RegionView*>::iterator x = rs.begin(); x != rs.end(); ++x) { for (list<RegionView*>::iterator x = rs.begin(); x != rs.end(); ++x) {
(*x)->region()->separate_by_channel (*session, v);
AudioRegionView* arv = dynamic_cast<AudioRegionView*>(*x);
if (!arv || arv->audio_region()->n_channels() < 2) {
continue;
}
(arv)->audio_region()->separate_by_channel (*session, v);
} }
} }
@ -2905,9 +2888,6 @@ Editor::separate_regions_between (const TimeSelection& ts)
sort_track_selection (&tmptracks); sort_track_selection (&tmptracks);
for (TrackSelection::iterator i = tmptracks.begin(); i != tmptracks.end(); ++i) { for (TrackSelection::iterator i = tmptracks.begin(); i != tmptracks.end(); ++i) {
RouteTimeAxisView* rtv; RouteTimeAxisView* rtv;
@ -2937,10 +2917,12 @@ Editor::separate_regions_between (const TimeSelection& ts)
for (list<AudioRange>::const_iterator t = ts.begin(); t != ts.end(); ++t) { for (list<AudioRange>::const_iterator t = ts.begin(); t != ts.end(); ++t) {
sigc::connection c = rtv->view()->RegionViewAdded.connect (mem_fun(*this, &Editor::collect_new_region_view)); sigc::connection c = rtv->view()->RegionViewAdded.connect (
mem_fun(*this, &Editor::collect_new_region_view));
latest_regionviews.clear (); latest_regionviews.clear ();
playlist->partition ((nframes64_t)((*t).start * speed), (nframes64_t)((*t).end * speed), true); playlist->partition ((nframes64_t)((*t).start * speed),
(nframes64_t)((*t).end * speed), true);
c.disconnect (); c.disconnect ();
@ -2948,15 +2930,17 @@ Editor::separate_regions_between (const TimeSelection& ts)
got_some = true; got_some = true;
rtv->view()->foreach_regionview (bind (sigc::ptr_fun (add_if_covered), &(*t), &new_selection)); rtv->view()->foreach_regionview (bind (
sigc::ptr_fun (add_if_covered),
&(*t), &new_selection));
if (!in_command) { if (!in_command) {
begin_reversible_command (_("separate")); begin_reversible_command (_("separate"));
in_command = true; in_command = true;
} }
session->add_command(new MementoCommand<Playlist>(*playlist, before, &playlist->get_state())); session->add_command(new MementoCommand<Playlist>(
*playlist, before, &playlist->get_state()));
} }
} }
@ -3506,24 +3490,18 @@ Editor::trim_region_to_location (const Location& loc, const char* str)
begin_reversible_command (str); begin_reversible_command (str);
for (RegionSelection::iterator x = rs.begin(); x != rs.end(); ++x) { for (RegionSelection::iterator x = rs.begin(); x != rs.end(); ++x) {
AudioRegionView* arv = dynamic_cast<AudioRegionView*> (*x); RegionView* rv = (*x);
if (!arv) {
continue;
}
/* require region to span proposed trim */ /* require region to span proposed trim */
switch (rv->region()->coverage (loc.start(), loc.end())) {
switch (arv->region()->coverage (loc.start(), loc.end())) {
case OverlapInternal: case OverlapInternal:
break; break;
default: default:
continue; continue;
} }
AudioTimeAxisView* atav = dynamic_cast<AudioTimeAxisView*> (&arv->get_time_axis_view()); RouteTimeAxisView* tav = dynamic_cast<RouteTimeAxisView*> (&rv->get_time_axis_view());
if (!tav) {
if (!atav) {
return; return;
} }
@ -3531,17 +3509,18 @@ Editor::trim_region_to_location (const Location& loc, const char* str)
nframes64_t start; nframes64_t start;
nframes64_t end; nframes64_t end;
if (atav->get_diskstream() != 0) { if (tav->get_diskstream() != 0) {
speed = atav->get_diskstream()->speed(); speed = tav->get_diskstream()->speed();
} }
start = session_frame_to_track_frame (loc.start(), speed); start = session_frame_to_track_frame (loc.start(), speed);
end = session_frame_to_track_frame (loc.end(), speed); end = session_frame_to_track_frame (loc.end(), speed);
XMLNode &before = arv->region()->playlist()->get_state(); XMLNode &before = rv->region()->playlist()->get_state();
arv->region()->trim_to (start, (end - start), this); rv->region()->trim_to (start, (end - start), this);
XMLNode &after = arv->region()->playlist()->get_state(); XMLNode &after = rv->region()->playlist()->get_state();
session->add_command(new MementoCommand<Playlist>(*(arv->region()->playlist()), &before, &after)); session->add_command(new MementoCommand<Playlist>(
*(rv->region()->playlist()), &before, &after));
} }
commit_reversible_command (); commit_reversible_command ();
@ -3559,34 +3538,29 @@ Editor::trim_region_to_edit_point ()
begin_reversible_command (_("trim region start to edit point")); begin_reversible_command (_("trim region start to edit point"));
for (RegionSelection::iterator x = rs.begin(); x != rs.end(); ++x) { for (RegionSelection::iterator x = rs.begin(); x != rs.end(); ++x) {
AudioRegionView* arv = dynamic_cast<AudioRegionView*> (*x); RegionView* rv = (*x);
if (!arv) {
continue;
}
/* require region to cover trim */ /* require region to cover trim */
if (!rv->region()->covers (where)) {
if (!arv->region()->covers (where)) {
continue; continue;
} }
AudioTimeAxisView* atav = dynamic_cast<AudioTimeAxisView*> (&arv->get_time_axis_view()); RouteTimeAxisView* tav = dynamic_cast<RouteTimeAxisView*> (&rv->get_time_axis_view());
if (!tav) {
if (!atav) {
return; return;
} }
float speed = 1.0; float speed = 1.0;
if (atav->get_diskstream() != 0) { if (tav->get_diskstream() != 0) {
speed = atav->get_diskstream()->speed(); speed = tav->get_diskstream()->speed();
} }
XMLNode &before = arv->region()->playlist()->get_state(); XMLNode &before = rv->region()->playlist()->get_state();
arv->region()->trim_end( session_frame_to_track_frame(where, speed), this); rv->region()->trim_end( session_frame_to_track_frame(where, speed), this);
XMLNode &after = arv->region()->playlist()->get_state(); XMLNode &after = rv->region()->playlist()->get_state();
session->add_command(new MementoCommand<Playlist>(*(arv->region()->playlist()), &before, &after)); session->add_command(new MementoCommand<Playlist>(
*(rv->region()->playlist()), &before, &after));
} }
commit_reversible_command (); commit_reversible_command ();
@ -3604,34 +3578,29 @@ Editor::trim_region_from_edit_point ()
begin_reversible_command (_("trim region end to edit point")); begin_reversible_command (_("trim region end to edit point"));
for (RegionSelection::iterator x = rs.begin(); x != rs.end(); ++x) { for (RegionSelection::iterator x = rs.begin(); x != rs.end(); ++x) {
AudioRegionView* arv = dynamic_cast<AudioRegionView*> (*x); RegionView* rv = (*x);
if (!arv) {
continue;
}
/* require region to cover trim */ /* require region to cover trim */
if (!rv->region()->covers (where)) {
if (!arv->region()->covers (where)) {
continue; continue;
} }
AudioTimeAxisView* atav = dynamic_cast<AudioTimeAxisView*> (&arv->get_time_axis_view()); RouteTimeAxisView* tav = dynamic_cast<RouteTimeAxisView*> (&rv->get_time_axis_view());
if (!tav) {
if (!atav) {
return; return;
} }
float speed = 1.0; float speed = 1.0;
if (atav->get_diskstream() != 0) { if (tav->get_diskstream() != 0) {
speed = atav->get_diskstream()->speed(); speed = tav->get_diskstream()->speed();
} }
XMLNode &before = arv->region()->playlist()->get_state(); XMLNode &before = rv->region()->playlist()->get_state();
arv->region()->trim_front ( session_frame_to_track_frame(where, speed), this); rv->region()->trim_front ( session_frame_to_track_frame(where, speed), this);
XMLNode &after = arv->region()->playlist()->get_state(); XMLNode &after = rv->region()->playlist()->get_state();
session->add_command(new MementoCommand<Playlist>(*(arv->region()->playlist()), &before, &after)); session->add_command(new MementoCommand<Playlist>(
*(rv->region()->playlist()), &before, &after));
} }
commit_reversible_command (); commit_reversible_command ();
@ -3640,11 +3609,11 @@ Editor::trim_region_from_edit_point ()
void void
Editor::unfreeze_route () Editor::unfreeze_route ()
{ {
if (clicked_routeview == 0 || !clicked_routeview->is_audio_track()) { if (clicked_routeview == 0 || !clicked_routeview->is_track()) {
return; return;
} }
clicked_routeview->audio_track()->unfreeze (); clicked_routeview->track()->unfreeze ();
} }
void* void*

View file

@ -57,8 +57,8 @@ StreamView::StreamView (RouteTimeAxisView& tv, ArdourCanvas::Group* group)
, region_color(_trackview.color()) , region_color(_trackview.color())
, stream_base_color(0xFFFFFFFF) , stream_base_color(0xFFFFFFFF)
, _layers (1) , _layers (1)
, height(tv.height)
, _layer_display (Overlaid) , _layer_display (Overlaid)
, height(tv.height)
, last_rec_data_frame(0) , last_rec_data_frame(0)
{ {
/* set_position() will position the group */ /* set_position() will position the group */

View file

@ -42,8 +42,8 @@ namespace ARDOUR {
struct RecBoxInfo { struct RecBoxInfo {
ArdourCanvas::SimpleRect* rectangle; ArdourCanvas::SimpleRect* rectangle;
nframes_t start; nframes_t start;
nframes_t length; nframes_t length;
}; };
class PublicEditor; class PublicEditor;
@ -107,19 +107,16 @@ public:
protected: protected:
StreamView (RouteTimeAxisView&, ArdourCanvas::Group* group = NULL); StreamView (RouteTimeAxisView&, ArdourCanvas::Group* group = NULL);
//private: (FIXME?)
void transport_changed(); void transport_changed();
void transport_looped(); void transport_looped();
void rec_enable_changed(); void rec_enable_changed();
void sess_rec_enable_changed(); void sess_rec_enable_changed();
virtual void setup_rec_box () = 0; virtual void setup_rec_box () = 0;
void update_rec_box (); void update_rec_box ();
//virtual void update_rec_regions () = 0;
virtual RegionView* add_region_view_internal (boost::shared_ptr<ARDOUR::Region>, bool wait_for_waves, bool recording = false) = 0; virtual RegionView* add_region_view_internal (boost::shared_ptr<ARDOUR::Region>,
bool wait_for_waves, bool recording = false) = 0;
virtual void remove_region_view (boost::weak_ptr<ARDOUR::Region> ); virtual void remove_region_view (boost::weak_ptr<ARDOUR::Region> );
//void remove_rec_region (boost::shared_ptr<ARDOUR::Region>); (unused)
void display_diskstream (boost::shared_ptr<ARDOUR::Diskstream>); void display_diskstream (boost::shared_ptr<ARDOUR::Diskstream>);
virtual void undisplay_diskstream (); virtual void undisplay_diskstream ();
@ -158,14 +155,14 @@ protected:
sigc::connection playlist_change_connection; sigc::connection playlist_change_connection;
ARDOUR::layer_t _layers; ARDOUR::layer_t _layers;
LayerDisplay _layer_display;
double height; double height;
LayerDisplay _layer_display;
list<sigc::connection> rec_data_ready_connections; list<sigc::connection> rec_data_ready_connections;
jack_nframes_t last_rec_data_frame; jack_nframes_t last_rec_data_frame;
private: private:
void update_coverage_frames (); void update_coverage_frames ();
}; };

View file

@ -136,7 +136,7 @@ class AudioRegion : public Region
void set_envelope_active (bool yn); void set_envelope_active (bool yn);
void set_default_envelope (); void set_default_envelope ();
int separate_by_channel (ARDOUR::Session&, vector<boost::shared_ptr<AudioRegion> >&) const; int separate_by_channel (ARDOUR::Session&, vector<boost::shared_ptr<Region> >&) const;
/* automation */ /* automation */

View file

@ -72,7 +72,7 @@ class MidiRegion : public Region
XMLNode& state (bool); XMLNode& state (bool);
int set_state (const XMLNode&); int set_state (const XMLNode&);
int separate_by_channel (ARDOUR::Session&, vector<MidiRegion*>&) const; int separate_by_channel (ARDOUR::Session&, vector< boost::shared_ptr<Region> >&) const;
/* automation */ /* automation */

View file

@ -254,6 +254,11 @@ class Region
// no transients, but its OK // no transients, but its OK
return 0; return 0;
} }
virtual int separate_by_channel (ARDOUR::Session&,
std::vector< boost::shared_ptr<Region> >&) const {
return 0;
}
void invalidate_transients (); void invalidate_transients ();

View file

@ -1014,20 +1014,17 @@ AudioRegion::recompute_at_start ()
} }
int int
AudioRegion::separate_by_channel (Session& session, vector<boost::shared_ptr<AudioRegion> >& v) const AudioRegion::separate_by_channel (Session& session, vector<boost::shared_ptr<Region> >& v) const
{ {
SourceList srcs; SourceList srcs;
string new_name; string new_name;
int n; int n = 0;
if (_sources.size() < 2) { if (_sources.size() < 2) {
return 0; return 0;
} }
n = 0;
for (SourceList::const_iterator i = _sources.begin(); i != _sources.end(); ++i) { for (SourceList::const_iterator i = _sources.begin(); i != _sources.end(); ++i) {
srcs.clear (); srcs.clear ();
srcs.push_back (*i); srcs.push_back (*i);
@ -1044,16 +1041,13 @@ AudioRegion::separate_by_channel (Session& session, vector<boost::shared_ptr<Aud
new_name += ('0' + n + 1); new_name += ('0' + n + 1);
} }
/* create a copy with just one source. prevent if from being thought of as "whole file" even if /* create a copy with just one source. prevent if from being thought of as
it covers the entire source file(s). "whole file" even if it covers the entire source file(s).
*/ */
Flag f = Flag (_flags & ~WholeFile); Flag f = Flag (_flags & ~WholeFile);
boost::shared_ptr<Region> r = RegionFactory::create (srcs, _start, _length, new_name, _layer, f); v.push_back(RegionFactory::create (srcs, _start, _length, new_name, _layer, f));
boost::shared_ptr<AudioRegion> ar = boost::dynamic_pointer_cast<AudioRegion> (r);
v.push_back (ar);
++n; ++n;
} }

View file

@ -303,33 +303,9 @@ MidiRegion::recompute_at_start ()
} }
int int
MidiRegion::separate_by_channel (Session& session, vector<MidiRegion*>& v) const MidiRegion::separate_by_channel (ARDOUR::Session&, vector< boost::shared_ptr<Region> >&) const
{ {
// Separate by MIDI channel? bit different from audio since this is separating based // TODO
// on the actual contained data and destructively modifies and creates new sources..
#if 0
SourceList srcs;
string new_name;
for (SourceList::const_iterator i = _master_sources.begin(); i != _master_sources.end(); ++i) {
srcs.clear ();
srcs.push_back (*i);
/* generate a new name */
if (session.region_name (new_name, _name)) {
return -1;
}
/* create a copy with just one source */
v.push_back (new MidiRegion (srcs, _start, _length, new_name, _layer, _flags));
}
#endif
// Actually, I would prefer not if that's alright
return -1; return -1;
} }