Merge branch 'master' into cairocanvas
authorPaul Davis <paul@linuxaudiosystems.com>
Thu, 2 Jan 2014 14:16:28 +0000 (09:16 -0500)
committerPaul Davis <paul@linuxaudiosystems.com>
Thu, 2 Jan 2014 14:16:28 +0000 (09:16 -0500)
18 files changed:
gtk2_ardour/engine_dialog.cc
gtk2_ardour/processor_box.cc
gtk2_ardour/processor_box.h
libs/ardour/ardour/iec1ppmdsp.h
libs/ardour/ardour/iec2ppmdsp.h
libs/ardour/ardour/kmeterdsp.h
libs/ardour/ardour/plugin_insert.h
libs/ardour/ardour/vumeterdsp.h
libs/ardour/audioregion.cc
libs/ardour/iec1ppmdsp.cc
libs/ardour/iec2ppmdsp.cc
libs/ardour/kmeterdsp.cc
libs/ardour/meter.cc
libs/ardour/midi_port.cc
libs/ardour/plugin_insert.cc
libs/ardour/test/control_surfaces_test.cc
libs/ardour/vumeterdsp.cc
libs/midi++2/midnam_patch.cc

index d438ff83270e5d2948ff53ed76564a63592fa1ec..8cd0473c085df0f866c1005b1667700463af3317 100644 (file)
@@ -327,6 +327,10 @@ EngineControl::EngineControl ()
         Gtkmm2ext::container_clear (basic_vbox);
         Gtkmm2ext::container_clear (basic_packer);
 
+        if (control_app_button.get_parent()) {
+                control_app_button.get_parent()->remove (control_app_button);
+        }
+
         label = manage (left_aligned_label (_("Audio System:")));
         basic_packer.attach (*label, 0, 1, 0, 1, xopt, (AttachOptions) 0);
         basic_packer.attach (backend_combo, 1, 2, 0, 1, xopt, (AttachOptions) 0);
index b549fd15ac06365536b61ecbbf9b0560e493bed3..08079f4f9199ead6240bc7de164ca99304001409 100644 (file)
@@ -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,8 +617,17 @@ PluginInsertProcessorEntry::PluginInsertProcessorEntry (ProcessorBox* b, boost::
 void
 PluginInsertProcessorEntry::plugin_insert_splitting_changed ()
 {
-       if (_plugin_insert->splitting ()) {
+       _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 ();
        }
@@ -675,20 +684,53 @@ 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 float si_l = rint(width * 0.3) + .5;
-       const float si_c = rint(width * 0.5) + .5;
-       const float si_r = rint(width * 0.7) + .5;
-       const float si_m = rint(height * 0.5) + .5;
+       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;
 
-       cairo_move_to (cr, si_l, height);
-       cairo_line_to (cr, si_l, si_m);
-       cairo_line_to (cr, si_r, si_m);
-       cairo_line_to (cr, si_r, height);
+               cairo_move_to (cr, si_l, height);
+               cairo_line_to (cr, si_l, si_m);
+               cairo_line_to (cr, si_r, si_m);
+               cairo_line_to (cr, si_r, height);
+               cairo_stroke (cr);
+
+               cairo_set_line_cap (cr, CAIRO_LINE_CAP_BUTT);
+
+               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);
+               }
 
-       cairo_set_line_cap (cr, CAIRO_LINE_CAP_BUTT);
-       cairo_move_to (cr, si_c, si_m);
-       cairo_line_to (cr, si_c, 0);
-       cairo_stroke (cr);
+               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;
 }
index 41bc68281f8fcb0ae184687fbf2deac1a23b1464..6aed08d17e6bbfe4b18e29ac7a3d96b351984f06 100644 (file)
@@ -223,10 +223,18 @@ private:
        void setup_visuals ();
        void plugin_insert_splitting_changed ();
 
-       /* XXX: this seems a little ridiculous just for a simple scaleable icon */
        class SplittingIcon : public Gtk::DrawingArea {
+       public:
+               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 *);
+               ARDOUR::ChanCount _inputs;
+               ARDOUR::ChanCount _outputs;
        };
 
        boost::shared_ptr<ARDOUR::PluginInsert> _plugin_insert;
index 3e0637716d277d7098fc491a0387a802f888e502..b6f1501db739a121dd770709af9ec964f71d7e18 100644 (file)
@@ -29,11 +29,11 @@ public:
     Iec1ppmdsp (void);
     ~Iec1ppmdsp (void);
 
-    void process (float *p, int n);  
+    void process (float const *p, int n);
     float read (void);
     void reset ();
 
-    static void init (float fsamp); 
+    static void init (float fsamp);
 
 private:
 
index aa5a90cdb9dadb68dca5aa27e6cb1c39a5430c5d..6a3852da1dfeac2e29ade396c880ba3e2f99a967 100644 (file)
@@ -29,11 +29,11 @@ public:
     Iec2ppmdsp (void);
     ~Iec2ppmdsp (void);
 
