fix compiler complaints about RCU code; fix a couple of compiler warnings
[ardour.git] / gtk2_ardour / ardour_ui_options.cc
1 /*
2     Copyright (C) 2005 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 <pbd/convert.h>
21 #include <pbd/stacktrace.h>
22
23 #include <gtkmm2ext/utils.h>
24
25 #include <ardour/configuration.h>
26 #include <ardour/session.h>
27 #include <ardour/audioengine.h>
28
29 #include "ardour_ui.h"
30 #include "actions.h"
31 #include "gui_thread.h"
32
33 #include "i18n.h"
34
35 using namespace Gtk;
36 using namespace Gtkmm2ext;
37 using namespace ARDOUR;
38 using namespace PBD;
39 using namespace sigc;
40
41 void
42 ARDOUR_UI::toggle_time_master ()
43 {
44         ActionManager::toggle_config_state ("Transport", "ToggleTimeMaster", &Configuration::set_jack_time_master, &Configuration::get_jack_time_master);
45 }
46
47 void
48 ARDOUR_UI::toggle_send_mtc ()
49 {
50         ActionManager::toggle_config_state ("options", "SendMTC", &Configuration::set_send_mtc, &Configuration::get_send_mtc);
51 }
52
53 void
54 ARDOUR_UI::toggle_send_mmc ()
55 {
56         ActionManager::toggle_config_state ("options", "SendMMC", &Configuration::set_send_mmc, &Configuration::get_send_mmc);
57 }
58
59 void
60 ARDOUR_UI::toggle_use_mmc ()
61 {
62         ActionManager::toggle_config_state ("options", "UseMMC", &Configuration::set_mmc_control, &Configuration::get_mmc_control);
63 }
64
65 void
66 ARDOUR_UI::toggle_use_midi_control ()
67 {
68         ActionManager::toggle_config_state ("options", "UseMIDIcontrol", &Configuration::set_midi_control, &Configuration::get_midi_control);
69 }
70
71 void
72 ARDOUR_UI::toggle_send_midi_feedback ()
73 {
74         ActionManager::toggle_config_state ("options", "SendMIDIfeedback", &Configuration::set_midi_feedback, &Configuration::get_midi_feedback);
75 }
76
77 void
78 ARDOUR_UI::set_native_file_header_format (HeaderFormat hf)
79 {
80         const char *action = 0;
81
82         switch (hf) {
83         case BWF:
84                 action = X_("FileHeaderFormatBWF");
85                 break;
86         case WAVE:
87                 action = X_("FileHeaderFormatWAVE");
88                 break;
89         case WAVE64:
90                 action = X_("FileHeaderFormatWAVE64");
91                 break;
92         case iXML:
93                 action = X_("FileHeaderFormatiXML");
94                 break;
95         case RF64:
96                 action = X_("FileHeaderFormatRF64");
97                 break;
98         case CAF:
99                 action = X_("FileHeaderFormatCAF");
100                 break;
101         case AIFF:
102                 action = X_("FileHeaderFormatAIFF");
103                 break;
104         default:
105                 fatal << string_compose (_("programming error: %1"), "illegal file header format in ::set_native_file_header_format") << endmsg;
106                 /*NOTREACHED*/  
107         }
108
109         Glib::RefPtr<Action> act = ActionManager::get_action ("options", action);
110
111         if (act) {
112                 Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic(act);
113                 if (ract && ract->get_active() && Config->get_native_file_header_format() != hf) {
114                         Config->set_native_file_header_format (hf);
115                 }
116         }
117 }
118
119 void
120 ARDOUR_UI::set_native_file_data_format (SampleFormat sf)
121 {
122         const char* action = 0;
123
124         switch (sf) {
125         case FormatFloat:
126                 action = X_("FileDataFormatFloat");
127                 break;
128         case FormatInt24:
129                 action = X_("FileDataFormat24bit");
130                 break;
131         default:
132                 fatal << string_compose (_("programming error: %1"), "illegal file data format in ::set_native_file_data_format") << endmsg;
133                 /*NOTREACHED*/
134         }
135
136         Glib::RefPtr<Action> act = ActionManager::get_action ("options", action);
137
138         if (act) {
139                 Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic(act);
140                 if (ract && ract->get_active() && Config->get_native_file_data_format() != sf) {
141                         Config->set_native_file_data_format (sf);
142                 }
143         }
144 }
145
146 void
147 ARDOUR_UI::set_input_auto_connect (AutoConnectOption option)
148 {
149         const char* action;
150         
151         switch (option) {
152         case AutoConnectPhysical:
153                 action = X_("InputAutoConnectPhysical");
154                 break;
155         default:
156                 action = X_("InputAutoConnectManual");
157         }
158
159         Glib::RefPtr<Action> act = ActionManager::get_action ("options", action);
160
161         if (act) {
162                 Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic(act);
163
164                 if (ract && ract->get_active() && Config->get_input_auto_connect() != option) {
165                         Config->set_input_auto_connect (option);
166                 }
167         }
168 }
169
170 void
171 ARDOUR_UI::set_output_auto_connect (AutoConnectOption option)
172 {
173         const char* action;
174         
175         switch (option) {
176         case AutoConnectPhysical:
177                 action = X_("OutputAutoConnectPhysical");
178                 break;
179         case AutoConnectMaster:
180                 action = X_("OutputAutoConnectMaster");
181                 break;
182         default:
183                 action = X_("OutputAutoConnectManual");
184         }
185
186         Glib::RefPtr<Action> act = ActionManager::get_action ("options", action);
187
188         if (act) {
189                 Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic(act);
190
191                 if (ract && ract->get_active() && Config->get_output_auto_connect() != option) {
192                         Config->set_output_auto_connect (option);
193                 }
194         }
195 }
196
197 void
198 ARDOUR_UI::set_solo_model (SoloModel model)
199 {
200         const char* action = 0;
201
202         switch (model) {
203         case SoloBus:
204                 action = X_("SoloViaBus");
205                 break;
206                 
207         case InverseMute:
208                 action = X_("SoloInPlace");
209                 break;
210         default:
211                 fatal << string_compose (_("programming error: unknown solo model in ARDOUR_UI::set_solo_model: %1"), model) << endmsg;
212                 /*NOTREACHED*/
213         }
214
215         Glib::RefPtr<Action> act = ActionManager::get_action ("options", action);
216
217         if (act) {
218                 Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic(act);
219
220                 if (ract && ract->get_active() && Config->get_solo_model() != model) {
221                         Config->set_solo_model (model);
222                 }
223         }
224
225 }
226
227 void
228 ARDOUR_UI::set_remote_model (RemoteModel model)
229 {
230         const char* action = 0;
231
232         switch (model) {
233         case UserOrdered:
234                 action = X_("RemoteUserDefined");
235                 break;
236         case MixerOrdered:
237                 action = X_("RemoteMixerDefined");
238                 break;
239         case EditorOrdered:
240                 action = X_("RemoteEditorDefined");
241                 break;
242
243         default:
244                 fatal << string_compose (_("programming error: unknown remote model in ARDOUR_UI::set_remote_model: %1"), model) << endmsg;
245                 /*NOTREACHED*/
246         }
247
248         Glib::RefPtr<Action> act = ActionManager::get_action ("options", action);
249
250         if (act) {
251                 Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic(act);
252
253                 if (ract && ract->get_active() && Config->get_remote_model() != model) {
254                         Config->set_remote_model (model);
255                 }
256         }
257
258 }
259
260 void
261 ARDOUR_UI::set_monitor_model (MonitorModel model)
262 {
263         const char* action = 0;
264
265         switch (model) {
266         case HardwareMonitoring:
267                 action = X_("UseHardwareMonitoring");
268                 break;
269                 
270         case SoftwareMonitoring:
271                 action = X_("UseSoftwareMonitoring");
272                 break;
273         case ExternalMonitoring:
274                 action = X_("UseExternalMonitoring");
275                 break;
276
277         default:
278                 fatal << string_compose (_("programming error: unknown monitor model in ARDOUR_UI::set_monitor_model: %1"), model) << endmsg;
279                 /*NOTREACHED*/
280         }
281
282         Glib::RefPtr<Action> act = ActionManager::get_action ("options", action);
283
284         if (act) {
285                 Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic(act);
286
287                 if (ract && ract->get_active() && Config->get_monitoring_model() != model) {
288                         Config->set_monitoring_model (model);
289                 }
290         }
291
292 }
293
294 void
295 ARDOUR_UI::toggle_auto_input ()
296 {
297         ActionManager::toggle_config_state ("Transport", "ToggleAutoInput", &Configuration::set_auto_input, &Configuration::get_auto_input);
298 }
299
300 void
301 ARDOUR_UI::toggle_auto_play ()
302 {
303         ActionManager::toggle_config_state ("Transport", "ToggleAutoPlay", &Configuration::set_auto_play, &Configuration::get_auto_play);
304 }
305
306 void
307 ARDOUR_UI::toggle_auto_return ()
308 {
309         ActionManager::toggle_config_state ("Transport", "ToggleAutoReturn", &Configuration::set_auto_return, &Configuration::get_auto_return);
310 }
311
312 void
313 ARDOUR_UI::toggle_click ()
314 {
315         ActionManager::toggle_config_state ("Transport", "ToggleClick", &Configuration::set_clicking, &Configuration::get_clicking);
316 }
317
318 void
319 ARDOUR_UI::toggle_session_auto_loop ()
320 {
321         if (session) {
322                 if (session->get_play_loop()) {
323                         if (session->transport_rolling()) {
324                                 transport_roll();
325                         } else {
326                                 session->request_play_loop (false);
327                         }
328                 } else {
329                         session->request_play_loop (true);
330                 }
331         }
332 }
333
334 void
335 ARDOUR_UI::toggle_punch_in ()
336 {
337         ActionManager::toggle_config_state ("Transport", "TogglePunchIn", &Configuration::set_punch_in, &Configuration::get_punch_in);
338 }
339
340 void
341 ARDOUR_UI::toggle_punch_out ()
342 {
343         ActionManager::toggle_config_state ("Transport", "TogglePunchOut", &Configuration::set_punch_out, &Configuration::get_punch_out);
344 }
345
346 void
347 ARDOUR_UI::toggle_video_sync()
348 {
349         Glib::RefPtr<Action> act = ActionManager::get_action ("Transport", "ToggleVideoSync");
350         if (act) {
351                 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
352                 Config->set_use_video_sync (tact->get_active());
353         }
354 }
355
356 void
357 ARDOUR_UI::toggle_editing_space()
358 {
359         Glib::RefPtr<Action> act = ActionManager::get_action ("Common", "ToggleMaximalEditor");
360         if (act) {
361                 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
362                 if (tact->get_active()) {
363                         maximise_editing_space ();
364                 } else {
365                         restore_editing_space ();
366                 }
367         }
368 }
369
370 void
371 ARDOUR_UI::toggle_StopPluginsWithTransport()
372 {
373         ActionManager::toggle_config_state ("options", "StopPluginsWithTransport", &Configuration::set_plugins_stop_with_transport, &Configuration::get_plugins_stop_with_transport);
374 }
375
376 void
377 ARDOUR_UI::toggle_LatchedRecordEnable()
378 {
379         ActionManager::toggle_config_state ("options", "LatchedRecordEnable", &Configuration::set_latched_record_enable, &Configuration::get_latched_record_enable);
380 }
381
382 void
383 ARDOUR_UI::toggle_RegionEquivalentsOverlap()
384 {
385         ActionManager::toggle_config_state ("options", "RegionEquivalentsOverlap", &Configuration::set_use_overlap_equivalency, &Configuration::get_use_overlap_equivalency);
386 }
387
388 void
389 ARDOUR_UI::toggle_DoNotRunPluginsWhileRecording()
390 {
391         ActionManager::toggle_config_state ("options", "DoNotRunPluginsWhileRecording", &Configuration::set_do_not_record_plugins, &Configuration::get_do_not_record_plugins);
392 }
393
394 void
395 ARDOUR_UI::toggle_VerifyRemoveLastCapture()
396 {
397         ActionManager::toggle_config_state ("options", "VerifyRemoveLastCapture", &Configuration::set_verify_remove_last_capture, &Configuration::get_verify_remove_last_capture);
398 }
399
400 void
401 ARDOUR_UI::toggle_StopRecordingOnXrun()
402 {
403         ActionManager::toggle_config_state ("options", "StopRecordingOnXrun", &Configuration::set_stop_recording_on_xrun, &Configuration::get_stop_recording_on_xrun);
404 }
405
406 void
407 ARDOUR_UI::toggle_StopTransportAtEndOfSession()
408 {
409         ActionManager::toggle_config_state ("options", "StopTransportAtEndOfSession", &Configuration::set_stop_at_session_end, &Configuration::get_stop_at_session_end);
410 }
411
412 void
413 ARDOUR_UI::toggle_GainReduceFastTransport()
414 {
415         ActionManager::toggle_config_state ("options", "GainReduceFastTransport", &Configuration::set_quieten_at_speed, &Configuration::get_quieten_at_speed);
416 }
417
418 void
419 ARDOUR_UI::toggle_LatchedSolo()
420 {
421         ActionManager::toggle_config_state ("options", "LatchedSolo", &Configuration::set_solo_latched, &Configuration::get_solo_latched);
422 }
423
424 void
425 ARDOUR_UI::toggle_ShowSoloMutes()
426 {
427         ActionManager::toggle_config_state ("options", "ShowSoloMutes", &Configuration::set_show_solo_mutes, &Configuration::get_show_solo_mutes);
428 }
429
430 void
431 ARDOUR_UI::mtc_port_changed ()
432 {
433         bool have_mtc;
434
435         if (session) {
436                 if (session->mtc_port()) {
437                         have_mtc = true;
438                 } else {
439                         have_mtc = false;
440                 }
441         } else {
442                 have_mtc = false;
443         }
444
445         positional_sync_strings.clear ();
446         positional_sync_strings.push_back (slave_source_to_string (None));
447         if (have_mtc) {
448                 positional_sync_strings.push_back (slave_source_to_string (MTC));
449         }
450         positional_sync_strings.push_back (slave_source_to_string (JACK));
451         
452         set_popdown_strings (sync_option_combo, positional_sync_strings);
453 }
454
455 void
456 ARDOUR_UI::setup_session_options ()
457 {
458         mtc_port_changed ();
459
460         Config->ParameterChanged.connect (mem_fun (*this, &ARDOUR_UI::parameter_changed));
461 }
462
463
464 void
465 ARDOUR_UI::map_solo_model ()
466 {
467         const char* on;
468
469         if (Config->get_solo_model() == InverseMute) {
470                 on = X_("SoloInPlace");
471         } else {
472                 on = X_("SoloViaBus");
473         }
474
475         Glib::RefPtr<Action> act = ActionManager::get_action ("options", on);
476         if (act) {
477                 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
478
479                 if (tact && !tact->get_active()) {
480                         tact->set_active (true);
481                 }
482         }
483 }
484
485 void
486 ARDOUR_UI::map_monitor_model ()
487 {
488         const char* on = 0;
489
490         switch (Config->get_monitoring_model()) {
491         case HardwareMonitoring:
492                 on = X_("UseHardwareMonitoring");
493                 break;
494         case SoftwareMonitoring:
495                 on = X_("UseSoftwareMonitoring");
496                 break;
497         case ExternalMonitoring:
498                 on = X_("UseExternalMonitoring");
499                 break;
500         }
501
502         Glib::RefPtr<Action> act = ActionManager::get_action ("options", on);
503         if (act) {
504                 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
505
506                 if (tact && !tact->get_active()) {
507                         tact->set_active (true);
508                 }
509         }
510 }
511
512 void
513 ARDOUR_UI::map_remote_model ()
514 {
515         const char* on = 0;
516
517         switch (Config->get_remote_model()) {
518         case UserOrdered:
519                 on = X_("RemoteUserDefined");
520                 break;
521         case MixerOrdered:
522                 on = X_("RemoteMixerDefined");
523                 break;
524         case EditorOrdered:
525                 on = X_("RemoteEditorDefined");
526                 break;
527         }
528
529         Glib::RefPtr<Action> act = ActionManager::get_action ("options", on);
530         if (act) {
531                 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
532
533                 if (tact && !tact->get_active()) {
534                         tact->set_active (true);
535                 }
536         }
537 }
538
539 void
540 ARDOUR_UI::map_file_header_format ()
541 {
542         const char* action = 0;
543
544         switch (Config->get_native_file_header_format()) {
545         case BWF:
546                 action = X_("FileHeaderFormatBWF");
547                 break;
548
549         case WAVE:
550                 action = X_("FileHeaderFormatWAVE");
551                 break;
552
553         case WAVE64:
554                 action = X_("FileHeaderFormatWAVE64");
555                 break;
556
557         case iXML:
558                 action = X_("FileHeaderFormatiXML");
559                 break;
560
561         case RF64:
562                 action = X_("FileHeaderFormatRF64");
563                 break;
564
565         case CAF:
566                 action = X_("FileHeaderFormatCAF");
567                 break;
568
569         default:
570                 fatal << string_compose (_("programming error: unknown file header format passed to ARDOUR_UI::map_file_data_format: %1"), 
571                                          Config->get_native_file_header_format()) << endmsg;
572                 /*NOTREACHED*/
573         }
574
575
576         Glib::RefPtr<Action> act = ActionManager::get_action ("options", action);
577
578         if (act) {
579                 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
580
581                 if (tact && !tact->get_active()) {
582                         tact->set_active (true);
583                 }
584         }
585 }
586
587 void
588 ARDOUR_UI::map_file_data_format ()
589 {
590         const char* action = 0;
591
592         switch (Config->get_native_file_data_format()) {
593         case FormatFloat:
594                 action = X_("FileDataFormatFloat");
595                 break;
596
597         case FormatInt24:
598                 action = X_("FileDataFormat24bit");
599                 break;
600
601         default:
602                 fatal << string_compose (_("programming error: unknown file data format passed to ARDOUR_UI::map_file_data_format: %1"), 
603                                          Config->get_native_file_data_format()) << endmsg;
604                 /*NOTREACHED*/
605         }
606
607
608         Glib::RefPtr<Action> act = ActionManager::get_action ("options", action);
609
610         if (act) {
611                 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
612
613                 if (tact && !tact->get_active()) {
614                         tact->set_active (true);
615                 }
616         }
617 }
618
619 void
620 ARDOUR_UI::map_input_auto_connect ()
621 {
622         const char* on;
623
624         if (Config->get_input_auto_connect() == (AutoConnectOption) 0) {
625                 on = "InputAutoConnectManual";
626         } else {
627                 on = "InputAutoConnectPhysical";
628         }
629
630         Glib::RefPtr<Action> act = ActionManager::get_action ("options", on);
631         if (act) {
632                 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
633
634                 if (tact && !tact->get_active()) {
635                         tact->set_active (true);
636                 }
637         }
638 }
639
640 void
641 ARDOUR_UI::map_output_auto_connect ()
642 {
643         const char* on;
644
645         if (Config->get_output_auto_connect() == (AutoConnectOption) 0) {
646                 on = "OutputAutoConnectManual";
647         } else if (Config->get_output_auto_connect() == AutoConnectPhysical) {
648                 on = "OutputAutoConnectPhysical";
649         } else {
650                 on = "OutputAutoConnectMaster";
651         }
652
653         Glib::RefPtr<Action> act = ActionManager::get_action ("options", on);
654         if (act) {
655                 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
656                 
657                 if (tact && !tact->get_active()) {
658                         tact->set_active (true);
659                 }
660         }
661 }
662
663 void
664 ARDOUR_UI::map_meter_falloff ()
665 {
666         const char* action = X_("MeterFalloffMedium");
667
668         float val = Config->get_meter_falloff ();
669         MeterFalloff code = meter_falloff_from_float(val);
670
671         switch (code) {
672         case MeterFalloffOff:
673                 action = X_("MeterFalloffOff");
674                 break;
675         case MeterFalloffSlowest:
676                 action = X_("MeterFalloffSlowest");
677                 break;
678         case MeterFalloffSlow:
679                 action = X_("MeterFalloffSlow");
680                 break;
681         case MeterFalloffMedium:
682                 action = X_("MeterFalloffMedium");
683                 break;
684         case MeterFalloffFast:
685                 action = X_("MeterFalloffFast");
686                 break;
687         case MeterFalloffFaster:
688                 action = X_("MeterFalloffFaster");
689                 break;
690         case MeterFalloffFastest:
691                 action = X_("MeterFalloffFastest");
692                 break;
693         }
694
695         Glib::RefPtr<Action> act = ActionManager::get_action (X_("options"), action);
696
697         if (act) {
698                 Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic(act);
699                 if (ract && !ract->get_active()) {
700                         ract->set_active (true);
701                 }
702         }
703 }
704
705 void
706 ARDOUR_UI::map_meter_hold ()
707 {
708         const char* action = X_("MeterHoldMedium");
709
710         /* XXX hack alert. Fix this. Please */
711
712         float val = Config->get_meter_hold ();
713         MeterHold code = (MeterHold) (int) (floor (val));
714
715         switch (code) {
716         case MeterHoldOff:
717                 action = X_("MeterHoldOff");
718                 break;
719         case MeterHoldShort:
720                 action = X_("MeterHoldShort");
721                 break;
722         case MeterHoldMedium:
723                 action = X_("MeterHoldMedium");
724                 break;
725         case MeterHoldLong:
726                 action = X_("MeterHoldLong");
727                 break;
728         }
729
730         Glib::RefPtr<Action> act = ActionManager::get_action (X_("options"), action);
731
732         if (act) {
733                 Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic(act);
734                 if (ract && !ract->get_active()) {
735                         ract->set_active (true);
736                 }
737         }
738 }
739
740 void 
741 ARDOUR_UI::set_meter_hold (MeterHold val)
742 {
743         const char* action = 0;
744         float fval;
745
746         fval = meter_hold_to_float (val);
747
748         switch (val) {
749         case MeterHoldOff:
750                 action = X_("MeterHoldOff");
751                 break;
752         case MeterHoldShort:
753                 action = X_("MeterHoldShort");
754                 break;
755         case MeterHoldMedium:
756                 action = X_("MeterHoldMedium");
757                 break;
758         case MeterHoldLong:
759                 action = X_("MeterHoldLong");
760                 break;
761         }
762
763         Glib::RefPtr<Action> act = ActionManager::get_action (X_("options"), action);
764         
765         if (act) {
766                 Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic(act);
767                 if (ract && ract->get_active() && Config->get_meter_hold() != fval) {
768                         Config->set_meter_hold (fval);
769                 }
770         }
771 }
772
773 void
774 ARDOUR_UI::set_meter_falloff (MeterFalloff val)
775 {
776         const char* action = 0;
777         float fval;
778
779         fval = meter_falloff_to_float (val);
780
781         switch (val) {
782         case MeterFalloffOff:
783                 action = X_("MeterFalloffOff");
784                 break;
785         case MeterFalloffSlowest:
786                 action = X_("MeterFalloffSlowest");
787                 break;
788         case MeterFalloffSlow:
789                 action = X_("MeterFalloffSlow");
790                 break;
791         case MeterFalloffMedium:
792                 action = X_("MeterFalloffMedium");
793                 break;
794         case MeterFalloffFast:
795                 action = X_("MeterFalloffFast");
796                 break;
797         case MeterFalloffFaster:
798                 action = X_("MeterFalloffFaster");
799                 break;
800         case MeterFalloffFastest:
801                 action = X_("MeterFalloffFastest");
802                 break;
803         }
804
805         Glib::RefPtr<Action> act = ActionManager::get_action (X_("options"), action);
806
807         if (act) {
808                 Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic(act);
809                 if (ract && ract->get_active() && Config->get_meter_falloff () != fval) {
810                         Config->set_meter_falloff (fval);
811                 }
812         }
813 }
814
815 void
816 ARDOUR_UI::parameter_changed (const char* parameter_name)
817 {
818         ENSURE_GUI_THREAD (bind (mem_fun (*this, &ARDOUR_UI::parameter_changed), parameter_name));
819
820 #define PARAM_IS(x) (!strcmp (parameter_name, (x)))
821         
822         if (PARAM_IS ("slave-source")) {
823
824                 sync_option_combo.set_active_text (slave_source_to_string (Config->get_slave_source()));
825
826         } else if (PARAM_IS ("send-mtc")) {
827
828                 ActionManager::map_some_state ("options", "SendMTC", &Configuration::get_send_mtc);
829
830         } else if (PARAM_IS ("send-mmc")) {
831
832                 ActionManager::map_some_state ("options", "SendMMC", &Configuration::get_send_mmc);
833
834         } else if (PARAM_IS ("mmc-control")) {
835                 ActionManager::map_some_state ("options", "UseMMC", &Configuration::get_mmc_control);
836         } else if (PARAM_IS ("midi-feedback")) {
837                 ActionManager::map_some_state ("options", "SendMIDIfeedback", &Configuration::get_midi_feedback);
838         } else if (PARAM_IS ("midi-control")) {
839                 ActionManager::map_some_state ("options", "UseMIDIcontrol", &Configuration::get_midi_control);
840         } else if (PARAM_IS ("do-not-record-plugins")) {
841                 ActionManager::map_some_state ("options", "DoNotRunPluginsWhileRecording", &Configuration::get_do_not_record_plugins);
842         } else if (PARAM_IS ("latched-record-enable")) {
843                 ActionManager::map_some_state ("options", "LatchedRecordEnable", &Configuration::get_latched_record_enable);
844         } else if (PARAM_IS ("solo-latched")) {
845                 ActionManager::map_some_state ("options", "LatchedSolo", &Configuration::get_solo_latched);
846         } else if (PARAM_IS ("show-solo-mutes")) {
847                 ActionManager::map_some_state ("options", "ShowSoloMutes", &Configuration::get_show_solo_mutes);
848         } else if (PARAM_IS ("solo-model")) {
849                 map_solo_model ();
850         } else if (PARAM_IS ("auto-play")) {
851                 ActionManager::map_some_state ("Transport", "ToggleAutoPlay", &Configuration::get_auto_play);
852         } else if (PARAM_IS ("auto-return")) {
853                 ActionManager::map_some_state ("Transport", "ToggleAutoReturn", &Configuration::get_auto_return);
854         } else if (PARAM_IS ("auto-input")) {
855                 ActionManager::map_some_state ("Transport", "ToggleAutoInput", &Configuration::get_auto_input);
856         } else if (PARAM_IS ("punch-out")) {
857                 ActionManager::map_some_state ("Transport", "TogglePunchOut", &Configuration::get_punch_out);
858         } else if (PARAM_IS ("punch-in")) {
859                 ActionManager::map_some_state ("Transport", "TogglePunchIn", &Configuration::get_punch_in);
860         } else if (PARAM_IS ("clicking")) {
861                 ActionManager::map_some_state ("Transport", "ToggleClick", &Configuration::get_clicking);
862         } else if (PARAM_IS ("jack-time-master")) {
863                 ActionManager::map_some_state ("Transport",  "ToggleTimeMaster", &Configuration::get_jack_time_master);
864         } else if (PARAM_IS ("plugins-stop-with-transport")) {
865                 ActionManager::map_some_state ("options",  "StopPluginsWithTransport", &Configuration::get_plugins_stop_with_transport);
866         } else if (PARAM_IS ("latched-record-enable")) {
867                 ActionManager::map_some_state ("options", "LatchedRecordEnable", &Configuration::get_latched_record_enable);
868         } else if (PARAM_IS ("verify-remove-last-capture")) {
869                 ActionManager::map_some_state ("options",  "VerifyRemoveLastCapture", &Configuration::get_verify_remove_last_capture);
870         } else if (PARAM_IS ("stop-recording-on-xrun")) {
871                 ActionManager::map_some_state ("options",  "StopRecordingOnXrun", &Configuration::get_stop_recording_on_xrun);
872         } else if (PARAM_IS ("stop-at-session-end")) {
873                 ActionManager::map_some_state ("options",  "StopTransportAtEndOfSession", &Configuration::get_stop_at_session_end);
874         } else if (PARAM_IS ("monitoring-model")) {
875                 map_monitor_model ();
876         } else if (PARAM_IS ("remote-model")) {
877                 map_remote_model ();
878         } else if (PARAM_IS ("use-video-sync")) {
879                 ActionManager::map_some_state ("Transport",  "ToggleVideoSync", &Configuration::get_use_video_sync);
880         } else if (PARAM_IS ("quieten-at-speed")) {
881                 ActionManager::map_some_state ("options",  "GainReduceFastTransport", &Configuration::get_quieten_at_speed);
882         } else if (PARAM_IS ("shuttle-behaviour")) {
883
884                 switch (Config->get_shuttle_behaviour ()) {
885                 case Sprung:
886                         shuttle_style_button.set_active_text (_("sprung"));
887                         shuttle_fract = 0.0;
888                         shuttle_box.queue_draw ();
889                         if (session) {
890                                 if (session->transport_rolling()) {
891                                         shuttle_fract = SHUTTLE_FRACT_SPEED1;
892                                         session->request_transport_speed (1.0);
893                                 }
894                         }
895                         break;
896                 case Wheel:
897                         shuttle_style_button.set_active_text (_("wheel"));
898                         break;
899                 }
900
901         } else if (PARAM_IS ("shuttle-units")) {
902                 
903                 switch (Config->get_shuttle_units()) {
904                 case Percentage:
905                         shuttle_units_button.set_label("% ");
906                         break;
907                 case Semitones:
908                         shuttle_units_button.set_label(_("ST"));
909                         break;
910                 }
911         } else if (PARAM_IS ("input-auto-connect")) {
912                 map_input_auto_connect ();
913         } else if (PARAM_IS ("output-auto-connect")) {
914                 map_output_auto_connect ();
915         } else if (PARAM_IS ("native-file-header-format")) {
916                 map_file_header_format ();
917         } else if (PARAM_IS ("native-file-data-format")) {
918                 map_file_data_format ();
919         } else if (PARAM_IS ("meter-hold")) {
920                 map_meter_hold ();
921         } else if (PARAM_IS ("meter-falloff")) {
922                 map_meter_falloff ();
923         } else if (PARAM_IS ("verify-remove-last-capture")) {
924                 ActionManager::map_some_state ("options", "VerifyRemoveLastCapture", &Configuration::get_verify_remove_last_capture);
925         } else if (PARAM_IS ("video-pullup") || PARAM_IS ("smpte-format")) {
926                 if (session) {
927                         primary_clock.set (session->audible_frame(), true);
928                         secondary_clock.set (session->audible_frame(), true);
929                 } else {
930                         primary_clock.set (0, true);
931                         secondary_clock.set (0, true);
932                 }
933         } else if (PARAM_IS ("use-overlap-equivalency")) {
934                 ActionManager::map_some_state ("options", "RegionEquivalentsOverlap", &Configuration::get_use_overlap_equivalency);
935         }
936                            
937
938 #undef PARAM_IS
939 }