various fixes to named selection mgmt and display, plus fixes for xfade mgmt and a bit of debugging for them too

git-svn-id: svn://localhost/ardour2/trunk@1313 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis
2007-01-11 21:45:21 +00:00
parent e545b222b9
commit bb02870c15
13 changed files with 225 additions and 167 deletions

View File

@@ -405,6 +405,7 @@ AudioPlaylist::check_dependents (boost::shared_ptr<Region> r, bool norefresh)
xfade_length = min ((nframes_t) 720, top->length());
xfade = boost::shared_ptr<Crossfade> (new Crossfade (top, bottom, xfade_length, top->first_frame(), StartOfIn));
cerr << "StartOfIn is " << xfade << endl;
add_crossfade (xfade);
if (top_region_at (top->last_frame() - 1) == top) {
@@ -414,6 +415,7 @@ AudioPlaylist::check_dependents (boost::shared_ptr<Region> r, bool norefresh)
*/
xfade = boost::shared_ptr<Crossfade> (new Crossfade (bottom, top, xfade_length, top->last_frame() - xfade_length, EndOfOut));
cerr << "EndofOut is " << xfade << endl;
add_crossfade (xfade);
}
break;

View File

@@ -87,13 +87,9 @@ Crossfade::Crossfade (boost::shared_ptr<AudioRegion> in, boost::shared_ptr<Audio
_position = position;
_anchor_point = ap;
switch (Config->get_xfade_model()) {
case ShortCrossfade:
_follow_overlap = false;
break;
default:
_follow_overlap = true;
}
_follow_overlap = false;
cerr << "A: follow overlap = " << _follow_overlap << endl;
_active = Config->get_xfades_active ();
_fixed = true;
@@ -116,6 +112,7 @@ Crossfade::Crossfade (boost::shared_ptr<AudioRegion> a, boost::shared_ptr<AudioR
initialize ();
cerr << "K: follow overlap = " << _follow_overlap << endl;
}
Crossfade::Crossfade (const Playlist& playlist, XMLNode& node)
@@ -170,6 +167,9 @@ Crossfade::Crossfade (const Playlist& playlist, XMLNode& node)
if (set_state (node)) {
throw failed_constructor();
}
cerr << "D: follow overlap = " << _follow_overlap << endl;
}
Crossfade::Crossfade (const Crossfade &orig, boost::shared_ptr<AudioRegion> newin, boost::shared_ptr<AudioRegion> newout)
@@ -197,12 +197,15 @@ Crossfade::Crossfade (const Crossfade &orig, boost::shared_ptr<AudioRegion> newi
// Let's make sure the fade isn't too long
set_length(_length);
cerr << "B: follow overlap = " << _follow_overlap << endl;
}
Crossfade::~Crossfade ()
{
cerr << "Crossfade deleted\n";
cerr << this << " Crossfade deleted\n";
notify_callbacks ();
}
@@ -261,8 +264,6 @@ Crossfade::compute (boost::shared_ptr<AudioRegion> a, boost::shared_ptr<AudioReg
if (top->first_frame() == bottom->first_frame()) {
cerr << "same start\n";
/* Both regions start at the same point */
if (top->last_frame() < bottom->last_frame()) {
@@ -303,8 +304,6 @@ Crossfade::compute (boost::shared_ptr<AudioRegion> a, boost::shared_ptr<AudioReg
} else if (top->last_frame() == bottom->last_frame()) {
cerr << "same end\n";
/* Both regions end at the same point */
if (top->first_frame() > bottom->first_frame()) {
@@ -343,21 +342,17 @@ Crossfade::compute (boost::shared_ptr<AudioRegion> a, boost::shared_ptr<AudioReg
OverlapType ot = top->coverage (bottom->first_frame(), bottom->last_frame());
cerr << "ot = " << ot << endl;
switch (ot) {
case OverlapNone:
/* should be NOTREACHED as a precondition of creating
a new crossfade, but we need to handle it here.
*/
cerr << "no sir\n";
throw NoCrossfadeHere();
break;
case OverlapInternal:
case OverlapExternal:
/* should be NOTREACHED because of tests above */
cerr << "nu-uh\n";
throw NoCrossfadeHere();
break;
@@ -516,11 +511,11 @@ Crossfade::refresh ()
return false;
}
if (_in->layer() < _out->layer()) {
cerr << "layer change, invalidated\n";
Invalidated (shared_from_this());
return false;
}
// if (_in->layer() < _out->layer()) {
// cerr << this << " layer change, invalidated, in on " << _in->layer() << " out on " << _out->layer() << endl;
// Invalidated (shared_from_this());
// return false;
// }
/* overlap type must be Start, End or External */
@@ -528,19 +523,10 @@ Crossfade::refresh ()
ot = _in->coverage (_out->first_frame(), _out->last_frame());
switch (ot) {
case OverlapNone:
case OverlapInternal:
Invalidated (shared_from_this());
return false;
default:
break;
}
/* overlap type must not have altered */
if (ot != overlap_type) {
cerr << this << " Invalid B\n";
Invalidated (shared_from_this());
return false;
}
@@ -555,13 +541,17 @@ Crossfade::update (bool force)
{
nframes_t newlen;
cerr << this << " update, " << _in->name() << " + " << _out->name() << " length = " << _length << endl;
if (_follow_overlap) {
newlen = _out->first_frame() + _out->length() - _in->first_frame();
cerr << "\tmodify length\n";
} else {
newlen = _length;
}
if (newlen == 0) {
cerr << this << " Invalid C\n";
Invalidated (shared_from_this());
return false;
}
@@ -579,29 +569,19 @@ Crossfade::update (bool force)
}
cerr << "\tFover = " << _follow_overlap << endl;
switch (_anchor_point) {
case StartOfIn:
if (_position != _in->first_frame()) {
if (_length > _short_xfade_length) {
/* assume FullCrossfade */
_position = _in->first_frame();
} else {
/* assume short xfade */
_position = _out->last_frame() - _length;
}
}
_position = _in->first_frame();
break;
case EndOfIn:
if (_position != _in->last_frame() - _length) {
_position = _in->last_frame() - _length;
}
_position = _in->last_frame() - _length;
break;
case EndOfOut:
if (_position != _out->last_frame() - _length) {
_position = _out->last_frame() - _length;
}
_position = _out->last_frame() - _length;
}
/* UI's may need to know that the overlap changed even

View File

@@ -40,8 +40,18 @@ NamedSelection::NamedSelection (string n, PlaylistList& l)
{
playlists = l;
for (PlaylistList::iterator i = playlists.begin(); i != playlists.end(); ++i) {
string new_name;
/* rename playlists to reflect our ownership */
new_name = name;
new_name += '/';
new_name += (*i)->name();
(*i)->set_name (new_name);
(*i)->use();
}
NamedSelectionCreated (this);
}
@@ -90,7 +100,8 @@ NamedSelection::NamedSelection (Session& session, const XMLNode& node)
NamedSelection::~NamedSelection ()
{
for (PlaylistList::iterator i = playlists.begin(); i != playlists.end(); ++i) {
(*i)->release();
(*i)->release ();
(*i)->GoingAway ();
}
}

View File

@@ -204,7 +204,6 @@ Playlist::release ()
}
}
void
Playlist::copy_regions (RegionList& newlist) const
{

View File

@@ -352,23 +352,34 @@ Session::Session (AudioEngine &eng,
}
}
if (control_out_channels) {
shared_ptr<Route> r (new Route (*this, _("monitor"), -1, control_out_channels, -1, control_out_channels, Route::ControlOut));
{
/* set up Master Out and Control Out if necessary */
RouteList rl;
rl.push_back (r);
add_routes (rl);
_control_out = r;
}
if (master_out_channels) {
shared_ptr<Route> r (new Route (*this, _("master"), -1, master_out_channels, -1, master_out_channels, Route::MasterOut));
RouteList rl;
rl.push_back (r);
add_routes (rl);
_master_out = r;
} else {
/* prohibit auto-connect to master, because there isn't one */
output_ac = AutoConnectOption (output_ac & ~AutoConnectMaster);
int control_id = 1;
if (control_out_channels) {
shared_ptr<Route> r (new Route (*this, _("monitor"), -1, control_out_channels, -1, control_out_channels, Route::ControlOut));
r->set_remote_control_id (control_id++);
rl.push_back (r);
}
if (master_out_channels) {
shared_ptr<Route> r (new Route (*this, _("master"), -1, master_out_channels, -1, master_out_channels, Route::MasterOut));
r->set_remote_control_id (control_id);
cerr << "master bus has remote control ID " << r->remote_control_id() << endl;
rl.push_back (r);
} else {
/* prohibit auto-connect to master, because there isn't one */
output_ac = AutoConnectOption (output_ac & ~AutoConnectMaster);
}
if (!rl.empty()) {
add_routes (rl);
}
}
Config->set_input_auto_connect (input_ac);
@@ -1639,7 +1650,7 @@ Session::new_audio_track (int input_channels, int output_channels, TrackMode mod
_engine.get_physical_outputs (physoutputs);
_engine.get_physical_inputs (physinputs);
control_id = 0;
control_id = ntracks() + nbusses() + 1;
while (how_many) {
@@ -1728,7 +1739,7 @@ Session::new_audio_track (int input_channels, int output_channels, TrackMode mod
}
track->DiskstreamChanged.connect (mem_fun (this, &Session::resort_routes));
track->set_remote_control_id (ntracks() + control_id + 1);
track->set_remote_control_id (control_id);
++control_id;
new_routes.push_back (track);
@@ -1761,6 +1772,7 @@ Session::new_audio_route (int input_channels, int output_channels, uint32_t how_
uint32_t n = 0;
string port;
RouteList ret;
uint32_t control_id;
/* count existing audio busses */
@@ -1781,6 +1793,7 @@ Session::new_audio_route (int input_channels, int output_channels, uint32_t how_
_engine.get_physical_outputs (physoutputs);
_engine.get_physical_inputs (physinputs);
control_id = ntracks() + nbusses() + 1;
while (how_many) {
@@ -1844,6 +1857,9 @@ Session::new_audio_route (int input_channels, int output_channels, uint32_t how_
bus->set_control_outs (cports);
}
bus->set_remote_control_id (control_id);
++control_id;
ret.push_back (bus);
}
@@ -3588,9 +3604,13 @@ Session::add_named_selection (NamedSelection* named_selection)
named_selections.insert (named_selections.begin(), named_selection);
}
for (list<boost::shared_ptr<Playlist> >::iterator i = named_selection->playlists.begin(); i != named_selection->playlists.end(); ++i) {
add_playlist (*i);
}
set_dirty();
NamedSelectionAdded (); /* EMIT SIGNAL */
NamedSelectionAdded (); /* EMIT SIGNAL */
}
void