13
0

merge with master

This commit is contained in:
Paul Davis 2014-01-14 21:13:21 -05:00
commit 37b1f5017e
13 changed files with 436 additions and 325 deletions

View File

@ -89,9 +89,10 @@ MonoPanner::MonoPanner (boost::shared_ptr<ARDOUR::PannerShell> p)
have_font = true;
}
position_control->Changed.connect (connections, invalidator(*this), boost::bind (&MonoPanner::value_change, this), gui_context());
position_control->Changed.connect (panvalue_connections, invalidator(*this), boost::bind (&MonoPanner::value_change, this), gui_context());
_panner_shell->Changed.connect (connections, invalidator (*this), boost::bind (&MonoPanner::bypass_handler, this), gui_context());
_panner_shell->Changed.connect (panshell_connections, invalidator (*this), boost::bind (&MonoPanner::bypass_handler, this), gui_context());
_panner_shell->PannableChanged.connect (panshell_connections, invalidator (*this), boost::bind (&MonoPanner::pannable_handler, this), gui_context());
ColorsChanged.connect (sigc::mem_fun (*this, &MonoPanner::color_handler));
set_tooltip ();
@ -505,6 +506,16 @@ MonoPanner::bypass_handler ()
queue_draw ();
}
void
MonoPanner::pannable_handler ()
{
panvalue_connections.drop_connections();
position_control = _panner->pannable()->pan_azimuth_control;
position_binder.set_controllable(position_control);
position_control->Changed.connect (panvalue_connections, invalidator(*this), boost::bind (&MonoPanner::value_change, this), gui_context());
queue_draw ();
}
PannerEditor*
MonoPanner::editor ()
{

View File

@ -60,7 +60,8 @@ class MonoPanner : public PannerInterface
boost::shared_ptr<ARDOUR::PannerShell> _panner_shell;
boost::shared_ptr<PBD::Controllable> position_control;
PBD::ScopedConnectionList connections;
PBD::ScopedConnectionList panvalue_connections;
PBD::ScopedConnectionList panshell_connections;
int drag_start_x;
int last_drag_x;
double accumulated_delta;
@ -89,6 +90,7 @@ class MonoPanner : public PannerInterface
static bool have_colors;
void color_handler ();
void bypass_handler ();
void pannable_handler ();
};
#endif /* __gtk_ardour_mono_panner_h__ */

View File

