summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2006-11-11 03:22:41 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2006-11-11 03:22:41 +0000
commit55b143d013166cf5c869f589b4f1ee3539ac5f09 (patch)
tree016712040db0921dde049067e86c9481f4a1c6d3
parent90263f9a6dcec5de1bf6cd305d194118333a81ef (diff)
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
-rw-r--r--gtk2_ardour/route_time_axis.cc24
-rw-r--r--gtk2_ardour/route_time_axis.h1
-rw-r--r--libs/ardour/ardour/audio_diskstream.h3
-rw-r--r--libs/ardour/ardour/audio_track.h1
-rw-r--r--libs/ardour/ardour/diskstream.h1
-rw-r--r--libs/ardour/ardour/track.h1
-rw-r--r--libs/ardour/audio_diskstream.cc14
-rw-r--r--libs/ardour/audio_track.cc20
-rw-r--r--libs/ardour/automation_event.cc6
9 files changed, 58 insertions, 13 deletions
diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc
index ab8ebb32b5..7ae1f860fc 100644
--- a/gtk2_ardour/route_time_axis.cc
+++ b/gtk2_ardour/route_time_axis.cc
@@ -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
diff --git a/gtk2_ardour/route_time_axis.h b/gtk2_ardour/route_time_axis.h
index 4a6f89e0af..cefe954c9a 100644
--- a/gtk2_ardour/route_time_axis.h
+++ b/gtk2_ardour/route_time_axis.h
@@ -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;
diff --git a/libs/ardour/ardour/audio_diskstream.h b/libs/ardour/ardour/audio_diskstream.h
index 74c804e5bb..5c24697972 100644
--- a/libs/ardour/ardour/audio_diskstream.h
+++ b/libs/ardour/ardour/audio_diskstream.h
@@ -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
diff --git a/libs/ardour/ardour/audio_track.h b/libs/ardour/ardour/audio_track.h
index ae299dae4a..f35bdd44be 100644
--- a/libs/ardour/ardour/audio_track.h
+++ b/libs/ardour/ardour/audio_track.h
@@ -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);
diff --git a/libs/ardour/ardour/diskstream.h b/libs/ardour/ardour/diskstream.h
index 4cee6d1268..6e0725033a 100644
--- a/libs/ardour/ardour/diskstream.h
+++ b/libs/ardour/ardour/diskstream.h
@@ -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; }
diff --git a/libs/ardour/ardour/track.h b/libs/ardour/ardour/track.h
index a24b614157..a2b0b9b90e 100644
--- a/libs/ardour/ardour/track.h
+++ b/libs/ardour/ardour/track.h
@@ -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,
diff --git a/libs/ardour/audio_diskstream.cc b/libs/ardour/audio_diskstream.cc
index 7e753fa601..5f682789ef 100644
--- a/libs/ardour/audio_diskstream.cc
+++ b/libs/ardour/audio_diskstream.cc
@@ -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;
}
diff --git a/libs/ardour/audio_track.cc b/libs/ardour/audio_track.cc
index 9c5020e9aa..46a843784c 100644
--- a/libs/ardour/audio_track.cc
+++ b/libs/ardour/audio_track.cc
@@ -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);
diff --git a/libs/ardour/automation_event.cc b/libs/ardour/automation_event.cc
index a2eeebed56..cc2554a704 100644
--- a/libs/ardour/automation_event.cc
+++ b/libs/ardour/automation_event.cc
@@ -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 */