- 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 ();
- }
- }
- }
-
- if (change == ConfigurationChanged) {
- setup_bundles ();
- }
-
- if (change != NoChange) {
- input_changed (change, src);
- _session.set_dirty ();
- return 0;
- }
-
- return -1;
-}
-
-
-/** Add an input port.
- *
- * @param type Data type of port. The appropriate Jack port type, and @ref Port will be created.
- * @param destination Name of input port to connect new port to.
- * @param src Source for emitted ConfigurationChanged signal.
- */
-int
-IO::add_input_port (string source, void* src, DataType type)
-{
- Port* our_port;
- char name[64];
-
- if (type == DataType::NIL)
- type = _default_type;
-
- {
- BLOCK_PROCESS_CALLBACK ();
-
- {
- Glib::Mutex::Lock lm (io_lock);
-
- if (n_inputs() >= _input_maximum) {
- return -1;
- }
-
- /* Create a new input port */
-
- // FIXME: naming scheme for differently typed ports?
- if (_input_maximum.get(type) == 1) {
- snprintf (name, sizeof (name), _("%s/in"), _name.c_str());
- } else {
- snprintf (name, sizeof (name), _("%s/in %u"), _name.c_str(), find_input_port_hole());
- }
-
- if ((our_port = _session.engine().register_input_port (type, name)) == 0) {
- error << string_compose(_("IO: cannot register input port %1"), name) << endmsg;
- return -1;
- }
-
- _inputs.add (our_port);
- drop_input_bundle ();
- setup_peak_meters ();
- reset_panner ();
- }
-
- MoreChannels (n_inputs()); /* EMIT SIGNAL */