Make "consolidate range" and "bounce range to region list" not apply processing to the original audio. Added variants which do apply processing. Plus changed AudioTrack::export_stuff() to use SSE mix functions for non-automated gain.

git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@4736 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Sampo Savolainen 2009-03-05 19:47:39 +00:00
parent cb3aaf44cb
commit a4ecfdedec
8 changed files with 21 additions and 19 deletions

View file

@ -2077,8 +2077,10 @@ Editor::add_selection_context_items (Menu_Helpers::MenuList& items)
items.push_back (MenuElem (_("Duplicate range"), bind (mem_fun(*this, &Editor::duplicate_dialog), false)));
items.push_back (MenuElem (_("Create chunk from range"), mem_fun(*this, &Editor::create_named_selection)));
items.push_back (SeparatorElem());
items.push_back (MenuElem (_("Consolidate range"), bind (mem_fun(*this, &Editor::bounce_range_selection), true)));
items.push_back (MenuElem (_("Bounce range to region list"), bind (mem_fun(*this, &Editor::bounce_range_selection), false)));
items.push_back (MenuElem (_("Consolidate range"), bind (mem_fun(*this, &Editor::bounce_range_selection), true, false)));
items.push_back (MenuElem (_("Consolidate range with processing"), bind (mem_fun(*this, &Editor::bounce_range_selection), true, true)));
items.push_back (MenuElem (_("Bounce range to region list"), bind (mem_fun(*this, &Editor::bounce_range_selection), false, false)));
items.push_back (MenuElem (_("Bounce range to region list with processing"), bind (mem_fun(*this, &Editor::bounce_range_selection), false, true)));
items.push_back (MenuElem (_("Export range"), mem_fun(*this, &Editor::export_selection)));
}

View file

@ -1919,7 +1919,7 @@ public:
bool write_region (string path, boost::shared_ptr<ARDOUR::AudioRegion>);
void export_region ();
void bounce_region_selection ();
void bounce_range_selection (bool replace);
void bounce_range_selection (bool replace, bool enable_processing = true);
void external_edit_region ();
int write_audio_selection (TimeSelection&);

View file