-    void process (float *p, int n);  
+    void process (float const *p, int n);
     float read (void);
     void reset ();
 
-    static void init (float fsamp); 
+    static void init (float fsamp);
 
 private:
 
index 374afff50eee8150ff623096f1fbdac89833612b..7fe2b9d11b01eb8c322ed8ab0dd1761cbeb1fdf3 100644 (file)
@@ -29,7 +29,7 @@ public:
     Kmeterdsp (void);
     ~Kmeterdsp (void);
 
-    void process (float *p, int n);
+    void process (float const *p, int n);
     float read ();
     void reset ();
 
index 51e1356d123c31434151c13716d2c08091eef84e..627c8475139616f0e5a0788f3acd65a997905f34 100644 (file)
@@ -123,8 +123,7 @@ class LIBARDOUR_API 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).
index f8abc7fa93cbbe318979836898b14b80a167810b..1271276d684f3ee94f16060e906ab515afea5c6c 100644 (file)
@@ -29,11 +29,11 @@ public:
     Vumeterdsp (void);
     ~Vumeterdsp (void);
 
-    void process (float *p, int n);  
+    void process (float const *p, int n);
     float read (void);
     void reset ();
 
-    static void init (float fsamp); 
+    static void init (float fsamp);
 
 private:
 
index 0909140f91be8db7e0500c6fd23141706002af02..331de043cda7cc62cba212b59b726372786e9465 100644 (file)
@@ -744,7 +744,7 @@ AudioRegion::read_from_sources (SourceList const & srcs, framecnt_t limit, Sampl
 
                        /* copy an existing channel's data in for this non-existant one */
 
-                       uint32_t channel = n_channels() % chan_n;
+                       uint32_t channel = chan_n % n_channels();
                        boost::shared_ptr<AudioSource> src = boost::dynamic_pointer_cast<AudioSource> (srcs[channel]);
 
                        if (src->read (buf, _start + internal_offset, to_read) != to_read) {
index 79a572da1c2458890276268e8d99971d03867495..842d33b8b55cb4bc9d0ab17f4362f8fcd1913bc2 100644 (file)
@@ -41,7 +41,7 @@ Iec1ppmdsp::~Iec1ppmdsp (void)
 }
 
 
-void Iec1ppmdsp::process (float *p, int n)
+void Iec1ppmdsp::process (float const *p, int n)
 {
     float z1, z2, m, t;
 
index caca744c520d7d7eeaf5690d9a3c26a2359935fd..d65f51b3fa0c4085d2a6a77fbf82c5e5ff5e8f56 100644 (file)
@@ -41,7 +41,7 @@ Iec2ppmdsp::~Iec2ppmdsp (void)
 }
 
 
-void Iec2ppmdsp::process (float *p, int n)
+void Iec2ppmdsp::process (float const *p, int n)
 {
     float z1, z2, m, t;
 
index 35c95c2daf2201660d5080b11a35508297e51300..add026797d263cb3e5f96ef40109cc70ec96c083 100644 (file)
@@ -42,7 +42,7 @@ void Kmeterdsp::init (int fsamp)
     _omega = 9.72f / fsamp; // ballistic filter coefficient
 }
 
-void Kmeterdsp::process (float *p, int n)
+void Kmeterdsp::process (float const *p, int n)
 {
     // Called by JACK's process callback.
     //
index 5310fd747bbf5e0ac0e4bb592122e13c94b61eff..ec736fef69c91cbf50b417ddad19f966e160be09 100644 (file)
@@ -107,7 +107,11 @@ PeakMeter::run (BufferSet& bufs, framepos_t /*start_frame*/, framepos_t /*end_fr
 
        // Meter audio in to the rest of the peaks
        for (uint32_t i = 0; i < n_audio; ++i, ++n) {
-               _peak_signal[n] = compute_peak (bufs.get_audio(i).data(), nframes, _peak_signal[n]);
+               if (bufs.get_audio(i).silent()) {
+                       _peak_signal[n] = .0f;
+               } else {
+                       _peak_signal[n] = compute_peak (bufs.get_audio(i).data(), nframes, _peak_signal[n]);
+               }
                if (_meter_type & (MeterKrms | MeterK20 | MeterK14 | MeterK12)) {
                        _kmeter[i]->process(bufs.get_audio(i).data(), nframes);
                }
index ae168356b6e51f580d0de01955aeb1ae6761131f..55280eb9428e82aed7fc611a53d866991f0b0b82 100644 (file)
@@ -158,13 +158,13 @@ MidiPort::resolve_notes (void* port_buffer, MidiBuffer::TimeType when)
                 */
 
                if (port_engine.midi_event_put (port_buffer, when, ev, 3) != 0) {
-                       cerr << "failed to deliver sustain-zero on channel " << channel << " on port " << name() << endl;
+                       cerr << "failed to deliver sustain-zero on channel " << (int)channel << " on port " << name() << endl;
                }
 
                ev[1] = MIDI_CTL_ALL_NOTES_OFF;
 
                if (port_engine.midi_event_put (port_buffer, 0, ev, 3) != 0) {
-                       cerr << "failed to deliver ALL NOTES OFF on channel " << channel << " on port " << name() << endl;
+                       cerr << "failed to deliver ALL NOTES OFF on channel " << (int)channel << " on port " << name() << endl;
                }
        }
 }
@@ -205,7 +205,7 @@ MidiPort::flush_buffers (pframes_t nframes)
                                             << ev.time() << " > " << _global_port_buffer_offset + _port_buffer_offset << endl;
                                }
                        } else {
-                               cerr << "drop flushed event on the floor, time " << ev
+                               cerr << "drop flushed event on the floor, time " << ev.time()
                                     << " to early for " << _global_port_buffer_offset 
                                     << " + " << _port_buffer_offset << endl;
                        }
