diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2009-07-15 20:29:02 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2009-07-15 20:29:02 +0000 |
commit | 939cff515018f9a5123e90a182dec56efdd7c508 (patch) | |
tree | 0be961b669f04052d69b804b9b47d6c26745c104 /libs | |
parent | 49445140345fd4e57a833d3803e529c0c07d221c (diff) |
more hacking on the processor list and processor box - note that ctrl-x/c/v now work "as expected" and / is a keystroke for toggling active state. cut-n-paste ops should all basically work
git-svn-id: svn://localhost/ardour2/branches/3.0@5366 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r-- | libs/ardour/ardour/io_processor.h | 1 | ||||
-rw-r--r-- | libs/ardour/ardour/route.h | 3 | ||||
-rw-r--r-- | libs/ardour/io_processor.cc | 12 | ||||
-rw-r--r-- | libs/ardour/route.cc | 175 | ||||
-rw-r--r-- | libs/gtkmm2ext/gtkmm2ext/dndtreeview.h | 8 |
5 files changed, 156 insertions, 43 deletions
diff --git a/libs/ardour/ardour/io_processor.h b/libs/ardour/ardour/io_processor.h index 430f54d46d..ff985c6e79 100644 --- a/libs/ardour/ardour/io_processor.h +++ b/libs/ardour/ardour/io_processor.h @@ -66,6 +66,7 @@ class IOProcessor : public Processor void set_output (boost::shared_ptr<IO>); void silence (nframes_t nframes); + void disconnect (); virtual bool feeds (boost::shared_ptr<Route> other) const; diff --git a/libs/ardour/ardour/route.h b/libs/ardour/ardour/route.h index 7a44cb454c..8433038aed 100644 --- a/libs/ardour/ardour/route.h +++ b/libs/ardour/ardour/route.h @@ -205,9 +205,10 @@ class Route : public SessionObject, public AutomatableControls int add_processor (boost::shared_ptr<Processor>, Placement placement, ProcessorStreams* err = 0); int add_processor (boost::shared_ptr<Processor>, ProcessorList::iterator iter, ProcessorStreams* err = 0); - int add_processors (const ProcessorList&, Placement placement, ProcessorStreams* err = 0); + int add_processors (const ProcessorList&, boost::shared_ptr<Processor> before, ProcessorStreams* err = 0); int add_processors (const ProcessorList&, ProcessorList::iterator iter, ProcessorStreams* err = 0); int remove_processor (boost::shared_ptr<Processor>, ProcessorStreams* err = 0); + int remove_processors (const ProcessorList&, ProcessorStreams* err = 0); int reorder_processors (const ProcessorList& new_order, ProcessorStreams* err = 0); void disable_processors (Placement); void disable_processors (); diff --git a/libs/ardour/io_processor.cc b/libs/ardour/io_processor.cc index 87d679bbac..ebffd31028 100644 --- a/libs/ardour/io_processor.cc +++ b/libs/ardour/io_processor.cc @@ -265,3 +265,15 @@ IOProcessor::feeds (boost::shared_ptr<Route> other) const { return _output && _output->connected_to (other->input()); } + +void +IOProcessor::disconnect () +{ + if (_input) { + _input->disconnect (this); + } + + if (_output) { + _output->disconnect (this); + } +} diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index cc90a855a5..216c199041 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -826,28 +826,15 @@ Route::add_processor_from_xml (const XMLNode& node, ProcessorList::iterator iter } int -Route::add_processors (const ProcessorList& others, Placement placement, ProcessorStreams* err) +Route::add_processors (const ProcessorList& others, boost::shared_ptr<Processor> before, ProcessorStreams* err) { ProcessorList::iterator loc; - if (placement == PreFader) { - /* generic pre-fader: insert immediately before the amp */ - loc = find(_processors.begin(), _processors.end(), _amp); - } else { - /* generic post-fader: insert at end */ - loc = _processors.end(); - if (!_processors.empty()) { - /* check for invisible processors stacked at the end and leave them there */ - ProcessorList::iterator p; - p = _processors.end(); - --p; - cerr << "Let's check " << (*p)->name() << " vis ? " << (*p)->visible() << endl; - while (!(*p)->visible() && p != _processors.begin()) { - --p; - } - ++p; - loc = p; - } + if (before) { + loc = find(_processors.begin(), _processors.end(), before); + } else { + /* nothing specified - at end but before main outs */ + loc = find (_processors.begin(), _processors.end(), _main_outs); } return add_processors (others, loc, err); @@ -893,9 +880,11 @@ Route::add_processors (const ProcessorList& others, ProcessorList::iterator iter if ((pi = boost::dynamic_pointer_cast<PluginInsert>(*i)) != 0) { pi->set_count (1); - ChanCount m = max(pi->input_streams(), pi->output_streams()); - if (m > potential_max_streams) + ChanCount m = max (pi->input_streams(), pi->output_streams()); + + if (m > potential_max_streams) { potential_max_streams = m; + } } _processors.insert (iter, *i); @@ -1067,26 +1056,43 @@ Route::clear_processors (Placement p) Glib::RWLock::WriterLock lm (_processor_lock); ProcessorList new_list; ProcessorStreams err; + bool seen_amp = false; - ProcessorList::iterator amp_loc = find(_processors.begin(), _processors.end(), _amp); - if (p == PreFader) { - // Get rid of PreFader processors - for (ProcessorList::iterator i = _processors.begin(); i != amp_loc; ++i) { - (*i)->drop_references (); - } - // Keep the rest - for (ProcessorList::iterator i = amp_loc; i != _processors.end(); ++i) { - new_list.push_back (*i); + for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) { + + if (*i == _amp) { + seen_amp = true; } - } else { - // Keep PreFader processors - for (ProcessorList::iterator i = _processors.begin(); i != amp_loc; ++i) { + + if ((*i) == _amp || (*i) == _meter || (*i) == _main_outs) { + + /* you can't remove these */ + new_list.push_back (*i); - } - new_list.push_back (_amp); - // Get rid of PostFader processors - for (ProcessorList::iterator i = amp_loc; i != _processors.end(); ++i) { - (*i)->drop_references (); + + } else { + if (seen_amp) { + + switch (p) { + case PreFader: + new_list.push_back (*i); + break; + case PostFader: + (*i)->drop_references (); + break; + } + + } else { + + switch (p) { + case PreFader: + (*i)->drop_references (); + break; + case PostFader: + new_list.push_back (*i); + break; + } + } } } @@ -1193,6 +1199,99 @@ Route::remove_processor (boost::shared_ptr<Processor> processor, ProcessorStream } int +Route::remove_processors (const ProcessorList& to_be_deleted, ProcessorStreams* err) +{ + ProcessorList deleted; + ProcessorList as_we_were; + + if (!_session.engine().connected()) { + return 1; + } + + processor_max_streams.reset(); + + { + Glib::RWLock::WriterLock lm (_processor_lock); + ProcessorList::iterator i; + boost::shared_ptr<Processor> processor; + + as_we_were = _processors; + + for (i = _processors.begin(); i != _processors.end(); ) { + + processor = *i; + + /* these can never be removed */ + + if (processor == _amp || processor == _meter || processor == _main_outs) { + ++i; + continue; + } + + /* see if its in the list of processors to delete */ + + if (find (to_be_deleted.begin(), to_be_deleted.end(), processor) == to_be_deleted.end()) { + ++i; + continue; + } + + /* stop IOProcessors that send to JACK ports + from causing noise as a result of no longer being + run. + */ + + boost::shared_ptr<IOProcessor> iop; + + if ((iop = boost::dynamic_pointer_cast<IOProcessor> (processor)) != 0) { + iop->disconnect (); + } + + deleted.push_back (processor); + i = _processors.erase (i); + } + + if (deleted.empty()) { + /* none of those in the requested list were found */ + return 0; + } + + _output->set_user_latency (0); + + if (configure_processors_unlocked (err)) { + /* get back to where we where */ + _processors = as_we_were; + /* we know this will work, because it worked before :) */ + configure_processors_unlocked (0); + return -1; + } + + _have_internal_generator = false; + + for (i = _processors.begin(); i != _processors.end(); ++i) { + boost::shared_ptr<PluginInsert> pi; + + if ((pi = boost::dynamic_pointer_cast<PluginInsert>(*i)) != 0) { + if (pi->is_generator()) { + _have_internal_generator = true; + break; + } + } + } + } + + /* now try to do what we need to so that those that were removed will be deleted */ + + for (ProcessorList::iterator i = deleted.begin(); i != deleted.end(); ++i) { + (*i)->drop_references (); + } + + processors_changed (); /* EMIT SIGNAL */ + + return 0; +} + + +int Route::configure_processors (ProcessorStreams* err) { if (!_in_configure_processors) { diff --git a/libs/gtkmm2ext/gtkmm2ext/dndtreeview.h b/libs/gtkmm2ext/gtkmm2ext/dndtreeview.h index 5464920a59..6295377672 100644 --- a/libs/gtkmm2ext/gtkmm2ext/dndtreeview.h +++ b/libs/gtkmm2ext/gtkmm2ext/dndtreeview.h @@ -91,7 +91,7 @@ class DnDTreeView : public DnDTreeViewBase DnDTreeView() {} ~DnDTreeView() {} - sigc::signal<void,const std::list<DataType>&,Gtk::TreeView*,Glib::RefPtr<Gdk::DragContext>&> signal_drop; + sigc::signal<void,const std::list<DataType>&,Gtk::TreeView*,int,int,Glib::RefPtr<Gdk::DragContext>&> signal_drop; void on_drag_data_get(const Glib::RefPtr<Gdk::DragContext>& context, Gtk::SelectionData& selection_data, guint info, guint time) { if (selection_data.get_target() == "GTK_TREE_MODEL_ROW") { @@ -126,7 +126,7 @@ class DnDTreeView : public DnDTreeViewBase } else if (selection_data.get_target() == object_type) { - end_object_drag (const_cast<Glib::RefPtr<Gdk::DragContext>& > (context)); + end_object_drag (const_cast<Glib::RefPtr<Gdk::DragContext>& > (context), x, y); } else { /* some kind of target type added by the app, which will be handled by a signal handler */ @@ -152,11 +152,11 @@ class DnDTreeView : public DnDTreeViewBase } private: - void end_object_drag (Glib::RefPtr<Gdk::DragContext>& context) { + void end_object_drag (Glib::RefPtr<Gdk::DragContext>& context, int x, int y) { std::list<DataType> l; Gtk::TreeView* source; get_object_drag_data (l, &source); - signal_drop (l, source, context); + signal_drop (l, source, x, y, context); } }; |