visualize port connections in mixer/processor when in < out
This commit is contained in:
parent
91ae2c0e81
commit
2644aaddb1
@ -602,7 +602,7 @@ PluginInsertProcessorEntry::PluginInsertProcessorEntry (ProcessorBox* b, boost::
|
||||
: ProcessorEntry (b, p, w)
|
||||
, _plugin_insert (p)
|
||||
{
|
||||
p->SplittingChanged.connect (
|
||||
p->PluginIoReConfigure.connect (
|
||||
_splitting_connection, invalidator (*this), boost::bind (&PluginInsertProcessorEntry::plugin_insert_splitting_changed, this), gui_context()
|
||||
);
|
||||
|
||||
@ -617,9 +617,17 @@ PluginInsertProcessorEntry::PluginInsertProcessorEntry (ProcessorBox* b, boost::
|
||||
void
|
||||
PluginInsertProcessorEntry::plugin_insert_splitting_changed ()
|
||||
{
|
||||
if (_plugin_insert->splitting ()) {
|
||||
_splitting_icon.set_branches(_plugin_insert->output_streams().n_audio());
|
||||
_splitting_icon.set_inputs(_plugin_insert->input_streams());
|
||||
_splitting_icon.set_outputs(_plugin_insert->output_streams());
|
||||
|
||||
if (_plugin_insert->splitting () || (
|
||||
_plugin_insert->input_streams().n_midi() == 0
|
||||
&& _plugin_insert->input_streams().n_audio() < _plugin_insert->output_streams().n_audio()
|
||||
)
|
||||
)
|
||||
{
|
||||
_splitting_icon.show ();
|
||||
_splitting_icon.queue_draw();
|
||||
} else {
|
||||
_splitting_icon.hide ();
|
||||
}
|
||||
@ -676,10 +684,15 @@ PluginInsertProcessorEntry::SplittingIcon::on_expose_event (GdkEventExpose* ev)
|
||||
Gdk::Color const fg = get_style()->get_fg (STATE_NORMAL);
|
||||
cairo_set_source_rgb (cr, fg.get_red_p (), fg.get_green_p (), fg.get_blue_p ());
|
||||
|
||||
const uint32_t inputs = _inputs.n_audio();
|
||||
const uint32_t outputs = _outputs.n_audio();
|
||||
|
||||
const float si_m = rintf(height * 0.5) + .5f;
|
||||
|
||||
if (inputs == 1) {
|
||||
const float si_l = rintf(width * 0.2) + .5f;
|
||||
const float si_c = rintf(width * 0.5) + .5f;
|
||||
const float si_r = rintf(width * 0.8) + .5f;
|
||||
const float si_m = rintf(height * 0.5) + .5f;
|
||||
|
||||
cairo_move_to (cr, si_l, height);
|
||||
cairo_line_to (cr, si_l, si_m);
|
||||
@ -689,8 +702,9 @@ PluginInsertProcessorEntry::SplittingIcon::on_expose_event (GdkEventExpose* ev)
|
||||
|
||||
cairo_set_line_cap (cr, CAIRO_LINE_CAP_BUTT);
|
||||
|
||||
for (uint32_t i = 2; i < _branches; ++i) {
|
||||
const float si_b = rintf(width * (.2f + .6f * (i - 1.f) / (_branches - 1.f))) + .5f;
|
||||
const uint32_t outputs = _outputs.n_audio();
|
||||
for (uint32_t i = 2; i < outputs; ++i) {
|
||||
const float si_b = rintf(width * (.2f + .6f * (i - 1.f) / (outputs - 1.f))) + .5f;
|
||||
cairo_move_to (cr, si_b, height);
|
||||
cairo_line_to (cr, si_b, si_m);
|
||||
cairo_stroke (cr);
|
||||
@ -699,6 +713,24 @@ PluginInsertProcessorEntry::SplittingIcon::on_expose_event (GdkEventExpose* ev)
|
||||
cairo_move_to (cr, si_c, si_m);
|
||||
cairo_line_to (cr, si_c, 0);
|
||||
cairo_stroke (cr);
|
||||
} else {
|
||||
cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
|
||||
for (uint32_t i = 0 ; i < outputs; ++i) {
|
||||
const float si_x = rintf(width * (.2f + .6f * i / (outputs - 1.f))) + .5f;
|
||||
if (i < inputs) {
|
||||
cairo_move_to (cr, si_x, height);
|
||||
cairo_line_to (cr, si_x, 0);
|
||||
cairo_stroke (cr);
|
||||
} else {
|
||||
cairo_move_to (cr, si_x, si_m);
|
||||
cairo_line_to (cr, si_x, height);
|
||||
cairo_stroke (cr);
|
||||
cairo_move_to (cr, si_x+4, si_m);
|
||||
cairo_line_to (cr, si_x-4, si_m);
|
||||
cairo_stroke (cr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -225,11 +225,16 @@ private:
|
||||
|
||||
class SplittingIcon : public Gtk::DrawingArea {
|
||||
public:
|
||||
SplittingIcon() { _branches = 2; }
|
||||
void set_branches(uint32_t const branches) { _branches = branches; }
|
||||
SplittingIcon() {
|
||||
_inputs = ARDOUR::ChanCount(ARDOUR::DataType::AUDIO, 1);
|
||||
_outputs = ARDOUR::ChanCount(ARDOUR::DataType::AUDIO, 2);
|
||||
}
|
||||
void set_inputs(ARDOUR::ChanCount const inputs) { _inputs = inputs; }
|
||||
void set_outputs(ARDOUR::ChanCount const outputs) { _outputs = outputs; }
|
||||
private:
|
||||
bool on_expose_event (GdkEventExpose *);
|
||||
uint32_t _branches;
|
||||
ARDOUR::ChanCount _inputs;
|
||||
ARDOUR::ChanCount _outputs;
|
||||
};
|
||||
|
||||
boost::shared_ptr<ARDOUR::PluginInsert> _plugin_insert;
|
||||
|
@ -122,8 +122,7 @@ class PluginInsert : public Processor
|
||||
}
|
||||
|
||||
PBD::Signal2<void,BufferSet*, BufferSet*> AnalysisDataGathered;
|
||||
/** Emitted when the return value of splitting () has changed */
|
||||
PBD::Signal0<void> SplittingChanged;
|
||||
PBD::Signal0<void> PluginIoReConfigure;
|
||||
|
||||
/** Enumeration of the ways in which we can match our insert's
|
||||
* IO to that of the plugin(s).
|
||||
|
@ -650,6 +650,8 @@ bool
|
||||
PluginInsert::configure_io (ChanCount in, ChanCount out)
|
||||
{
|
||||
Match old_match = _match;
|
||||
ChanCount old_in = input_streams ();
|
||||
ChanCount old_out = output_streams ();
|
||||
|
||||
/* set the matching method and number of plugins that we will use to meet this configuration */
|
||||
_match = private_can_support_io_configuration (in, out);
|
||||
@ -657,9 +659,12 @@ PluginInsert::configure_io (ChanCount in, ChanCount out)
|
||||
return false;
|
||||
}
|
||||
|
||||
/* a signal needs emitting if we start or stop splitting */
|
||||
if (old_match.method != _match.method && (old_match.method == Split || _match.method == Split)) {
|
||||
SplittingChanged (); /* EMIT SIGNAL */
|
||||
if ( (old_match.method != _match.method && (old_match.method == Split || _match.method == Split))
|
||||
|| old_in != in
|
||||
|| old_out != out
|
||||
)
|
||||
{
|
||||
PluginIoReConfigure (); /* EMIT SIGNAL */
|
||||
}
|
||||
|
||||
/* configure plugins */
|
||||
|
Loading…
Reference in New Issue
Block a user