@ -3666,7 +3666,7 @@ Editor::freeze_route ()
}
void
Editor::bounce_range_selection (bool replace)
Editor::bounce_range_selection (bool replace, bool enable_processing)
{
if (selection->time.empty()) {
return;
@ -3701,7 +3701,7 @@ Editor::bounce_range_selection (bool replace)
itt.progress = false;
XMLNode &before = playlist->get_state();
boost::shared_ptr<Region> r = atv->audio_track()->bounce_range (start, start+cnt, itt);
boost::shared_ptr<Region> r = atv->audio_track()->bounce_range (start, start+cnt, itt, enable_processing);
if (replace) {
list<AudioRange> ranges;

View file

@ -54,13 +54,13 @@ class AudioTrack : public Track
int use_diskstream (const PBD::ID& id);
void use_new_diskstream ();
int export_stuff (vector<Sample*>& buffers, uint32_t nbufs, nframes_t nframes, nframes_t end_frame);
int export_stuff (vector<Sample*>& buffers, uint32_t nbufs, nframes_t nframes, nframes_t end_frame, bool enable_processing = true);
void freeze (InterThreadInfo&);
void unfreeze ();
boost::shared_ptr<Region> bounce (InterThreadInfo&);
boost::shared_ptr<Region> bounce_range (nframes_t start, nframes_t end, InterThreadInfo&);
boost::shared_ptr<Region> bounce_range (nframes_t start, nframes_t end, InterThreadInfo&, bool enable_processing);
int set_state(const XMLNode& node);

View file

@ -711,8 +711,7 @@ class Session : public PBD::StatefulDestructible
/* flattening stuff */
boost::shared_ptr<Region> write_one_audio_track (AudioTrack&, nframes_t start, nframes_t end, bool overwrite, vector<boost::shared_ptr<AudioSource> >&,
InterThreadInfo& wot);
boost::shared_ptr<Region> write_one_audio_track (AudioTrack&, nframes_t start, nframes_t end, bool overwrite, vector<boost::shared_ptr<AudioSource> >&, InterThreadInfo& wot, bool enable_processing = true);
int freeze (InterThreadInfo&);
/* session-wide solo/mute/rec-enable */

View file

@ -77,7 +77,7 @@ class Track : public Route
virtual void unfreeze () = 0;
virtual boost::shared_ptr<Region> bounce (InterThreadInfo&) = 0;
virtual boost::shared_ptr<Region> bounce_range (nframes_t start, nframes_t end, InterThreadInfo&) = 0;
virtual boost::shared_ptr<Region> bounce_range (nframes_t start, nframes_t end, InterThreadInfo&, bool enable_processing = true) = 0;
XMLNode& get_state();
XMLNode& get_template();

View file

@ -37,6 +37,7 @@
#include <ardour/playlist_factory.h>
#include <ardour/panner.h>
#include <ardour/utils.h>
#include <ardour/mix.h>
#include "i18n.h"
@ -740,7 +741,7 @@ AudioTrack::silent_roll (nframes_t nframes, nframes_t start_frame, nframes_t end
}
int
AudioTrack::export_stuff (vector<Sample*>& buffers, uint32_t nbufs, nframes_t start, nframes_t nframes)
AudioTrack::export_stuff (vector<Sample*>& buffers, uint32_t nbufs, nframes_t start, nframes_t nframes, bool enable_processing)
{
gain_t gain_automation[nframes];
gain_t gain_buffer[nframes];
@ -778,6 +779,9 @@ AudioTrack::export_stuff (vector<Sample*>& buffers, uint32_t nbufs, nframes_t st
}
}
// If no processing is required, there's no need to go any further.
if (!enable_processing)
return 0;
/* note: only run inserts during export. other layers in the machinery
will already have checked that there are no external port inserts.
@ -812,10 +816,7 @@ AudioTrack::export_stuff (vector<Sample*>& buffers, uint32_t nbufs, nframes_t st
} else {
for (bi = buffers.begin(); bi != buffers.end(); ++bi) {
Sample *b = *bi;
for (nframes_t n = 0; n < nframes; ++n) {
b[n] *= this_gain;
}
apply_gain_to_buffer(*bi, nframes, this_gain);
}
}
@ -849,10 +850,10 @@ AudioTrack::bounce (InterThreadInfo& itt)
boost::shared_ptr<Region>
AudioTrack::bounce_range (nframes_t start, nframes_t end, InterThreadInfo& itt)
AudioTrack::bounce_range (nframes_t start, nframes_t end, InterThreadInfo& itt, bool enable_processing)
{
vector<boost::shared_ptr<AudioSource> > srcs;
return _session.write_one_audio_track (*this, start, end, false, srcs, itt);
return _session.write_one_audio_track (*this, start, end, false, srcs, itt, enable_processing);
}
void

View file

@ -4109,7 +4109,7 @@ Session::freeze (InterThreadInfo& itt)
boost::shared_ptr<Region>
Session::write_one_audio_track (AudioTrack& track, nframes_t start, nframes_t end,
bool overwrite, vector<boost::shared_ptr<AudioSource> >& srcs, InterThreadInfo& itt)
bool overwrite, vector<boost::shared_ptr<AudioSource> >& srcs, InterThreadInfo& itt, bool enable_processing)
{
boost::shared_ptr<Region> result;
boost::shared_ptr<Playlist> playlist;
@ -4202,7 +4202,7 @@ Session::write_one_audio_track (AudioTrack& track, nframes_t start, nframes_t en
this_chunk = min (to_do, chunk_size);
if (track.export_stuff (buffers, nchans, start, this_chunk)) {
if (track.export_stuff (buffers, nchans, start, this_chunk, enable_processing)) {
goto out;
}