- Port* our_port;
- char name[64];
-
- if (type == DataType::NIL)
- type = _default_type;
-
- {
- BLOCK_PROCESS_CALLBACK ();
-
-
- {
- Glib::Mutex::Lock lm (io_lock);
-
- if (n_outputs() >= _output_maximum) {
- return -1;
- }
-
- /* Create a new output port */
-
- // FIXME: naming scheme for differently typed ports?
- if (_output_maximum.get(type) == 1) {
- snprintf (name, sizeof (name), _("%s/out"), _name.c_str());
- } else {
- snprintf (name, sizeof (name), _("%s/out %u"), _name.c_str(), find_output_port_hole());
- }
-
- if ((our_port = _session.engine().register_output_port (type, name)) == 0) {
- error << string_compose(_("IO: cannot register output port %1"), name) << endmsg;
- return -1;
- }
-
- _outputs.add (our_port);
- drop_output_bundle ();
- setup_peak_meters ();
- reset_panner ();
- }
-
- PortCountChanged (n_outputs()); /* EMIT SIGNAL */
- }
-
- if (destination.length()) {
- if (_session.engine().connect (our_port->name(), destination)) {
- return -1;
- }
- }
-
- // pan_changed (src); /* EMIT SIGNAL */
- output_changed (ConfigurationChanged, src); /* EMIT SIGNAL */
- setup_bundles ();
- _session.set_dirty ();
-
- return 0;
-}
-
-int
-IO::remove_input_port (Port* port, void* src)
-{
- IOChange change (NoChange);
-
- {
- BLOCK_PROCESS_CALLBACK ();
-
-
- {
- Glib::Mutex::Lock lm (io_lock);
-
- if (n_inputs() <= _input_minimum) {
- /* sorry, you can't do this */
- return -1;
- }
-
- if (_inputs.remove(port)) {
- change = IOChange (change|ConfigurationChanged);
-
- if (port->connected()) {
- change = IOChange (change|ConnectionsChanged);
- }
-
- _session.engine().unregister_port (*port);
- drop_input_bundle ();
-
- setup_peak_meters ();
- reset_panner ();
- }
- }
-
- PortCountChanged (n_inputs ()); /* EMIT SIGNAL */
- }
-
- if (change == ConfigurationChanged) {
- setup_bundles ();
- }
-
- if (change != NoChange) {
- input_changed (change, src);
- _session.set_dirty ();