fix reload of region gain envelopes, freeze works from start ... end instead of zero ... end; prep for bouncing-before-tape-mode

git-svn-id: svn://localhost/ardour2/trunk@1105 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis
2006-11-11 03:22:41 +00:00
parent 90263f9a6d
commit 55b143d013
9 changed files with 58 additions and 13 deletions

View File

@@ -480,8 +480,6 @@ RouteTimeAxisView::set_track_mode (TrackMode mode)
RadioMenuItem* item;
RadioMenuItem* other_item;
cerr << "STM, mode = " << mode;
switch (mode) {
case ARDOUR::Normal:
item = normal_track_mode_item;
@@ -498,10 +496,28 @@ RouteTimeAxisView::set_track_mode (TrackMode mode)
}
if (item->get_active () && track()->mode() != mode) {
if (track()->set_mode (mode)) {
Glib::signal_idle().connect (bind (sigc::ptr_fun (__reset_item), other_item));
_set_track_mode (track(), mode, other_item);
}
}
void
RouteTimeAxisView::_set_track_mode (Track* track, TrackMode mode, RadioMenuItem* reset_item)
{
bool needs_bounce;
if (!track->can_use_mode (mode, needs_bounce)) {
if (!needs_bounce) {
/* cannot be done */
Glib::signal_idle().connect (bind (sigc::ptr_fun (__reset_item), reset_item));
return;
} else {
cerr << "would bounce this one\n";
return;
}
}
track->set_mode (mode);
}
void

View File

@@ -234,6 +234,7 @@ protected:
ArdourCanvas::SimpleRect* timestretch_rect;
void set_track_mode (ARDOUR::TrackMode);
void _set_track_mode (ARDOUR::Track* track, ARDOUR::TrackMode mode, Gtk::RadioMenuItem* reset_item);
void track_mode_changed ();
list<RedirectAutomationInfo*> redirect_automation;

View File

@@ -78,6 +78,7 @@ class AudioDiskstream : public Diskstream
void set_record_enabled (bool yn);
int set_destructive (bool yn);
bool can_become_destructive (bool& requires_bounce) const;
float peak_power(uint32_t n=0) {
float x = channels[n].peak_power;
@@ -252,8 +253,6 @@ class AudioDiskstream : public Diskstream
typedef vector<ChannelInfo> ChannelList;
ChannelList channels;
bool can_become_destructive () const;
};
} // namespace ARDOUR

View File

@@ -38,6 +38,7 @@ class AudioTrack : public Track
~AudioTrack ();
int set_mode (TrackMode m);
bool can_use_mode (TrackMode m, bool& bounce_required);
int roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame,
nframes_t offset, int declick, bool can_record, bool rec_monitors_input);

View File

@@ -91,6 +91,7 @@ class IO;
bool destructive() const { return _flags & Destructive; }
virtual int set_destructive (bool yn) { return -1; }
virtual bool can_become_destructive (bool& requires_bounce) const { return false; }
bool hidden() const { return _flags & Hidden; }
bool recordable() const { return _flags & Recordable; }

View File

@@ -41,6 +41,7 @@ class Track : public Route
TrackMode mode () const { return _mode; }
virtual int set_mode (TrackMode m) { return false; }
virtual bool can_use_mode (TrackMode m, bool& bounce_required) { return false; }
sigc::signal<void> TrackModeChanged;
virtual int roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame,

View File

@@ -2240,10 +2240,15 @@ AudioDiskstream::use_pending_capture_data (XMLNode& node)
int
AudioDiskstream::set_destructive (bool yn)
{
bool bounce_ignored;
if (yn != destructive()) {
if (yn) {
if (!can_become_destructive ()) {
/* requestor should already have checked this and
bounced if necessary and desired
*/
if (!can_become_destructive (bounce_ignored)) {
return -1;
}
_flags |= Destructive;
@@ -2258,15 +2263,17 @@ AudioDiskstream::set_destructive (bool yn)
}
bool
AudioDiskstream::can_become_destructive () const
AudioDiskstream::can_become_destructive (bool& requires_bounce) const
{
if (!_playlist) {
requires_bounce = false;
return false;
}
/* is there only one region ? */
if (_playlist->n_regions() != 1) {
requires_bounce = true;
return false;
}
@@ -2277,6 +2284,7 @@ AudioDiskstream::can_become_destructive () const
if (first->position() != _session.current_start_frame()) {
if (first->start() > _session.current_start_frame()) {
requires_bounce = true;
return false;
}
}
@@ -2288,8 +2296,10 @@ AudioDiskstream::can_become_destructive () const
assert (afirst);
if (afirst->source()->used() > 1) {
requires_bounce = true;
return false;
}
requires_bounce = false;
return true;
}

View File

@@ -89,6 +89,19 @@ AudioTrack::set_mode (TrackMode m)
return 0;
}
bool
AudioTrack::can_use_mode (TrackMode m, bool& bounce_required)
{
switch (m) {
case Normal:
bounce_required = false;
return true;
case Destructive:
return _diskstream->can_become_destructive (bounce_required);
}
}
int
AudioTrack::deprecated_use_diskstream_connections ()
{
@@ -810,7 +823,7 @@ AudioTrack::freeze (InterThreadInfo& itt)
return;
}
if (_session.write_one_audio_track (*this, 0, _session.current_end_frame(), true, srcs, itt)) {
if (_session.write_one_audio_track (*this, _session.current_start_frame(), _session.current_end_frame(), true, srcs, itt)) {
return;
}
@@ -830,9 +843,6 @@ AudioTrack::freeze (InterThreadInfo& itt)
frii->id = insert->id();
#ifdef FIX_ME_TO_WORK_WITHOUT_STATE_MANAGER
frii->memento = (*r)->get_memento();
#endif
_freeze_record.insert_info.push_back (frii);
/* now deactivate the insert */
@@ -853,7 +863,7 @@ AudioTrack::freeze (InterThreadInfo& itt)
false));
new_playlist->set_orig_diskstream_id (diskstream->id());
new_playlist->add_region (region, 0);
new_playlist->add_region (region, _session.current_start_frame());
new_playlist->set_frozen (true);
region->set_locked (true);

View File

@@ -1246,6 +1246,7 @@ int
AutomationList::set_state (const XMLNode& node)
{
XMLNodeList nlist = node.children();
XMLNode* nsos;
XMLNodeIterator niter;
const XMLProperty* prop;
@@ -1254,6 +1255,11 @@ AutomationList::set_state (const XMLNode& node)
return deserialize_events (node);
}
if (node.name() == X_("Envelope") && (nsos = node.child (X_("AutomationList")))) {
/* new school in old school clothing */
return set_state (*nsos);
}
if (node.name() == X_("Envelope") || node.name() == X_("FadeOut") || node.name() == X_("FadeIn")) {
/* old school */