ardour
mixer_actor.cc
Go to the documentation of this file.
1 /*
2  Copyright (C) 2000-2004 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 #ifdef WAF_BUILD
21 #include "gtk2ardour-config.h"
22 #endif
23 
24 #include <boost/foreach.hpp>
25 
26 #include "pbd/file_utils.h"
27 #include "pbd/error.h"
28 
30 
31 #include "actions.h"
32 #include "mixer_actor.h"
33 #include "mixer_strip.h"
34 #include "route_ui.h"
35 
36 #include "i18n.h"
37 
38 using namespace ARDOUR;
39 using namespace Gtk;
40 using namespace PBD;
41 
43 {
44  register_actions ();
45  load_bindings ();
46 }
47 
49 {
50 }
51 
52 void
54 {
55  myactions.register_action ("Mixer", "solo", _("Toggle Solo on Mixer-Selected Tracks/Busses"), sigc::mem_fun (*this, &MixerActor::solo_action));
56  myactions.register_action ("Mixer", "mute", _("Toggle Mute on Mixer-Selected Tracks/Busses"), sigc::mem_fun (*this, &MixerActor::mute_action));
57  myactions.register_action ("Mixer", "recenable", _("Toggle Rec-enable on Mixer-Selected Tracks/Busses"), sigc::mem_fun (*this, &MixerActor::rec_enable_action));
58  myactions.register_action ("Mixer", "increment-gain", _("Decrease Gain on Mixer-Selected Tracks/Busses"), sigc::mem_fun (*this, &MixerActor::step_gain_up_action));
59  myactions.register_action ("Mixer", "decrement-gain", _("Increase Gain on Mixer-Selected Tracks/Busses"), sigc::mem_fun (*this, &MixerActor::step_gain_down_action));
60  myactions.register_action ("Mixer", "unity-gain", _("Set Gain to 0dB on Mixer-Selected Tracks/Busses"), sigc::mem_fun (*this, &MixerActor::unity_gain_action));
61 
62 
63  myactions.register_action ("Mixer", "copy-processors", _("Copy Selected Processors"), sigc::mem_fun (*this, &MixerActor::copy_processors));
64  myactions.register_action ("Mixer", "cut-processors", _("Cut Selected Processors"), sigc::mem_fun (*this, &MixerActor::cut_processors));
65  myactions.register_action ("Mixer", "paste-processors", _("Paste Selected Processors"), sigc::mem_fun (*this, &MixerActor::paste_processors));
66  myactions.register_action ("Mixer", "delete-processors", _("Delete Selected Processors"), sigc::mem_fun (*this, &MixerActor::delete_processors));
67  myactions.register_action ("Mixer", "select-all-processors", _("Select All (visible) Processors"), sigc::mem_fun (*this, &MixerActor::select_all_processors));
68  myactions.register_action ("Mixer", "toggle-processors", _("Toggle Selected Processors"), sigc::mem_fun (*this, &MixerActor::toggle_processors));
69  myactions.register_action ("Mixer", "ab-plugins", _("Toggle Selected Plugins"), sigc::mem_fun (*this, &MixerActor::ab_plugins));
70  myactions.register_action ("Mixer", "select-none", _("Deselect all strips and processors"), sigc::mem_fun (*this, &MixerActor::select_none));
71 
72  myactions.register_action ("Mixer", "scroll-left", _("Scroll Mixer Window to the left"), sigc::mem_fun (*this, &MixerActor::scroll_left));
73  myactions.register_action ("Mixer", "scroll-right", _("Scroll Mixer Window to the left"), sigc::mem_fun (*this, &MixerActor::scroll_right));
74 
75  myactions.register_action ("Mixer", "toggle-midi-input-active", _("Toggle MIDI Input Active for Mixer-Selected Tracks/Busses"),
76  sigc::bind (sigc::mem_fun (*this, &MixerActor::toggle_midi_input_active), false));
77 }
78 
79 void
81 {
82  /* XXX move this to a better place */
83 
84  bindings.set_action_map (myactions);
85 
86  std::string binding_file;
87 
88  if (find_file (ardour_config_search_path(), "mixer.bindings", binding_file)) {
89  bindings.load (binding_file);
90  info << string_compose (_("Loaded mixer bindings from %1"), binding_file) << endmsg;
91  } else {
92  error << string_compose (_("Could not find mixer.bindings in search path %1"), ardour_config_search_path().to_string()) << endmsg;
93  }
94 }
95 
96 void
98 {
99  GdkEventButton ev;
100 
101  ev.type = GDK_BUTTON_PRESS;
102  ev.button = 1;
103  ev.state = 0;
104 
105  set_route_targets_for_operation ();
106 
107  BOOST_FOREACH(RouteUI* r, _route_targets) {
108  r->solo_press (&ev);
109  }
110 }
111 
112 void
114 {
115  GdkEventButton ev;
116 
117  ev.type = GDK_BUTTON_PRESS;
118  ev.button = 1;
119  ev.state = 0;
120 
121  set_route_targets_for_operation ();
122 
123  BOOST_FOREACH(RouteUI* r, _route_targets) {
124  r->mute_press (&ev);
125  }
126 }
127 
128 void
130 {
131  GdkEventButton ev;
132 
133  ev.type = GDK_BUTTON_PRESS;
134  ev.button = 1;
135  ev.state = 0;
136 
137  set_route_targets_for_operation ();
138 
139  BOOST_FOREACH(RouteUI* r, _route_targets) {
140  r->rec_enable_press (&ev);
141  }
142 }
143 
144 void
146 {
147  set_route_targets_for_operation ();
148 
149  BOOST_FOREACH(RouteUI* r, _route_targets) {
150  MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
151  if (ms) {
152  ms->step_gain_up ();
153  }
154  }
155 }
156 
157 void
159 {
160  set_route_targets_for_operation ();
161 
162  BOOST_FOREACH(RouteUI* r, _route_targets) {
163  MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
164  if (ms) {
165  ms->step_gain_down ();
166  }
167  }
168 }
169 
170 void
172 {
173  set_route_targets_for_operation ();
174 
175 printf("setting gain to unity (?)");
176  BOOST_FOREACH(RouteUI* r, _route_targets) {
178  if (rp) {
179  rp->set_gain (1.0, this);
180  }
181  }
182 }
183 
184 void
186 {
187  set_route_targets_for_operation ();
188 
189  BOOST_FOREACH(RouteUI* r, _route_targets) {
190  MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
191  if (ms) {
192  ms->copy_processors ();
193  }
194  }
195 }
196 void
198 {
199  set_route_targets_for_operation ();
200 
201  BOOST_FOREACH(RouteUI* r, _route_targets) {
202  MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
203  if (ms) {
204  ms->cut_processors ();
205  }
206  }
207 }
208 void
210 {
211  set_route_targets_for_operation ();
212 
213  BOOST_FOREACH(RouteUI* r, _route_targets) {
214  MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
215  if (ms) {
216  ms->paste_processors ();
217  }
218  }
219 }
220 void
222 {
223  set_route_targets_for_operation ();
224 
225  BOOST_FOREACH(RouteUI* r, _route_targets) {
226  MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
227  if (ms) {
228  ms->select_all_processors ();
229  }
230  }
231 }
232 void
234 {
235  set_route_targets_for_operation ();
236 
237  BOOST_FOREACH(RouteUI* r, _route_targets) {
238  MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
239  if (ms) {
240  ms->toggle_processors ();
241  }
242  }
243 }
244 void
246 {
247  set_route_targets_for_operation ();
248 
249  BOOST_FOREACH(RouteUI* r, _route_targets) {
250  MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
251  if (ms) {
252  ms->ab_plugins ();
253  }
254  }
255 }
256 
bool rec_enable_press(GdkEventButton *)
Definition: route_ui.cc:668
void select_all_processors()
std::string to_string(T t, std::ios_base &(*f)(std::ios_base &))
Definition: convert.h:53
void select_all_processors()
Definition: mixer_actor.cc:221
virtual void delete_processors()=0
Definition: ardour_ui.h:130
void set_gain(gain_t val, void *src)
Definition: route.cc:371
void copy_processors()
void toggle_processors()
Definition: mixer_actor.cc:233
LIBPBD_API Transmitter error
void cut_processors()
Definition: mixer_actor.cc:197
virtual void scroll_right()
Definition: mixer_actor.h:81
std::ostream & endmsg(std::ostream &ostr)
Definition: transmitter.h:71
void load_bindings()
Definition: mixer_actor.cc:80
bool find_file(const Searchpath &search_path, const string &filename, std::string &result)
Definition: file_utils.cc:187
void ab_plugins()
Definition: mixer_actor.cc:245
void toggle_processors()
void step_gain_up()
Definition: route_ui.cc:1876
#define _(Text)
Definition: i18n.h:11
void solo_action()
Definition: mixer_actor.cc:97
void rec_enable_action()
Definition: mixer_actor.cc:129
bool solo_press(GdkEventButton *)
Definition: route_ui.cc:502
Definition: amp.h:29
virtual ~MixerActor()
Definition: mixer_actor.cc:48
void mute_action()
Definition: mixer_actor.cc:113
void cut_processors()
void copy_processors()
Definition: mixer_actor.cc:185
void step_gain_down()
Definition: route_ui.cc:1888
LIBARDOUR_API PBD::Searchpath ardour_config_search_path()
LIBPBD_API Transmitter info
void ab_plugins()
void step_gain_down_action()
Definition: mixer_actor.cc:158
void register_actions()
Definition: mixer_actor.cc:53
virtual void toggle_midi_input_active(bool flip_others)=0
Definition: debug.h:30
void step_gain_up_action()
Definition: mixer_actor.cc:145
void paste_processors()
Definition: mixer_actor.cc:209
virtual void scroll_left()
Definition: mixer_actor.h:80
bool mute_press(GdkEventButton *)
Definition: route_ui.cc:335
void paste_processors()
boost::shared_ptr< ARDOUR::Route > route() const
Definition: route_ui.h:76
std::string string_compose(const std::string &fmt, const T1 &o1)
Definition: compose.h:208
void unity_gain_action()
Definition: mixer_actor.cc:171
virtual void select_none()=0