ardour
send_ui.cc
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002 Paul Davis
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or
7  (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program; if not, write to the Free Software
16  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 
18 */
19 
20 #include <gtkmm2ext/doi.h>
21 
22 #include "ardour/io.h"
23 #include "ardour/panner_manager.h"
24 #include "ardour/send.h"
26 
27 #include "send_ui.h"
28 #include "io_selector.h"
29 #include "timers.h"
30 #include "gui_thread.h"
31 
32 #include "i18n.h"
33 
34 using namespace std;
35 using namespace ARDOUR;
36 using namespace PBD;
37 
38 SendUI::SendUI (Gtk::Window* parent, boost::shared_ptr<Send> s, Session* session)
39  : _send (s)
40  , _gpm (session, 250)
41  , _panners (session)
42 {
43  assert (_send);
44 
47 
48  _hbox.pack_start (_gpm, true, true);
49  set_name (X_("SendUIFrame"));
50 
51  _vbox.set_spacing (5);
52  _vbox.set_border_width (5);
53 
54  _vbox.pack_start (_hbox, false, false, false);
55  _vbox.pack_start (_panners, false, false);
56 
57  io = Gtk::manage (new IOSelector (parent, session, s->output()));
58 
59  pack_start (_vbox, false, false);
60 
61  pack_start (*io, true, true);
62 
63  io->show ();
64  _gpm.show_all ();
65  _panners.show_all ();
66  _vbox.show ();
67  _hbox.show ();
68 
69  _send->set_metering (true);
70 
71  _send->output()->changed.connect (connections, invalidator (*this), boost::bind (&SendUI::outs_changed, this, _1, _2), gui_context());
72 
73  uint32_t const in = _send->pans_required();
74  uint32_t const out = _send->pan_outs();
75 
77  _panners.set_available_panners(PannerManager::instance().PannerManager::get_available_panners(in, out));
79 
80  _gpm.setup_meters ();
81  _gpm.set_fader_name (X_("SendUIFader"));
82 
83  // screen_update_connection = Timers::rapid_connect (
84  // sigc::mem_fun (*this, &SendUI::update));
86  sigc::mem_fun (*this, &SendUI::fast_update));
87 }
88 
90 {
91  _send->set_metering (false);
92 
93  /* XXX not clear that we need to do this */
94 
95  screen_update_connection.disconnect();
96  fast_screen_update_connection.disconnect();
97 }
98 
99 void
100 SendUI::outs_changed (IOChange change, void* /*ignored*/)
101 {
102  ENSURE_GUI_THREAD (*this, &SendUI::outs_changed, change, ignored)
103  if (change.type & IOChange::ConfigurationChanged) {
104  uint32_t const in = _send->pans_required();
105  uint32_t const out = _send->pan_outs();
106  if (_panners._panner == 0) {
108  }
109  _panners.set_available_panners(PannerManager::instance().PannerManager::get_available_panners(in, out));
110  _panners.setup_pan ();
111  _panners.show_all ();
112  _gpm.setup_meters ();
113  }
114 }
115 
116 void
118 {
119 }
120 
121 void
123 {
124  if (!is_mapped()) {
125  return;
126  }
127 
128  if (Config->get_meter_falloff() > 0.0f) {
129  _gpm.update_meters ();
130  }
131 }
132 
134  : ArdourWindow (string (_("Send ")) + s->name())
135 {
136  ui = new SendUI (this, s, session);
137 
138  hpacker.pack_start (*ui, true, true);
139 
140  add (hpacker);
141 
142  set_name ("SendUIWindow");
143 
144  ui->show ();
145  hpacker.show ();
146 
147 }
148 
150 {
151  delete ui;
152 }
void fast_update()
Definition: send_ui.cc:122
virtual void set_panner(boost::shared_ptr< ARDOUR::PannerShell >, boost::shared_ptr< ARDOUR::Panner >)
Definition: panner_ui.cc:92
Gtk::HBox hpacker
Definition: send_ui.h:70
void set_available_panners(std::map< std::string, std::string >)
Definition: panner_ui.cc:664
sigc::connection super_rapid_connect(const sigc::slot< void > &slot)
Definition: timers.cc:189
uint32_t pans_required() const
Definition: send.h:56
GainMeter _gpm
Definition: send_ui.h:49
sigc::connection screen_update_connection
Definition: send_ui.h:54
void set_fader_name(const char *name)
Definition: gain_meter.cc:583
sigc::connection fast_screen_update_connection
Definition: send_ui.h:55
Definition: Beats.hpp:239
Gtk::VBox _vbox
Definition: send_ui.h:51
Definition: send_ui.h:34
Gtk::VBox _hbox
Definition: send_ui.h:52
PannerUI _panners
Definition: send_ui.h:50
#define ENSURE_GUI_THREAD(obj, method,...)
Definition: gui_thread.h:34
#define invalidator(x)
Definition: gui_thread.h:40
~SendUI()
Definition: send_ui.cc:89
#define _(Text)
Definition: i18n.h:11
void set_metering(bool yn)
Definition: send.h:50
virtual uint32_t pan_outs() const
Definition: delivery.cc:385
#define X_(Text)
Definition: i18n.h:13
LIBARDOUR_API RCConfiguration * Config
Definition: globals.cc:119
enum ARDOUR::IOChange::Type type
boost::shared_ptr< PeakMeter > meter() const
Definition: send.h:47
boost::shared_ptr< ARDOUR::Panner > _panner
Definition: panner_ui.h:92
void setup_pan()
Definition: panner_ui.cc:211
Definition: amp.h:29
virtual void set_controls(boost::shared_ptr< ARDOUR::Route > route, boost::shared_ptr< ARDOUR::PeakMeter > meter, boost::shared_ptr< ARDOUR::Amp > amp)
Definition: gain_meter.cc:1009
void update()
Definition: send_ui.cc:117
#define gui_context()
Definition: gui_thread.h:36
void set_width(Width)
Definition: panner_ui.cc:187
SendUI(Gtk::Window *, boost::shared_ptr< ARDOUR::Send >, ARDOUR::Session *)
Definition: send_ui.cc:38
SendUIWindow(boost::shared_ptr< ARDOUR::Send >, ARDOUR::Session *)
Definition: send_ui.cc:133
PBD::ScopedConnectionList connections
Definition: send_ui.h:58
const char * name
void setup_meters(int len=0)
Definition: gain_meter.cc:340
boost::shared_ptr< Amp > amp() const
Definition: send.h:46
boost::shared_ptr< IO > output()
Definition: io_processor.h:62
void update_meters()
Definition: gain_meter.cc:890
Definition: debug.h:30
IOSelector * io
Definition: send_ui.h:43
SendUI * ui
Definition: send_ui.h:67
boost::shared_ptr< ARDOUR::Send > _send
Definition: send_ui.h:48
void outs_changed(ARDOUR::IOChange, void *)
Definition: send_ui.cc:100
boost::shared_ptr< PannerShell > panner_shell() const
Definition: delivery.h:95
Definition: enums.h:26
boost::shared_ptr< Panner > panner() const
Definition: delivery.cc:578