index b3517531aa0a2ede287da6540e90bce32599571e..c25f8962ace7ca8c752efd34bc7bb860bd8c320d 100644 (file)
@@ -346,9 +346,8 @@ PluginInsert::connect_and_run (BufferSet& bufs, pframes_t nframes, framecnt_t of
                /* XXX: audio only */
                uint32_t first_idx = in_map.get (DataType::AUDIO, 0, &valid);
                if (valid) {
-                       Sample const * mono = bufs.get_audio (first_idx).data (offset);
                        for (uint32_t i = in_streams.n_audio(); i < natural_input_streams().n_audio(); ++i) {
-                               memcpy (bufs.get_audio (in_map.get (DataType::AUDIO, i, &valid)).data (offset), mono, sizeof (Sample) * nframes);
+                               bufs.get_audio(in_map.get (DataType::AUDIO, i, &valid)).read_from(bufs.get_audio(first_idx), nframes, offset, offset);
                        }
                }
        }
@@ -490,8 +489,9 @@ PluginInsert::run (BufferSet& bufs, framepos_t /*start_frame*/, framepos_t /*end
 
                                /* not active, but something has make up for any channel count increase */
                                
-                               for (uint32_t n = out - in; n < out; ++n) {
-                                       memcpy (bufs.get_audio (n).data(), bufs.get_audio(in - 1).data(), sizeof (Sample) * nframes);
+                               // TODO: option round-robin (n % in) or silence additional buffers ??
+                               for (uint32_t n = in; n < out; ++n) {
+                                       bufs.get_audio(n).read_from(bufs.get_audio(in - 1), nframes);
                                }
                        }
 
@@ -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 */
index f82945c3cea0e94fdfa95310e65d877059ce3f4b..63c5e33c6f0be60fc708e6998063d5e91e931675 100644 (file)
@@ -35,7 +35,7 @@ ControlSurfacesTest::instantiateAndTeardownTest ()
        
        ControlProtocolManager& m = ControlProtocolManager::instance ();
        for (list<ControlProtocolInfo*>::iterator i = m.control_protocol_info.begin(); i != m.control_protocol_info.end(); ++i) {
-               m.instantiate (**i);
-               m.teardown (**i);
+               m.activate (**i);
+               m.deactivate (**i);
        }
 }
index a3d0ec23c1899406da90394b008d4d3fba6f5230..edd9fa58316fcc66eaa5741398dcbce8b1b76712 100644 (file)
@@ -39,7 +39,7 @@ Vumeterdsp::~Vumeterdsp (void)
 }
 
 
-void Vumeterdsp::process (float *p, int n)
+void Vumeterdsp::process (float const *p, int n)
 {
     float z1, z2, m, t1, t2;
 
@@ -86,6 +86,6 @@ void Vumeterdsp::reset ()
 
 void Vumeterdsp::init (float fsamp)
 {
-    _w = 11.1f / fsamp; 
+    _w = 11.1f / fsamp;
     _g = 1.5f * 1.571f;
 }
index bf22792f70a1319ff49100dbfae9eb2366d7f790..bd8bbfc42d95c271db592467b71bf00e7a582129 100644 (file)
@@ -542,7 +542,9 @@ MasterDeviceNames::channel_name_set_by_device_mode_and_channel(const std::string
 boost::shared_ptr<Patch> 
 MasterDeviceNames::find_patch(const std::string& mode, uint8_t channel, const PatchPrimaryKey& key) 
 {
-       return channel_name_set_by_device_mode_and_channel(mode, channel)->find_patch(key);
+       boost::shared_ptr<ChannelNameSet> cns = channel_name_set_by_device_mode_and_channel(mode, channel);
+       if (!cns) return boost::shared_ptr<Patch>();
+       return cns->find_patch(key);
 }
 
 boost::shared_ptr<ChannelNameSet>