@ -69,16 +69,16 @@ Panner2d::Target::set_text (const char* txt)
}
Panner2d::Panner2d (boost::shared_ptr<PannerShell> p, int32_t h)
: panner_shell (p)
, position (AngularVector (0.0, 0.0), "")
, width (0)
, height (h)
, last_width (0)
, have_elevation (false)
: panner_shell (p)
, position (AngularVector (0.0, 0.0), "")
, width (0)
, height (h)
, last_width (0)
, have_elevation (false)
{
panner_shell->Changed.connect (connections, invalidator (*this), boost::bind (&Panner2d::handle_state_change, this), gui_context());
panner_shell->Changed.connect (panshell_connections, invalidator (*this), boost::bind (&Panner2d::handle_state_change, this), gui_context());
panner_shell->panner()->SignalPositionChanged.connect (panconnect, invalidator(*this), boost::bind (&Panner2d::handle_position_change, this), gui_context());
panner_shell->panner()->SignalPositionChanged.connect (panner_connections, invalidator(*this), boost::bind (&Panner2d::handle_position_change, this), gui_context());
drag_target = 0;
set_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::POINTER_MOTION_MASK);
@ -97,7 +97,7 @@ Panner2d::~Panner2d()
void
Panner2d::reset (uint32_t n_inputs)
{
uint32_t nouts = panner_shell->panner()->out().n_audio();
uint32_t nouts = panner_shell->panner()->out().n_audio();
/* signals */
@ -113,11 +113,11 @@ Panner2d::reset (uint32_t n_inputs)
signals.resize (n_inputs);
}
label_signals ();
label_signals ();
for (uint32_t i = 0; i < n_inputs; ++i) {
signals[i]->position = panner_shell->panner()->signal_position (i);
}
for (uint32_t i = 0; i < n_inputs; ++i) {
signals[i]->position = panner_shell->panner()->signal_position (i);
}
/* add all outputs */
@ -137,7 +137,7 @@ Panner2d::reset (uint32_t n_inputs)
(*x)->visible = false;
}
vector<Speaker>& the_speakers (panner_shell->panner()->get_speakers()->speakers());
vector<Speaker>& the_speakers (panner_shell->panner()->get_speakers()->speakers());
for (uint32_t n = 0; n < nouts; ++n) {
char buf[16];
@ -154,24 +154,24 @@ Panner2d::reset (uint32_t n_inputs)
void
Panner2d::on_size_allocate (Gtk::Allocation& alloc)
{
width = alloc.get_width();
height = alloc.get_height();
width = alloc.get_width();
height = alloc.get_height();
if (height > large_size_threshold) {
border = large_border_width;
} else {
border = small_border_width;
}
if (height > large_size_threshold) {
border = large_border_width;
} else {
border = small_border_width;
}
radius = min (width, height);
radius -= border;
radius /= 2;
radius = min (width, height);
radius -= border;
radius /= 2;
hoffset = max ((double) (width - height), border);
voffset = max ((double) (height - width), border);
hoffset = max ((double) (width - height), border);
voffset = max ((double) (height - width), border);
hoffset = rint(hoffset / 2.0);
voffset = rint(voffset / 2.0);
hoffset = rint(hoffset / 2.0);
voffset = rint(voffset / 2.0);
DrawingArea::on_size_allocate (alloc);
}
@ -200,48 +200,48 @@ Panner2d::add_speaker (const AngularVector& a)
void
Panner2d::handle_state_change ()
{
panconnect.drop_connections();
panner_connections.drop_connections();
if (!panner_shell->panner()) {
return;
}
panner_shell->panner()->SignalPositionChanged.connect (panconnect, invalidator(*this), boost::bind (&Panner2d::handle_position_change, this), gui_context());
panner_shell->panner()->SignalPositionChanged.connect (panner_connections, invalidator(*this), boost::bind (&Panner2d::handle_position_change, this), gui_context());
set<Evoral::Parameter> params = panner_shell->panner()->what_can_be_automated();
set<Evoral::Parameter>::iterator p = params.find(PanElevationAutomation);
bool elev = have_elevation;
have_elevation = (p == params.end()) ? false : true;
if (elev != have_elevation) {
handle_position_change();
}
set<Evoral::Parameter> params = panner_shell->panner()->what_can_be_automated();
set<Evoral::Parameter>::iterator p = params.find(PanElevationAutomation);
bool elev = have_elevation;
have_elevation = (p == params.end()) ? false : true;
if (elev != have_elevation) {
handle_position_change();
}
queue_draw ();
}
void
Panner2d::label_signals ()
{
uint32_t sz = signals.size();
uint32_t sz = signals.size();
switch (sz) {
case 0:
break;
case 0:
break;
case 1:
signals[0]->set_text ("");
break;
case 1:
signals[0]->set_text ("");
break;
case 2:
signals[0]->set_text (_("L"));
signals[1]->set_text (_("R"));
break;
case 2:
signals[0]->set_text (_("L"));
signals[1]->set_text (_("R"));
break;
default:
for (uint32_t i = 0; i < sz; ++i) {
char buf[64];
snprintf (buf, sizeof (buf), "%" PRIu32, i + 1);
signals[i]->set_text (buf);
}
break;
default:
for (uint32_t i = 0; i < sz; ++i) {
char buf[64];
snprintf (buf, sizeof (buf), "%" PRIu32, i + 1);
signals[i]->set_text (buf);
}
break;
}
}
@ -249,27 +249,27 @@ void
Panner2d::handle_position_change ()
{
uint32_t n;
double w = panner_shell->pannable()->pan_width_control->get_value();
double w = panner_shell->pannable()->pan_width_control->get_value();
if (have_elevation) {
position.position = AngularVector (panner_shell->pannable()->pan_azimuth_control->get_value() * 360.0,
panner_shell->pannable()->pan_elevation_control->get_value() * 90.0);
} else {
position.position = AngularVector (panner_shell->pannable()->pan_azimuth_control->get_value() * 360.0, 0);
}
if (have_elevation) {
position.position = AngularVector (panner_shell->pannable()->pan_azimuth_control->get_value() * 360.0,
panner_shell->pannable()->pan_elevation_control->get_value() * 90.0);
} else {
position.position = AngularVector (panner_shell->pannable()->pan_azimuth_control->get_value() * 360.0, 0);
}
for (uint32_t i = 0; i < signals.size(); ++i) {
signals[i]->position = panner_shell->panner()->signal_position (i);
}
for (uint32_t i = 0; i < signals.size(); ++i) {
signals[i]->position = panner_shell->panner()->signal_position (i);
}
if (w * last_width <= 0) {
/* changed sign */
label_signals ();
}
if (w * last_width <= 0) {
/* changed sign */
label_signals ();
}
last_width = w;
last_width = w;
vector<Speaker>& the_speakers (panner_shell->panner()->get_speakers()->speakers());
vector<Speaker>& the_speakers (panner_shell->panner()->get_speakers()->speakers());
for (n = 0; n < speakers.size(); ++n) {
speakers[n]->position = the_speakers[n].angles();
@ -296,15 +296,15 @@ Panner2d::find_closest_object (gdouble x, gdouble y, bool& is_signal)
Target *candidate;
float distance;
float best_distance = FLT_MAX;
CartesianVector c;
CartesianVector c;
/* start with the position itself */
/* start with the position itself */
position.position.cartesian (c);
cart_to_gtk (c);
best_distance = sqrt ((c.x - x) * (c.x - x) +
(c.y - y) * (c.y - y));
closest = &position;
position.position.cartesian (c);
cart_to_gtk (c);
best_distance = sqrt ((c.x - x) * (c.x - x) +
(c.y - y) * (c.y - y));
closest = &position;
#if 0 // TODO signal grab -> change width, not position
for (Targets::const_iterator i = signals.begin(); i != signals.end(); ++i) {
@ -314,63 +314,63 @@ Panner2d::find_closest_object (gdouble x, gdouble y, bool& is_signal)
cart_to_gtk (c);
distance = sqrt ((c.x - x) * (c.x - x) +
(c.y - y) * (c.y - y));
(c.y - y) * (c.y - y));
if (distance < best_distance) {
if (distance < best_distance) {
closest = candidate;
best_distance = distance;
}
}
#endif
is_signal = true;
is_signal = true;
if (height > large_size_threshold) {
/* "big" */
if (best_distance > 30) { // arbitrary
closest = 0;
}
} else {
/* "small" */
if (best_distance > 10) { // arbitrary
closest = 0;
}
}
if (height > large_size_threshold) {
/* "big" */
if (best_distance > 30) { // arbitrary
closest = 0;
}
} else {
/* "small" */
if (best_distance > 10) { // arbitrary
closest = 0;
}
}
/* if we didn't find a signal close by, check the speakers */
/* if we didn't find a signal close by, check the speakers */
if (!closest) {
for (Targets::const_iterator i = speakers.begin(); i != speakers.end(); ++i) {
candidate = *i;
if (!closest) {
for (Targets::const_iterator i = speakers.begin(); i != speakers.end(); ++i) {
candidate = *i;
candidate->position.cartesian (c);
cart_to_gtk (c);
candidate->position.cartesian (c);
cart_to_gtk (c);
distance = sqrt ((c.x - x) * (c.x - x) +
(c.y - y) * (c.y - y));
distance = sqrt ((c.x - x) * (c.x - x) +
(c.y - y) * (c.y - y));
if (distance < best_distance) {
closest = candidate;
best_distance = distance;
}
}
if (distance < best_distance) {
closest = candidate;
best_distance = distance;
}
}
if (height > large_size_threshold) {
/* "big" */
if (best_distance < 30) { // arbitrary
is_signal = false;
} else {
closest = 0;
}
} else {
/* "small" */
if (best_distance < 10) { // arbitrary
is_signal = false;
} else {
closest = 0;
}
}
}
if (height > large_size_threshold) {
/* "big" */
if (best_distance < 30) { // arbitrary
is_signal = false;
} else {
closest = 0;
}
} else {
/* "small" */
if (best_distance < 10) { // arbitrary
is_signal = false;
} else {
closest = 0;
}
}
}
return closest;
}
@ -389,9 +389,9 @@ Panner2d::on_motion_notify_event (GdkEventMotion *ev)
state = (GdkModifierType) ev->state;
}
if (ev->state & (GDK_BUTTON1_MASK|GDK_BUTTON2_MASK)) {
did_move = true;
}
if (ev->state & (GDK_BUTTON1_MASK|GDK_BUTTON2_MASK)) {
did_move = true;
}
return handle_motion (x, y, state);
}
@ -399,14 +399,14 @@ Panner2d::on_motion_notify_event (GdkEventMotion *ev)
bool
Panner2d::on_expose_event (GdkEventExpose *event)
{
CartesianVector c;
CartesianVector c;
cairo_t* cr;
bool small = (height <= large_size_threshold);
const double diameter = radius*2.0;
bool small = (height <= large_size_threshold);
const double diameter = radius*2.0;
cr = gdk_cairo_create (get_window()->gobj());
/* background */
/* background */
cairo_rectangle (cr, event->area.x, event->area.y, event->area.width, event->area.height);
if (!panner_shell->bypassed()) {
@ -417,15 +417,15 @@ Panner2d::on_expose_event (GdkEventExpose *event)
cairo_fill_preserve (cr);
cairo_clip (cr);
/* offset to give us some border */
/* offset to give us some border */
cairo_translate (cr, hoffset, voffset);
cairo_translate (cr, hoffset, voffset);
cairo_set_line_width (cr, 1.0);
/* horizontal line of "crosshairs" */
cairo_set_source_rgba (cr, 0.282, 0.517, 0.662, 1.0);
cairo_set_source_rgba (cr, 0.282, 0.517, 0.662, 1.0);
cairo_move_to (cr, 0.0, rint(radius) + .5);
cairo_line_to (cr, diameter, rint(radius) + .5);
cairo_stroke (cr);
@ -439,46 +439,46 @@ Panner2d::on_expose_event (GdkEventExpose *event)
/* the circle on which signals live */
cairo_set_line_width (cr, 1.5);
cairo_set_source_rgba (cr, 0.517, 0.772, 0.882, 1.0);
cairo_set_source_rgba (cr, 0.517, 0.772, 0.882, 1.0);
cairo_arc (cr, radius, radius, radius, 0.0, 2.0 * M_PI);
cairo_stroke (cr);
for (uint32_t rad = 15; rad < 90; rad += 15) {
cairo_set_line_width (cr, .5 + (float)rad / 150.0);
if (rad == 45) {
cairo_set_source_rgba (cr, 0.282, 0.517, 0.662, 1.0);
} else {
cairo_set_source_rgba (cr, 0.282, 0.517, 0.662, 0.8);
}
cairo_new_path (cr);
cairo_arc (cr, radius, radius, radius * sin(M_PI * (float) rad / 180.0), 0, 2.0 * M_PI);
cairo_stroke (cr);
}
for (uint32_t rad = 15; rad < 90; rad += 15) {
cairo_set_line_width (cr, .5 + (float)rad / 150.0);
if (rad == 45) {
cairo_set_source_rgba (cr, 0.282, 0.517, 0.662, 1.0);
} else {
cairo_set_source_rgba (cr, 0.282, 0.517, 0.662, 0.8);
}
cairo_new_path (cr);
cairo_arc (cr, radius, radius, radius * sin(M_PI * (float) rad / 180.0), 0, 2.0 * M_PI);
cairo_stroke (cr);
}
if (!panner_shell->bypassed()) {
if (signals.size() > 1) {
/* arc to show "diffusion" */
if (signals.size() > 1) {
/* arc to show "diffusion" */
double width_angle = fabs (panner_shell->pannable()->pan_width_control->get_value()) * 2 * M_PI;
double position_angle = (2 * M_PI) - panner_shell->pannable()->pan_azimuth_control->get_value() * 2 * M_PI;
double width_angle = fabs (panner_shell->pannable()->pan_width_control->get_value()) * 2 * M_PI;
double position_angle = (2 * M_PI) - panner_shell->pannable()->pan_azimuth_control->get_value() * 2 * M_PI;
cairo_save (cr);
cairo_translate (cr, radius, radius);
cairo_rotate (cr, position_angle - (width_angle/2.0));
cairo_move_to (cr, 0, 0);
cairo_arc_negative (cr, 0, 0, radius, width_angle, 0.0);
cairo_close_path (cr);
if (panner_shell->pannable()->pan_width_control->get_value() >= 0.0) {
/* normal width */
cairo_set_source_rgba (cr, 0.282, 0.517, 0.662, 0.45);
} else {
/* inverse width */
cairo_set_source_rgba (cr, 1.0, 0.419, 0.419, 0.45);
}
cairo_fill (cr);
cairo_restore (cr);
}
cairo_save (cr);
cairo_translate (cr, radius, radius);
cairo_rotate (cr, position_angle - (width_angle/2.0));
cairo_move_to (cr, 0, 0);
cairo_arc_negative (cr, 0, 0, radius, width_angle, 0.0);
cairo_close_path (cr);
if (panner_shell->pannable()->pan_width_control->get_value() >= 0.0) {
/* normal width */
cairo_set_source_rgba (cr, 0.282, 0.517, 0.662, 0.45);
} else {
/* inverse width */
cairo_set_source_rgba (cr, 1.0, 0.419, 0.419, 0.45);
}
cairo_fill (cr);
cairo_restore (cr);
}
double arc_radius;
@ -491,58 +491,58 @@ Panner2d::on_expose_event (GdkEventExpose *event)
arc_radius = 12.0;
}
/* draw position */
/* draw position */
position.position.cartesian (c);
cart_to_gtk (c);
position.position.cartesian (c);
cart_to_gtk (c);
cairo_new_path (cr);
cairo_arc (cr, c.x, c.y, arc_radius + 1.0, 0, 2.0 * M_PI);
cairo_set_source_rgba (cr, 1.0, 0.419, 0.419, 0.85);
cairo_fill_preserve (cr);
cairo_set_source_rgba (cr, 1.0, 0.905, 0.905, 0.85);
cairo_stroke (cr);
cairo_new_path (cr);
cairo_arc (cr, c.x, c.y, arc_radius + 1.0, 0, 2.0 * M_PI);
cairo_set_source_rgba (cr, 1.0, 0.419, 0.419, 0.85);
cairo_fill_preserve (cr);
cairo_set_source_rgba (cr, 1.0, 0.905, 0.905, 0.85);
cairo_stroke (cr);
/* signals */
/* signals */
if (signals.size() > 1) {
for (Targets::iterator i = signals.begin(); i != signals.end(); ++i) {
Target* signal = *i;
if (signals.size() > 1) {
for (Targets::iterator i = signals.begin(); i != signals.end(); ++i) {
Target* signal = *i;
if (signal->visible) {
if (signal->visible) {
/* TODO check for overlap - multiple src at same position
* -> visualize it properly
*/
PBD::AngularVector sp = signal->position;
if (!have_elevation) sp.ele = 0;
sp.cartesian (c);
cart_to_gtk (c);
/* TODO check for overlap - multiple src at same position
* -> visualize it properly
*/
PBD::AngularVector sp = signal->position;
if (!have_elevation) sp.ele = 0;
sp.cartesian (c);
cart_to_gtk (c);
cairo_new_path (cr);
cairo_arc (cr, c.x, c.y, arc_radius, 0, 2.0 * M_PI);
cairo_set_source_rgba (cr, 0.282, 0.517, 0.662, 0.75);
cairo_fill_preserve (cr);
cairo_set_source_rgba (cr, 0.517, 0.772, 0.882, 0.8);
cairo_stroke (cr);
cairo_new_path (cr);
cairo_arc (cr, c.x, c.y, arc_radius, 0, 2.0 * M_PI);
cairo_set_source_rgba (cr, 0.282, 0.517, 0.662, 0.75);
cairo_fill_preserve (cr);
cairo_set_source_rgba (cr, 0.517, 0.772, 0.882, 0.8);
cairo_stroke (cr);
if (!small && !signal->text.empty()) {
cairo_set_source_rgba (cr, 0.517, 0.772, 0.882, .9);
/* the +/- adjustments are a hack to try to center the text in the circle
* TODO use pango get_pixel_size() -- see mono_panner.cc
*/
if (small) {
cairo_move_to (cr, c.x - 1, c.y + 1);
} else {
cairo_move_to (cr, c.x - 4, c.y + 4);
}
cairo_show_text (cr, signal->text.c_str());
}
}
}
}
if (!small && !signal->text.empty()) {
cairo_set_source_rgba (cr, 0.517, 0.772, 0.882, .9);
/* the +/- adjustments are a hack to try to center the text in the circle
* TODO use pango get_pixel_size() -- see mono_panner.cc
*/
if (small) {
cairo_move_to (cr, c.x - 1, c.y + 1);
} else {
cairo_move_to (cr, c.x - 4, c.y + 4);
}
cairo_show_text (cr, signal->text.c_str());
}
}
}
}
/* speakers */
/* speakers */
int n = 0;
@ -560,40 +560,40 @@ Panner2d::on_expose_event (GdkEventExpose *event)
snprintf (buf, sizeof (buf), "%d", n);
/* stroke out a speaker shape */
/* stroke out a speaker shape */
cairo_move_to (cr, c.x, c.y);
cairo_save (cr);
cairo_rotate (cr, -(speaker->position.azi/360.0) * (2.0 * M_PI));
if (small) {
cairo_scale (cr, 0.8, 0.8);
} else {
cairo_scale (cr, 1.2, 1.2);
}
cairo_rel_line_to (cr, 4, -2);
cairo_rel_line_to (cr, 0, -7);
cairo_rel_line_to (cr, 5, +5);
cairo_rel_line_to (cr, 5, 0);
cairo_rel_line_to (cr, 0, 5);
cairo_rel_line_to (cr, -5, 0);
cairo_rel_line_to (cr, -5, +5);
cairo_rel_line_to (cr, 0, -7);
cairo_close_path (cr);
cairo_move_to (cr, c.x, c.y);
cairo_save (cr);
cairo_rotate (cr, -(speaker->position.azi/360.0) * (2.0 * M_PI));
if (small) {
cairo_scale (cr, 0.8, 0.8);
} else {
cairo_scale (cr, 1.2, 1.2);
}
cairo_rel_line_to (cr, 4, -2);
cairo_rel_line_to (cr, 0, -7);
cairo_rel_line_to (cr, 5, +5);
cairo_rel_line_to (cr, 5, 0);
cairo_rel_line_to (cr, 0, 5);
cairo_rel_line_to (cr, -5, 0);
cairo_rel_line_to (cr, -5, +5);
cairo_rel_line_to (cr, 0, -7);
cairo_close_path (cr);
cairo_set_source_rgba (cr, 0.282, 0.517, 0.662, 1.0);
cairo_fill (cr);
cairo_restore (cr);
cairo_restore (cr);
if (!small) {
cairo_set_font_size (cr, 16);
if (!small) {
cairo_set_font_size (cr, 16);
/* move the text in just a bit */
/* move the text in just a bit */
AngularVector textpos (speaker->position.azi, speaker->position.ele, 0.85);
textpos.cartesian (c);
cart_to_gtk (c);
cairo_move_to (cr, c.x, c.y);
cairo_show_text (cr, buf);
}
AngularVector textpos (speaker->position.azi, speaker->position.ele, 0.85);
textpos.cartesian (c);
cart_to_gtk (c);
cairo_move_to (cr, c.x, c.y);
cairo_show_text (cr, buf);
}
}
}
@ -820,21 +820,24 @@ Panner2d::toggle_bypass ()
Panner2dWindow::Panner2dWindow (boost::shared_ptr<PannerShell> p, int32_t h, uint32_t inputs)
: ArdourWindow (_("Panner (2D)"))
, widget (p, h)
, widget (p, h)
, bypass_button (_("Bypass"))
, width_adjustment (0, -100, 100, 1, 5, 0)
, width_spinner (width_adjustment)
, width_spinner (width_adjustment)
{
widget.set_name ("MixerPanZone");
set_title (_("Panner"));
widget.set_size_request (h, h);
bypass_button.signal_toggled().connect (sigc::mem_fun (*this, &Panner2dWindow::bypass_toggled));
width_spinner.signal_changed().connect (sigc::mem_fun (*this, &Panner2dWindow::width_changed));
bypass_button.signal_toggled().connect (sigc::mem_fun (*this, &Panner2dWindow::bypass_toggled));
width_spinner.signal_changed().connect (sigc::mem_fun (*this, &Panner2dWindow::width_changed));
p->Changed.connect (panshell_connections, invalidator (*this), boost::bind (&Panner2dWindow::set_bypassed, this), gui_context());
/* needed for the width-spinbox in the main window */
p->PannableChanged.connect (panshell_connections, invalidator (*this), boost::bind (&Panner2dWindow::pannable_handler, this), gui_context());
p->pannable()->pan_width_control->Changed.connect (panvalue_connections, invalidator(*this), boost::bind (&Panner2dWindow::set_width, this), gui_context());
p->pannable()->pan_width_control->Changed.connect (connections, invalidator(*this), boost::bind (&Panner2dWindow::set_width, this), gui_context());
p->Changed.connect (connections, invalidator (*this), boost::bind (&Panner2dWindow::set_bypassed, this), gui_context());
button_box.set_spacing (6);
button_box.pack_start (bypass_button, false, false);
@ -843,9 +846,9 @@ Panner2dWindow::Panner2dWindow (boost::shared_ptr<PannerShell> p, int32_t h, uin
left_side.pack_start (button_box, false, false);
Gtk::Label* l = manage (new Label (
p->panner()->describe_parameter(PanWidthAutomation),
Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false));
Gtk::Label* l = manage (new Label (
p->panner()->describe_parameter(PanWidthAutomation),
Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false));
spinner_box.pack_start (*l, false, false);
spinner_box.pack_start (width_spinner, false, false);
left_side.pack_start (spinner_box, false, false);
@ -865,8 +868,8 @@ Panner2dWindow::Panner2dWindow (boost::shared_ptr<PannerShell> p, int32_t h, uin
add (hpacker);
reset (inputs);
set_width();
set_bypassed();
set_width();
set_bypassed();
widget.show ();
}
@ -879,60 +882,68 @@ Panner2dWindow::reset (uint32_t n_inputs)
void
Panner2dWindow::bypass_toggled ()
{
bool view = bypass_button.get_active ();
bool model = widget.get_panner_shell()->bypassed ();
bool view = bypass_button.get_active ();
bool model = widget.get_panner_shell()->bypassed ();
if (model != view) {
widget.get_panner_shell()->set_bypassed (view);
}
if (model != view) {
widget.get_panner_shell()->set_bypassed (view);
}
}
void
Panner2dWindow::width_changed ()
{
float model = widget.get_panner_shell()->pannable()->pan_width_control->get_value();
float view = width_spinner.get_value() / 100.0;
if (model != view) {
widget.get_panner_shell()->panner()->set_width (view);
}
float model = widget.get_panner_shell()->pannable()->pan_width_control->get_value();
float view = width_spinner.get_value() / 100.0;
if (model != view) {
widget.get_panner_shell()->panner()->set_width (view);
}
}
void
Panner2dWindow::pannable_handler ()
{
panvalue_connections.drop_connections();
widget.get_panner_shell()->pannable()->pan_width_control->Changed.connect (panvalue_connections, invalidator(*this), boost::bind (&Panner2dWindow::set_width, this), gui_context());
set_width();
}
void
Panner2dWindow::set_bypassed ()
{
bool view = bypass_button.get_active ();
bool model = widget.get_panner_shell()->bypassed ();
if (model != view) {
bypass_button.set_active(model);
}
bool view = bypass_button.get_active ();
bool model = widget.get_panner_shell()->bypassed ();
if (model != view) {
bypass_button.set_active(model);
}
set<Evoral::Parameter> params = widget.get_panner_shell()->panner()->what_can_be_automated();
set<Evoral::Parameter>::iterator p = params.find(PanWidthAutomation);
if (p == params.end()) {
spinner_box.set_sensitive(false);
} else {
spinner_box.set_sensitive(true);
}
set<Evoral::Parameter> params = widget.get_panner_shell()->panner()->what_can_be_automated();
set<Evoral::Parameter>::iterator p = params.find(PanWidthAutomation);
if (p == params.end()) {
spinner_box.set_sensitive(false);
} else {
spinner_box.set_sensitive(true);
}
}
void
Panner2dWindow::set_width ()
{
// rounding of spinbox is different from slider -- TODO use slider
float model = (widget.get_panner_shell()->pannable()->pan_width_control->get_value() * 100.0);
float view = (width_spinner.get_value());
if (model != view) {
width_spinner.set_value (model);
}
// rounding of spinbox is different from slider -- TODO use slider
float model = (widget.get_panner_shell()->pannable()->pan_width_control->get_value() * 100.0);
float view = (width_spinner.get_value());
if (model != view) {
width_spinner.set_value (model);
}
}
bool
Panner2dWindow::on_key_press_event (GdkEventKey* event)
{
return relay_key_press (event, &PublicEditor::instance());
return relay_key_press (event, &PublicEditor::instance());
}
bool
Panner2dWindow::on_key_release_event (GdkEventKey*)
{
return true;
return true;
}

View File

@ -53,7 +53,7 @@ class Panner2dWindow;
class Panner2d : public Gtk::DrawingArea
{
public:
public:
Panner2d (boost::shared_ptr<ARDOUR::PannerShell>, int32_t height);
~Panner2d ();
@ -69,7 +69,7 @@ class Panner2d : public Gtk::DrawingArea
void cart_to_gtk (PBD::CartesianVector&) const;
void gtk_to_cart (PBD::CartesianVector&) const;
protected:
protected:
bool on_expose_event (GdkEventExpose *);
bool on_button_press_event (GdkEventButton *);
bool on_button_release_event (GdkEventButton *);
@ -77,9 +77,9 @@ class Panner2d : public Gtk::DrawingArea
bool on_scroll_event (GdkEventScroll *);
void on_size_allocate (Gtk::Allocation& alloc);
private:
private:
class Target {
public:
public:
PBD::AngularVector position;
bool visible;
std::string text;
@ -95,7 +95,7 @@ class Panner2d : public Gtk::DrawingArea
return _selected;
}
private:
private:
bool _selected;
};
@ -105,16 +105,16 @@ class Panner2d : public Gtk::DrawingArea
typedef std::vector<Target*> Targets;
Targets speakers;
Targets signals;
Target position;
Target position;
Target *drag_target;
int width;
int height;
double radius;
double border;
double hoffset;
double voffset;
double last_width;
double radius;
double border;
double hoffset;
double voffset;
double last_width;
bool did_move;
bool have_elevation;
@ -125,10 +125,10 @@ class Panner2d : public Gtk::DrawingArea
void toggle_bypass ();
void handle_state_change ();
void handle_position_change ();
void label_signals ();
void label_signals ();
PBD::ScopedConnectionList connections;
PBD::ScopedConnectionList panconnect;
PBD::ScopedConnectionList panshell_connections;
PBD::ScopedConnectionList panner_connections;
/* cartesian coordinates in GTK units ; adjust to same but on a circle of radius 1.0
and centered in the middle of our area
@ -139,12 +139,12 @@ class Panner2d : public Gtk::DrawingArea
class Panner2dWindow : public ArdourWindow
{
public:
public:
Panner2dWindow (boost::shared_ptr<ARDOUR::PannerShell>, int32_t height, uint32_t inputs);
void reset (uint32_t n_inputs);
private:
private:
Panner2d widget;
Gtk::HBox hpacker;
@ -156,14 +156,16 @@ class Panner2dWindow : public ArdourWindow
Gtk::Adjustment width_adjustment;
Gtk::SpinButton width_spinner;
PBD::ScopedConnectionList connections;
void set_bypassed();
void set_width();
PBD::ScopedConnectionList panshell_connections;
PBD::ScopedConnectionList panvalue_connections;
void set_bypassed();
void set_width();
void bypass_toggled ();
void width_changed ();
bool on_key_press_event (GdkEventKey*);
bool on_key_release_event (GdkEventKey*);
void pannable_handler ();
void bypass_toggled ();
void width_changed ();
bool on_key_press_event (GdkEventKey*);
bool on_key_release_event (GdkEventKey*);
};
#endif /* __ardour_panner_2d_h__ */

View File

@ -95,9 +95,10 @@ StereoPanner::StereoPanner (boost::shared_ptr<PannerShell> p)
have_font = true;
}
position_control->Changed.connect (connections, invalidator(*this), boost::bind (&StereoPanner::value_change, this), gui_context());
width_control->Changed.connect (connections, invalidator(*this), boost::bind (&StereoPanner::value_change, this), gui_context());
_panner_shell->Changed.connect (connections, invalidator (*this), boost::bind (&StereoPanner::bypass_handler, this), gui_context());
position_control->Changed.connect (panvalue_connections, invalidator(*this), boost::bind (&StereoPanner::value_change, this), gui_context());
width_control->Changed.connect (panvalue_connections, invalidator(*this), boost::bind (&StereoPanner::value_change, this), gui_context());
_panner_shell->Changed.connect (panshell_connections, invalidator (*this), boost::bind (&StereoPanner::bypass_handler, this), gui_context());
ColorsChanged.connect (sigc::mem_fun (*this, &StereoPanner::color_handler));
@ -693,6 +694,20 @@ StereoPanner::bypass_handler ()
queue_draw ();
}
void
StereoPanner::pannable_handler ()
{
panvalue_connections.drop_connections();
position_control = _panner->pannable()->pan_azimuth_control;
width_control = _panner->pannable()->pan_width_control;
position_binder.set_controllable(position_control);
width_binder.set_controllable(width_control);
position_control->Changed.connect (panvalue_connections, invalidator(*this), boost::bind (&StereoPanner::value_change, this), gui_context());
width_control->Changed.connect (panvalue_connections, invalidator(*this), boost::bind (&StereoPanner::value_change, this), gui_context());
queue_draw ();
}
PannerEditor*
StereoPanner::editor ()
{

View File

@ -64,7 +64,8 @@ class StereoPanner : public PannerInterface
boost::shared_ptr<PBD::Controllable> position_control;
boost::shared_ptr<PBD::Controllable> width_control;
PBD::ScopedConnectionList connections;
PBD::ScopedConnectionList panvalue_connections;
PBD::ScopedConnectionList panshell_connections;
bool dragging;
bool dragging_position;
bool dragging_left;
@ -103,6 +104,7 @@ class StereoPanner : public PannerInterface
static bool have_colors;
void color_handler ();
void bypass_handler ();
void pannable_handler ();
};
#endif /* __gtk_ardour_stereo_panner_h__ */

