Make sure we notice when an IO's port count is reduced as well as when it's increased. Fixes an assertion failure when removing a port from an IO with 3 existing ports.

git-svn-id: svn://localhost/ardour2/trunk@2537 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington
2007-10-10 14:49:25 +00:00
parent cf1adb02db
commit 796bfc025e
5 changed files with 25 additions and 20 deletions

View File

@@ -204,7 +204,8 @@ class IO : public Automatable, public Latent
static sigc::signal<int> PortsLegal;
static sigc::signal<int> PannersLegal;
static sigc::signal<int> ConnectingLegal;
static sigc::signal<void,ChanCount> MoreChannels;
/// raised when the number of input or output ports changes
static sigc::signal<void,ChanCount> PortCountChanged;
static sigc::signal<int> PortsCreated;
static void update_meters();

View File

@@ -70,7 +70,7 @@ sigc::signal<void> IO::Meter;
sigc::signal<int> IO::ConnectingLegal;
sigc::signal<int> IO::PortsLegal;
sigc::signal<int> IO::PannersLegal;
sigc::signal<void,ChanCount> IO::MoreChannels;
sigc::signal<void,ChanCount> IO::PortCountChanged;
sigc::signal<int> IO::PortsCreated;
Glib::StaticMutex IO::m_meter_signal_lock = GLIBMM_STATIC_MUTEX_INIT;
@@ -148,8 +148,8 @@ IO::IO (Session& s, const string& name,
m_meter_connection = Meter.connect (mem_fun (*this, &IO::meter));
}
// Connect to our own MoreChannels signal to connect output buffers
IO::MoreChannels.connect (mem_fun (*this, &IO::attach_buffers));
// Connect to our own PortCountChanged signal to connect output buffers
IO::PortCountChanged.connect (mem_fun (*this, &IO::attach_buffers));
_session.add_controllable (_gain_control);
@@ -188,8 +188,8 @@ IO::IO (Session& s, const XMLNode& node, DataType dt)
m_meter_connection = Meter.connect (mem_fun (*this, &IO::meter));
}
// Connect to our own MoreChannels signal to connect output buffers
IO::MoreChannels.connect (mem_fun (*this, &IO::attach_buffers));
// Connect to our own PortCountChanged signal to connect output buffers
IO::PortCountChanged.connect (mem_fun (*this, &IO::attach_buffers));
_session.add_controllable (_gain_control);
@@ -548,6 +548,8 @@ IO::remove_output_port (Port* port, void* src)
reset_panner ();
}
}
PortCountChanged (n_outputs()); /* EMIT SIGNAL */
}
if (change == ConnectionsChanged) {
@@ -558,8 +560,8 @@ IO::remove_output_port (Port* port, void* src)
output_changed (change, src);
_session.set_dirty ();
return 0;
}
}
return -1;
}
@@ -609,7 +611,7 @@ IO::add_output_port (string destination, void* src, DataType type)
reset_panner ();
}
MoreChannels (n_outputs()); /* EMIT SIGNAL */
PortCountChanged (n_outputs()); /* EMIT SIGNAL */
}
if (destination.length()) {
@@ -622,7 +624,7 @@ IO::add_output_port (string destination, void* src, DataType type)
output_changed (ConfigurationChanged, src); /* EMIT SIGNAL */
setup_bundles ();
_session.set_dirty ();
return 0;
}
@@ -657,6 +659,8 @@ IO::remove_input_port (Port* port, void* src)
reset_panner ();
}
}
PortCountChanged (n_inputs ()); /* EMIT SIGNAL */
}
if (change == ConfigurationChanged) {
@@ -718,7 +722,7 @@ IO::add_input_port (string source, void* src, DataType type)
reset_panner ();
}
MoreChannels (n_inputs()); /* EMIT SIGNAL */
PortCountChanged (n_inputs()); /* EMIT SIGNAL */
}
if (source.length()) {
@@ -838,7 +842,7 @@ IO::ensure_inputs_locked (ChanCount count, bool clear, void* src)
drop_input_bundle ();
setup_peak_meters ();
reset_panner ();
MoreChannels (n_inputs()); /* EMIT SIGNAL */
PortCountChanged (n_inputs()); /* EMIT SIGNAL */
_session.set_dirty ();
}
@@ -854,7 +858,7 @@ IO::ensure_inputs_locked (ChanCount count, bool clear, void* src)
/** Attach output_buffers to port buffers.
*
* Connected to IO's own MoreChannels signal.
* Connected to IO's own PortCountChanged signal.
*/
void
IO::attach_buffers(ChanCount ignored)
@@ -1012,7 +1016,7 @@ IO::ensure_io (ChanCount in, ChanCount out, bool clear, void* src)
}
if (in_changed || out_changed) {
MoreChannels (max (n_outputs(), n_inputs())); /* EMIT SIGNAL */
PortCountChanged (max (n_outputs(), n_inputs())); /* EMIT SIGNAL */
setup_bundles ();
_session.set_dirty ();
}
@@ -1101,7 +1105,7 @@ IO::ensure_outputs_locked (ChanCount count, bool clear, void* src)
if (changed) {
drop_output_bundle ();
MoreChannels (n_outputs()); /* EMIT SIGNAL */
PortCountChanged (n_outputs()); /* EMIT SIGNAL */
_session.set_dirty ();
}

View File

@@ -73,7 +73,7 @@ MidiTrack::MidiTrack (Session& sess, string name, Route::Flag flag, TrackMode mo
set_output_minimum(ChanCount(DataType::MIDI, 1));
set_output_maximum(ChanCount(DataType::MIDI, 1));
MoreChannels(ChanCount(DataType::MIDI, 2)); /* EMIT SIGNAL */
PortCountChanged(ChanCount(DataType::MIDI, 2)); /* EMIT SIGNAL */
}
MidiTrack::MidiTrack (Session& sess, const XMLNode& node)
@@ -87,7 +87,7 @@ MidiTrack::MidiTrack (Session& sess, const XMLNode& node)
set_output_minimum(ChanCount(DataType::MIDI, 1));
set_output_maximum(ChanCount(DataType::MIDI, 1));
MoreChannels(ChanCount(DataType::MIDI, 2)); /* EMIT SIGNAL */
PortCountChanged(ChanCount(DataType::MIDI, 2)); /* EMIT SIGNAL */
}
MidiTrack::~MidiTrack ()

View File

@@ -63,7 +63,7 @@ PluginInsert::PluginInsert (Session& s, boost::shared_ptr<Plugin> plug, Placemen
{
Glib::Mutex::Lock em (_session.engine().process_lock());
IO::MoreChannels (max(input_streams(), output_streams()));
IO::PortCountChanged (max(input_streams(), output_streams()));
}
ProcessorCreated (this); /* EMIT SIGNAL */
@@ -80,7 +80,7 @@ PluginInsert::PluginInsert (Session& s, const XMLNode& node)
{
Glib::Mutex::Lock em (_session.engine().process_lock());
IO::MoreChannels (max(input_streams(), output_streams()));
IO::PortCountChanged (max(input_streams(), output_streams()));
}
}

View File

@@ -266,7 +266,7 @@ Session::first_stage_init (string fullpath, string snapshot_name)
Controllable::Destroyed.connect (mem_fun (*this, &Session::remove_controllable));
IO::MoreChannels.connect (mem_fun (*this, &Session::ensure_buffers));
IO::PortCountChanged.connect (mem_fun (*this, &Session::ensure_buffers));
/* stop IO objects from doing stuff until we're ready for them */