summaryrefslogtreecommitdiff
path: root/gtk2_ardour/panner_ui.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gtk2_ardour/panner_ui.cc')
-rw-r--r--gtk2_ardour/panner_ui.cc107
1 files changed, 61 insertions, 46 deletions
diff --git a/gtk2_ardour/panner_ui.cc b/gtk2_ardour/panner_ui.cc
index 2df79d2c39..4777c82479 100644
--- a/gtk2_ardour/panner_ui.cc
+++ b/gtk2_ardour/panner_ui.cc
@@ -132,6 +132,11 @@ PannerUI::PannerUI (Session& s)
void
PannerUI::set_io (boost::shared_ptr<IO> io)
{
+ if (!io->panner()) {
+ cerr << "PannerUI::set_io IO has no panners" << endl;
+ return;
+ }
+
connections.clear ();
delete pan_astyle_menu;
@@ -142,9 +147,12 @@ PannerUI::set_io (boost::shared_ptr<IO> io)
_io = io;
- connections.push_back (_io->panner().Changed.connect (mem_fun(*this, &PannerUI::panner_changed)));
- connections.push_back (_io->panner().LinkStateChanged.connect (mem_fun(*this, &PannerUI::update_pan_linkage)));
- connections.push_back (_io->panner().StateChanged.connect (mem_fun(*this, &PannerUI::update_pan_state)));
+ connections.push_back (_io->panner()->Changed.connect (
+ mem_fun(*this, &PannerUI::panner_changed)));
+ connections.push_back (_io->panner()->LinkStateChanged.connect (
+ mem_fun(*this, &PannerUI::update_pan_linkage)));
+ connections.push_back (_io->panner()->StateChanged.connect (
+ mem_fun(*this, &PannerUI::update_pan_state)));
delete panner;
panner = 0;
@@ -185,14 +193,18 @@ PannerUI::build_astate_menu ()
pan_astate_menu->items().clear ();
}
- pan_astate_menu->items().push_back (MenuElem (_("Manual"),
- bind (mem_fun (_io->panner(), &Panner::set_automation_state), (AutoState) Off)));
- pan_astate_menu->items().push_back (MenuElem (_("Play"),
- bind (mem_fun (_io->panner(), &Panner::set_automation_state), (AutoState) Play)));
- pan_astate_menu->items().push_back (MenuElem (_("Write"),
- bind (mem_fun (_io->panner(), &Panner::set_automation_state), (AutoState) Write)));
- pan_astate_menu->items().push_back (MenuElem (_("Touch"),
- bind (mem_fun (_io->panner(), &Panner::set_automation_state), (AutoState) Touch)));
+ pan_astate_menu->items().push_back (MenuElem (_("Manual"), bind (
+ mem_fun (_io->panner().get(), &Panner::set_automation_state),
+ (AutoState) Off)));
+ pan_astate_menu->items().push_back (MenuElem (_("Play"), bind (
+ mem_fun (_io->panner().get(), &Panner::set_automation_state),
+ (AutoState) Play)));
+ pan_astate_menu->items().push_back (MenuElem (_("Write"), bind (
+ mem_fun (_io->panner().get(), &Panner::set_automation_state),
+ (AutoState) Write)));
+ pan_astate_menu->items().push_back (MenuElem (_("Touch"), bind (
+ mem_fun (_io->panner().get(), &Panner::set_automation_state),
+ (AutoState) Touch)));
}
@@ -228,7 +240,7 @@ bool
PannerUI::panning_link_button_release (GdkEventButton* ev)
{
if (!ignore_toggle) {
- _io->panner().set_linked (!_io->panner().linked());
+ _io->panner()->set_linked (!_io->panner()->linked());
}
return true;
}
@@ -236,12 +248,12 @@ PannerUI::panning_link_button_release (GdkEventButton* ev)
void
PannerUI::panning_link_direction_clicked()
{
- switch (_io->panner().link_direction()) {
+ switch (_io->panner()->link_direction()) {
case Panner::SameDirection:
- _io->panner().set_link_direction (Panner::OppositeDirection);
+ _io->panner()->set_link_direction (Panner::OppositeDirection);
break;
default:
- _io->panner().set_link_direction (Panner::SameDirection);
+ _io->panner()->set_link_direction (Panner::SameDirection);
break;
}
}
@@ -251,7 +263,7 @@ PannerUI::update_pan_linkage ()
{
ENSURE_GUI_THREAD(mem_fun(*this, &PannerUI::update_pan_linkage));
- bool x = _io->panner().linked();
+ bool x = _io->panner()->linked();
bool bx = panning_link_button.get_active();
if (x != bx) {
@@ -263,7 +275,7 @@ PannerUI::update_pan_linkage ()
panning_link_direction_button.set_sensitive (x);
- switch (_io->panner().link_direction()) {
+ switch (_io->panner()->link_direction()) {
case Panner::SameDirection:
panning_link_direction_button.set_image (*(manage (new Image (get_xpm ("forwardblarrow.xpm")))));
break;
@@ -325,6 +337,10 @@ PannerUI::update_pan_state ()
void
PannerUI::setup_pan ()
{
+ if (!_io->panner()) {
+ return;
+ }
+
uint32_t nouts = _io->n_outputs ().n_audio();
if (nouts == 0 || nouts == 1) {
@@ -346,7 +362,7 @@ PannerUI::setup_pan ()
} else if (nouts == 2) {
vector<Adjustment*>::size_type asz;
- uint32_t npans = _io->panner().npanners();
+ uint32_t npans = _io->panner()->npanners();
while (!pan_adjustments.empty()) {
delete pan_bars.back();
@@ -363,7 +379,7 @@ PannerUI::setup_pan ()
/* initialize adjustment with 0.0 (L) or 1.0 (R) for the first and second panners,
which serves as a default, otherwise use current value */
- rx = _io->panner().pan_control( asz)->get_value();
+ rx = _io->panner()->pan_control( asz)->get_value();
if (npans == 1) {
x = 0.5;
@@ -377,13 +393,13 @@ PannerUI::setup_pan ()
pan_adjustments.push_back (new Adjustment (x, 0, 1.0, 0.05, 0.1));
bc = new PannerBar (*pan_adjustments[asz],
- boost::static_pointer_cast<PBD::Controllable>( _io->panner().pan_control( asz )) );
+ boost::static_pointer_cast<PBD::Controllable>( _io->panner()->pan_control( asz )) );
/* now set adjustment with current value of panner, then connect the signals */
pan_adjustments.back()->set_value(rx);
pan_adjustments.back()->signal_value_changed().connect (bind (mem_fun(*this, &PannerUI::pan_adjustment_changed), (uint32_t) asz));
- _io->panner().pan_control( asz )->Changed.connect (bind (mem_fun(*this, &PannerUI::pan_value_changed), (uint32_t) asz));
+ _io->panner()->pan_control( asz )->Changed.connect (bind (mem_fun(*this, &PannerUI::pan_value_changed), (uint32_t) asz));
bc->set_name ("PanSlider");
@@ -418,11 +434,10 @@ PannerUI::setup_pan ()
} else {
- if (panner == 0) {
+ if (!panner) {
panner = new Panner2d (_io->panner(), 61);
panner->set_name ("MixerPanZone");
panner->show ();
-
panner->signal_button_press_event().connect
(bind (mem_fun(*this, &PannerUI::pan_button_event), (uint32_t) 0), false);
@@ -485,7 +500,7 @@ PannerUI::build_pan_menu (uint32_t which)
/* set state first, connect second */
- (dynamic_cast<CheckMenuItem*> (&items.back()))->set_active (_io->panner().streampanner(which).muted());
+ (dynamic_cast<CheckMenuItem*> (&items.back()))->set_active (_io->panner()->streampanner(which).muted());
(dynamic_cast<CheckMenuItem*> (&items.back()))->signal_toggled().connect
(bind (mem_fun(*this, &PannerUI::pan_mute), which));
@@ -494,7 +509,7 @@ PannerUI::build_pan_menu (uint32_t which)
/* set state first, connect second */
- bypass_menu_item->set_active (_io->panner().bypassed());
+ bypass_menu_item->set_active (_io->panner()->bypassed());
bypass_menu_item->signal_toggled().connect (mem_fun(*this, &PannerUI::pan_bypass_toggle));
items.push_back (MenuElem (_("Reset"), bind (mem_fun (*this, &PannerUI::pan_reset), which)));
@@ -505,34 +520,34 @@ PannerUI::build_pan_menu (uint32_t which)
void
PannerUI::pan_mute (uint32_t which)
{
- StreamPanner& sp = _io->panner().streampanner(which);
+ StreamPanner& sp = _io->panner()->streampanner(which);
sp.set_muted (!sp.muted());
}
void
PannerUI::pan_bypass_toggle ()
{
- if (bypass_menu_item && (_io->panner().bypassed() != bypass_menu_item->get_active())) {
- _io->panner().set_bypassed (!_io->panner().bypassed());
+ if (bypass_menu_item && (_io->panner()->bypassed() != bypass_menu_item->get_active())) {
+ _io->panner()->set_bypassed (!_io->panner()->bypassed());
}
}
void
PannerUI::pan_reset (uint32_t which)
{
- _io->panner().reset_streampanner (which);
+ _io->panner()->reset_streampanner (which);
}
void
PannerUI::pan_reset_all ()
{
- _io->panner().reset_to_default ();
+ _io->panner()->reset_to_default ();
}
void
PannerUI::effective_pan_display ()
{
- if (_io->panner().empty()) {
+ if (_io->panner()->empty()) {
return;
}
@@ -559,7 +574,7 @@ PannerUI::pan_changed (void *src)
return;
}
- switch (_io->panner().npanners()) {
+ switch (_io->panner()->npanners()) {
case 0:
panning_link_direction_button.set_sensitive (false);
panning_link_button.set_sensitive (false);
@@ -595,11 +610,11 @@ PannerUI::pan_changed (void *src)
void
PannerUI::pan_adjustment_changed (uint32_t which)
{
- if (!in_pan_update && which < _io->panner().npanners()) {
+ if (!in_pan_update && which < _io->panner()->npanners()) {
float xpos;
float val = pan_adjustments[which]->get_value ();
- xpos = _io->panner().pan_control( which )->get_value();
+ xpos = _io->panner()->pan_control( which )->get_value();
/* add a kinda-sorta detent for the middle */
@@ -616,7 +631,7 @@ PannerUI::pan_adjustment_changed (uint32_t which)
if (!Panner::equivalent (val, xpos)) {
- _io->panner().streampanner(which).set_position (val);
+ _io->panner()->streampanner(which).set_position (val);
/* XXX
the panner objects have no access to the session,
so do this here. ick.
@@ -631,11 +646,11 @@ PannerUI::pan_value_changed (uint32_t which)
{
ENSURE_GUI_THREAD (bind (mem_fun(*this, &PannerUI::pan_value_changed), which));
- if (_io->n_outputs().n_audio() > 1 && which < _io->panner().npanners()) {
+ if (_io->n_outputs().n_audio() > 1 && which < _io->panner()->npanners()) {
float xpos;
float val = pan_adjustments[which]->get_value ();
- _io->panner().streampanner(which).get_position (xpos);
+ _io->panner()->streampanner(which).get_position (xpos);
if (!Panner::equivalent (val, xpos)) {
in_pan_update = true;
@@ -661,14 +676,14 @@ PannerUI::update_pan_bars (bool only_if_aplay)
float xpos, val;
if (only_if_aplay) {
- boost::shared_ptr<AutomationList> alist (_io->panner().streampanner(n).pan_control()->alist());
+ boost::shared_ptr<AutomationList> alist (_io->panner()->streampanner(n).pan_control()->alist());
if (!alist->automation_playback()) {
continue;
}
}
- _io->panner().streampanner(n).get_effective_position (xpos);
+ _io->panner()->streampanner(n).get_effective_position (xpos);
val = (*i)->get_value ();
if (!Panner::equivalent (val, xpos)) {
@@ -699,7 +714,7 @@ PannerUI::pan_printer (char *buf, uint32_t len, Adjustment* adj)
void
PannerUI::update_pan_sensitive ()
{
- bool sensitive = !(_io->panner().automation_state() & Play);
+ bool sensitive = !(_io->panner()->automation_state() & Play);
switch (_io->n_outputs().n_audio()) {
case 0:
@@ -771,10 +786,10 @@ PannerUI::pan_automation_style_changed ()
switch (_width) {
case Wide:
- pan_automation_style_button.set_label (astyle_string(_io->panner().automation_style()));
+ pan_automation_style_button.set_label (astyle_string(_io->panner()->automation_style()));
break;
case Narrow:
- pan_automation_style_button.set_label (short_astyle_string(_io->panner().automation_style()));
+ pan_automation_style_button.set_label (short_astyle_string(_io->panner()->automation_style()));
break;
}
}
@@ -788,10 +803,10 @@ PannerUI::pan_automation_state_changed ()
switch (_width) {
case Wide:
- pan_automation_state_button.set_label (astate_string(_io->panner().automation_state()));
+ pan_automation_state_button.set_label (astate_string(_io->panner()->automation_state()));
break;
case Narrow:
- pan_automation_state_button.set_label (short_astate_string(_io->panner().automation_state()));
+ pan_automation_state_button.set_label (short_astate_string(_io->panner()->automation_state()));
break;
}
@@ -800,11 +815,11 @@ PannerUI::pan_automation_state_changed ()
here.
*/
- if (_io->panner().empty()) {
+ if (_io->panner()->empty()) {
return;
}
- x = (_io->panner().streampanner(0).pan_control()->alist()->automation_state() != Off);
+ x = (_io->panner()->streampanner(0).pan_control()->alist()->automation_state() != Off);
if (pan_automation_state_button.get_active() != x) {
ignore_toggle = true;