View File

@ -368,7 +368,6 @@ Delivery::set_state (const XMLNode& node, int version)
XMLNode* pannnode = node.child (X_("Pannable"));
if (_panshell && _panshell->panner() && pannnode) {
_panshell->pannable()->set_state (*pannnode, version);
_panshell->pannable()->set_panner(_panshell->panner());
}
return 0;
@ -399,11 +398,8 @@ Delivery::reset_panner ()
if (!_no_panner_reset) {
if (_panshell) {
assert (_role == Main || _role == Aux || _role == Send);
_panshell->configure_io (ChanCount (DataType::AUDIO, pans_required()), ChanCount (DataType::AUDIO, pan_outs()));
if (_role == Main || _role == Aux || _role == Send) {
_panshell->pannable()->set_panner (_panshell->panner());
}
}
}
@ -417,11 +413,8 @@ void
Delivery::panners_became_legal ()
{
if (_panshell) {
assert (_role == Main || _role == Aux || _role == Send);
_panshell->configure_io (ChanCount (DataType::AUDIO, pans_required()), ChanCount (DataType::AUDIO, pan_outs()));
if (_role == Main) {
_panshell->pannable()->set_panner (_panshell->panner());
}
}
panner_legal_c.disconnect ();

View File

@ -101,6 +101,7 @@ PannerShell::configure_io (ChanCount in, ChanCount out)
if (!_force_reselect && _panner && (_panner->in().n_audio() == nins) && (_panner->out().n_audio() == nouts)) {
return;
}
_force_reselect = false;
if (nouts < 2 || nins == 0) {
/* no need for panning with less than 2 outputs or no inputs */
@ -108,6 +109,9 @@ PannerShell::configure_io (ChanCount in, ChanCount out)
_panner.reset ();
_current_panner_uri = "";
_panner_gui_uri = "";
if (!_is_send || !_panlinked) {
pannable()->set_panner(_panner);
}
Changed (); /* EMIT SIGNAL */
}
return;
@ -140,6 +144,9 @@ PannerShell::configure_io (ChanCount in, ChanCount out)
_current_panner_uri = pi->descriptor.panner_uri;
_panner_gui_uri = pi->descriptor.gui_uri;
if (!_is_send || !_panlinked) {
pannable()->set_panner(_panner);
}
Changed (); /* EMIT SIGNAL */
}
@ -192,6 +199,15 @@ PannerShell::set_state (const XMLNode& node, int version)
_is_send ? _pannable_internal : _pannable_route, _session.get_speakers ()));
_current_panner_uri = p->descriptor.panner_uri;
_panner_gui_uri = p->descriptor.gui_uri;
if (_is_send) {
if (!_panlinked) {
_pannable_internal->set_panner(_panner);
} else {
_force_reselect = true;
}
} else {
_pannable_route->set_panner(_panner);
}
if (_panner->set_state (**niter, version) == 0) {
return -1;
}
@ -426,7 +442,9 @@ PannerShell::select_panner_by_uri (std::string const uri)
ChanCount in = _panner->in();
ChanCount out = _panner->out();
configure_io(in, out);
pannable()->set_panner(_panner);
if (!_is_send || !_panlinked) {
pannable()->set_panner(_panner);
}
_session.set_dirty ();
}
return true;
@ -435,9 +453,20 @@ PannerShell::select_panner_by_uri (std::string const uri)
void
PannerShell::set_linked_to_route (bool onoff)
{
if (!_is_send || onoff == _panlinked) {
assert(_is_send);
if (onoff == _panlinked) {
return;
}
/* set _pannable-_has_state = true
* this way the panners will pick it up
* when it is re-created
*/
if (pannable()) {
XMLNode state = pannable()->get_state();
pannable()->set_state(state, 3000);
}
_panlinked = onoff;
_force_reselect = true;
@ -446,7 +475,9 @@ PannerShell::set_linked_to_route (bool onoff)
ChanCount in = _panner->in();
ChanCount out = _panner->out();
configure_io(in, out);
pannable()->set_panner(_panner);
if (!_panlinked) {
pannable()->set_panner(_panner);
}
_session.set_dirty ();
}
PannableChanged();

View File

@ -81,7 +81,7 @@ Send::Send (Session& s, boost::shared_ptr<Pannable> p, boost::shared_ptr<MuteMas
_bitslot = 0;
}
boost_debug_shared_ptr_mark_interesting (this, "send");
//boost_debug_shared_ptr_mark_interesting (this, "send");
_amp.reset (new Amp (_session));
_meter.reset (new PeakMeter (_session, name()));

View File

@ -81,6 +81,9 @@ VBAPanner::VBAPanner (boost::shared_ptr<Pannable> p, boost::shared_ptr<Speakers>
_pannable->pan_azimuth_control->Changed.connect_same_thread (*this, boost::bind (&VBAPanner::update, this));
_pannable->pan_elevation_control->Changed.connect_same_thread (*this, boost::bind (&VBAPanner::update, this));
_pannable->pan_width_control->Changed.connect_same_thread (*this, boost::bind (&VBAPanner::update, this));
if (!_pannable->has_state()) {
reset();
}
update ();
}

View File

@ -177,7 +177,7 @@ Strip::set_route (boost::shared_ptr<Route> r, bool /*with_messages*/)
boost::shared_ptr<Pannable> pannable = _route->pannable();
if (pannable && pannable->panner()) {
if (pannable && _route->panner()) {
pannable->pan_azimuth_control->Changed.connect(route_connections, MISSING_INVALIDATOR, boost::bind (&Strip::notify_panner_azi_changed, this, false), ui_context());
pannable->pan_width_control->Changed.connect(route_connections, MISSING_INVALIDATOR, boost::bind (&Strip::notify_panner_width_changed, this, false), ui_context());
}
@ -211,7 +211,7 @@ Strip::set_route (boost::shared_ptr<Route> r, bool /*with_messages*/)
possible_pot_parameters.clear();
if (pannable) {
boost::shared_ptr<Panner> panner = pannable->panner();
boost::shared_ptr<Panner> panner = _route->panner();
if (panner) {
set<Evoral::Parameter> automatable = panner->what_can_be_automated ();
set<Evoral::Parameter>::iterator a;
@ -352,7 +352,7 @@ Strip::notify_panner_azi_changed (bool force_update)
boost::shared_ptr<Pannable> pannable = _route->pannable();
if (!pannable || !pannable->panner()) {
if (!pannable || !_route->panner()) {
_surface->write (_vpot->zero());
return;
}
@ -391,7 +391,7 @@ Strip::notify_panner_width_changed (bool force_update)
boost::shared_ptr<Pannable> pannable = _route->pannable();
if (!pannable || !pannable->panner()) {
if (!pannable || !_route->panner()) {
_surface->write (_vpot->zero());
return;
}
@ -606,8 +606,8 @@ Strip::do_parameter_display (AutomationType type, float val)
case PanAzimuthAutomation:
if (_route) {
boost::shared_ptr<Pannable> p = _route->pannable();
if (p && p->panner()) {
string str = p->panner()->value_as_string (p->pan_azimuth_control);
if (p && _route->panner()) {
string str =_route->panner()->value_as_string (p->pan_azimuth_control);
_surface->write (display (1, str));
}
}

View File

@ -146,10 +146,10 @@ Onset::initialise(size_t channels, size_t stepSize, size_t blockSize)
return true;
}
#ifdef HAVE_AUBIO4
void
Onset::reset()
{
#ifdef HAVE_AUBIO4
if (m_onsetdet) del_aubio_onset(m_onsetdet);
m_onsetdet = new_aubio_onset
@ -166,8 +166,8 @@ Onset::reset()
lrintf(m_inputSampleRate));
m_lastOnset = Vamp::RealTime::zeroTime - m_delay - m_delay;
}
#endif
}
size_t
Onset::getPreferredStepSize() const

View File

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<ArdourMIDIBindings version="1.0.0" name="Roland V-Studio 20">
<DeviceInfo bank-size="8"/>
<!-- Track Group UP -->
<Binding channel="1" note="47" function="prev-bank" momentary="yes"/>
<!-- Track Group DOWN -->
<Binding channel="1" note="46" function="next-bank" momentary="yes"/>
<!-- Transport controls -->
<Binding channel="2" note="33" action="Transport/GotoZero" momentary="yes"/> <!-- Fix for non-working transport-zero action -->
<Binding channel="1" note="91" function="transport-start" momentary="yes"/>
<Binding channel="1" note="92" function="transport-end" momentary="yes"/>
<Binding channel="1" note="93" function="transport-stop" momentary="yes"/>
<Binding channel="1" note="94" function="transport-roll" momentary="yes"/>
<Binding channel="1" note="95" action="Transport/Record" momentary="yes"/> <!-- Makes record toggle -->
<!-- Track Select -->
<Binding channel="1" note="24" uri="/route/recenable B1"/>
<Binding channel="1" note="25" uri="/route/recenable B2"/>
<Binding channel="1" note="26" uri="/route/recenable B3"/>
<Binding channel="1" note="27" uri="/route/recenable B4"/>
<Binding channel="1" note="28" uri="/route/recenable B5"/>
<Binding channel="1" note="29" uri="/route/recenable B6"/>
<Binding channel="1" note="30" uri="/route/recenable B7"/>
<Binding channel="1" note="31" uri="/route/recenable B8"/>
<!-- Faders -->
<Binding channel="1" pb="0" uri="/route/gain B1"/>
<Binding channel="2" pb="0" uri="/route/gain B2"/>
<Binding channel="3" pb="0" uri="/route/gain B3"/>
<Binding channel="4" pb="0" uri="/route/gain B4"/>
<Binding channel="5" pb="0" uri="/route/gain B5"/>
<Binding channel="6" pb="0" uri="/route/gain B6"/>
<Binding channel="7" pb="0" uri="/route/gain B7"/>
<Binding channel="8" pb="0" uri="/route/gain B8"/>
<!-- Gain controls -->
<Binding channel="9" pb="0" uri="/bus/gain master"/>
</ArdourMIDIBindings>