2005-09-25 14:42:24 -04:00
|
|
|
/*
|
2019-08-02 17:26:43 -04:00
|
|
|
* Copyright (C) 2005-2006 Nick Mainsbridge <mainsbridge@gmail.com>
|
|
|
|
* Copyright (C) 2005-2006 Taybin Rutkin <taybin@taybin.com>
|
|
|
|
* Copyright (C) 2005-2017 Paul Davis <paul@linuxaudiosystems.com>
|
|
|
|
* Copyright (C) 2006-2007 Doug McLain <doug@nostar.net>
|
|
|
|
* Copyright (C) 2006-2012 David Robillard <d@drobilla.net>
|
|
|
|
* Copyright (C) 2006 Sampo Savolainen <v2@iki.fi>
|
|
|
|
* Copyright (C) 2008-2012 Carl Hetherington <carl@carlh.net>
|
|
|
|
* Copyright (C) 2012-2019 Robin Gareus <robin@gareus.org>
|
|
|
|
* Copyright (C) 2014-2015 Tim Mayberry <mojofunk@gmail.com>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
#include <limits.h>
|
|
|
|
|
2005-09-25 16:33:00 -04:00
|
|
|
#include <gtkmm2ext/utils.h>
|
2012-05-24 02:09:29 -04:00
|
|
|
|
2009-02-25 13:26:51 -05:00
|
|
|
#include "pbd/fastlog.h"
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2012-05-24 02:09:29 -04:00
|
|
|
#include "ardour/pannable.h"
|
|
|
|
#include "ardour/panner.h"
|
|
|
|
#include "ardour/panner_shell.h"
|
|
|
|
#include "ardour/session.h"
|
|
|
|
|
2017-07-15 11:38:28 -04:00
|
|
|
#include "widgets/tooltips.h"
|
|
|
|
|
2019-10-31 10:55:46 -04:00
|
|
|
#include "gain_meter.h"
|
2005-09-25 14:42:24 -04:00
|
|
|
#include "panner_ui.h"
|
|
|
|
#include "panner2d.h"
|
|
|
|
#include "gui_thread.h"
|
2010-11-30 15:22:43 -05:00
|
|
|
#include "stereo_panner.h"
|
2014-12-25 10:02:00 -05:00
|
|
|
#include "timers.h"
|
2011-01-07 12:36:01 -05:00
|
|
|
#include "mono_panner.h"
|
2015-01-04 10:58:46 -05:00
|
|
|
#include "ui_config.h"
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2016-07-14 14:44:52 -04:00
|
|
|
#include "pbd/i18n.h"
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-05-12 13:03:42 -04:00
|
|
|
using namespace std;
|
2005-09-25 14:42:24 -04:00
|
|
|
using namespace ARDOUR;
|
Large nasty commit in the form of a 5000 line patch chock-full of completely
unecessary changes. (Sorry, doing a "sprint" based thing, this is the end of the first one)
Achieved MIDI track and bus creation, associated Jack port and diskstream creation, and minimal GUI stuff for creating them. Should be set to start work on actually recording and playing midi to/from disk now.
Relevant (significant) changes:
- Creation of a Buffer class. Base class is type agnostic so things can point to a buffer but not care what kind it is (otherwise it'd be a template). Derived into AudioBuffer and MidiBuffer, with a type tag because checking type is necessary in parts of the code where dynamic_cast wouldn't be wise. Originally I considered this a hack, but passing around a type proved to be a very good solution to all the other problems (below). There is a 1:1 mapping between jack port data types and ardour Buffer types (with a conversion function), but that's easily removed if it ever becomes necessary. Having the type scoped in the Buffer class is maybe not the best spot for it, but whatever (this is proof of concept kinda stuff right now...)
- IO now has a "default" port type (passed to the constructor and stored as a member), used by ensure_io (and similar) to create n ports. IO::register_***_port has a type argument that defaults to the default type if not passed. Rationale: previous IO API is identical, no changes needed to existing code, but path is paved for multiple port types in one IO, which we will need for eg synth plugin inserts, among other things. This is not quite ideal (best would be to only have the two port register functions and have them take a type), but the alternative is a lot of work (namely destroying the 'ensure' functions and everything that uses them) for very little gain. (I am convinced after quite a few tries at the whiteboard that subclassing IO in any way is not a feasible option, look at it's inheritance diagram in Doxygen and you can see why)
- AudioEngine::register_audio_input_port is now register_input_port and takes a type argument. Ditto for output.
- (Most significant change) AudioDiskstream abstracted into Distream, and sibling MidiDiskstream created. Very much still a work in progress, but Diskstream is there to switch references over to (most already are), which is the important part. It is still unclear what the MIDI diskstream's relation to channels is, but I'm pretty sure they will be single channel only (so SMF Type 0) since noone can come up with a reason otherwise.
- MidiTrack creation. Same thing as AudioTrack but with a different default type basically. No big deal here.
- Random cleanups and variable renamings etc. because I have OCD and can't help myself. :)
Known broken: Loading of sessions containing MIDI tracks.
git-svn-id: svn://localhost/ardour2/branches/midi@641 d708f5d6-7413-0410-9779-e7cbd77b26cf
2006-06-26 12:01:34 -04:00
|
|
|
using namespace PBD;
|
2005-09-25 16:33:00 -04:00
|
|
|
using namespace Gtkmm2ext;
|
2005-09-25 14:42:24 -04:00
|
|
|
using namespace Gtk;
|
|
|
|
|
2009-12-17 13:24:23 -05:00
|
|
|
PannerUI::PannerUI (Session* s)
|
|
|
|
: _current_nouts (-1)
|
2011-01-26 20:31:03 -05:00
|
|
|
, _current_nins (-1)
|
2014-02-07 12:05:47 -05:00
|
|
|
, _current_uri ("")
|
2014-06-17 09:51:49 -04:00
|
|
|
, _send_mode (false)
|
2009-12-17 13:24:23 -05:00
|
|
|
, pan_automation_state_button ("")
|
2014-01-08 18:18:29 -05:00
|
|
|
, _panner_list()
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2009-12-17 13:24:23 -05:00
|
|
|
set_session (s);
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
ignore_toggle = false;
|
|
|
|
pan_menu = 0;
|
2008-12-08 11:07:28 -05:00
|
|
|
pan_astate_menu = 0;
|
|
|
|
pan_astyle_menu = 0;
|
2005-09-25 14:42:24 -04:00
|
|
|
in_pan_update = false;
|
2017-07-01 12:42:24 -04:00
|
|
|
_stereo_panner = 0;
|
2011-10-29 10:29:23 -04:00
|
|
|
_mono_panner = 0;
|
2017-07-01 12:42:24 -04:00
|
|
|
_ignore_width_change = false;
|
|
|
|
_ignore_position_change = false;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2006-05-19 13:29:05 -04:00
|
|
|
pan_automation_state_button.set_name ("MixerAutomationPlaybackButton");
|
|
|
|
|
2017-07-15 11:38:28 -04:00
|
|
|
ArdourWidgets::set_tooltip (pan_automation_state_button, _("Pan automation mode"));
|
2006-05-19 13:29:05 -04:00
|
|
|
|
2006-06-13 03:27:52 -04:00
|
|
|
//set_size_request_to_display_given_text (pan_automation_state_button, X_("O"), 2, 2);
|
2006-05-21 06:11:59 -04:00
|
|
|
|
2006-05-19 13:29:05 -04:00
|
|
|
pan_automation_state_button.unset_flags (Gtk::CAN_FOCUS);
|
|
|
|
|
2009-12-11 18:29:48 -05:00
|
|
|
pan_automation_state_button.signal_button_press_event().connect (sigc::mem_fun(*this, &PannerUI::pan_automation_state_button_event), false);
|
2006-05-19 13:29:05 -04:00
|
|
|
|
2007-01-09 18:24:54 -05:00
|
|
|
pan_vbox.set_spacing (2);
|
2007-03-18 02:07:08 -04:00
|
|
|
pack_start (pan_vbox, true, true);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2010-04-17 18:51:22 -04:00
|
|
|
twod_panner = 0;
|
2008-12-13 10:18:32 -05:00
|
|
|
big_window = 0;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2006-05-24 18:43:15 -04:00
|
|
|
set_width(Narrow);
|
2008-12-08 11:07:28 -05:00
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-12-08 11:07:28 -05:00
|
|
|
void
|
2011-02-22 13:44:22 -05:00
|
|
|
PannerUI::set_panner (boost::shared_ptr<PannerShell> ps, boost::shared_ptr<Panner> p)
|
2008-12-08 11:07:28 -05:00
|
|
|
{
|
2017-07-01 12:42:24 -04:00
|
|
|
/* note that the panshell might not change here (i.e. ps == _panshell)
|
|
|
|
*/
|
2011-02-22 13:44:22 -05:00
|
|
|
|
2019-04-13 11:48:27 -04:00
|
|
|
connections.drop_connections ();
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-12-18 14:31:00 -05:00
|
|
|
delete pan_astyle_menu;
|
|
|
|
pan_astyle_menu = 0;
|
|
|
|
|
|
|
|
delete pan_astate_menu;
|
|
|
|
pan_astate_menu = 0;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2017-07-01 12:42:24 -04:00
|
|
|
_panshell = ps;
|
2009-06-09 16:21:19 -04:00
|
|
|
_panner = p;
|
|
|
|
|
2010-04-17 18:51:22 -04:00
|
|
|
delete twod_panner;
|
|
|
|
twod_panner = 0;
|
2009-05-16 22:08:13 -04:00
|
|
|
|
2017-07-01 12:42:24 -04:00
|
|
|
delete _stereo_panner;
|
|
|
|
_stereo_panner = 0;
|
2010-12-30 13:58:27 -05:00
|
|
|
|
2017-07-01 12:42:24 -04:00
|
|
|
delete _mono_panner;
|
|
|
|
_mono_panner = 0;
|
2012-12-23 18:15:47 -05:00
|
|
|
|
2009-06-09 16:21:19 -04:00
|
|
|
if (!_panner) {
|
2009-05-16 22:08:13 -04:00
|
|
|
return;
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2011-02-22 13:44:22 -05:00
|
|
|
_panshell->Changed.connect (connections, invalidator (*this), boost::bind (&PannerUI::panshell_changed, this), gui_context());
|
2009-08-29 20:40:48 -04:00
|
|
|
|
2017-07-01 12:42:24 -04:00
|
|
|
/* new panner object, force complete reset of panner GUI
|
|
|
|
*/
|
2010-12-30 13:58:27 -05:00
|
|
|
|
2017-07-01 12:42:24 -04:00
|
|
|
_current_nouts = 0;
|
|
|
|
_current_nins = 0;
|
2010-12-30 13:58:27 -05:00
|
|
|
|
2017-07-01 12:42:24 -04:00
|
|
|
setup_pan ();
|
2005-09-25 14:42:24 -04:00
|
|
|
update_pan_sensitive ();
|
2006-05-19 13:29:05 -04:00
|
|
|
pan_automation_state_changed ();
|
2008-12-08 11:07:28 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
PannerUI::build_astate_menu ()
|
|
|
|
{
|
|
|
|
using namespace Menu_Helpers;
|
|
|
|
|
|
|
|
if (pan_astate_menu == 0) {
|
|
|
|
pan_astate_menu = new Menu;
|
|
|
|
pan_astate_menu->set_name ("ArdourContextMenu");
|
|
|
|
} else {
|
|
|
|
pan_astate_menu->items().clear ();
|
|
|
|
}
|
|
|
|
|
2020-03-23 11:38:22 -04:00
|
|
|
boost::shared_ptr<Pannable> pannable = _panshell->pannable();
|
|
|
|
|
2019-10-31 18:57:46 -04:00
|
|
|
pan_astate_menu->items().push_back (MenuElem (GainMeterBase::astate_string (ARDOUR::Off),
|
2020-03-23 11:38:22 -04:00
|
|
|
sigc::bind ( sigc::mem_fun (pannable.get(), &Pannable::set_automation_state), (AutoState) ARDOUR::Off)));
|
2019-10-31 18:57:46 -04:00
|
|
|
pan_astate_menu->items().push_back (MenuElem (GainMeterBase::astate_string (ARDOUR::Play),
|
2020-03-23 11:38:22 -04:00
|
|
|
sigc::bind ( sigc::mem_fun (pannable.get(), &Pannable::set_automation_state), (AutoState) Play)));
|
2019-10-31 18:57:46 -04:00
|
|
|
pan_astate_menu->items().push_back (MenuElem (GainMeterBase::astate_string (ARDOUR::Write),
|
2020-03-23 11:38:22 -04:00
|
|
|
sigc::bind ( sigc::mem_fun (pannable.get(), &Pannable::set_automation_state), (AutoState) Write)));
|
2019-10-31 18:57:46 -04:00
|
|
|
pan_astate_menu->items().push_back (MenuElem (GainMeterBase::astate_string (ARDOUR::Touch),
|
2020-03-23 11:38:22 -04:00
|
|
|
sigc::bind (sigc::mem_fun (pannable.get(), &Pannable::set_automation_state), (AutoState) Touch)));
|
2019-10-31 18:57:46 -04:00
|
|
|
pan_astate_menu->items().push_back (MenuElem (GainMeterBase::astate_string (ARDOUR::Latch),
|
2020-03-23 11:38:22 -04:00
|
|
|
sigc::bind ( sigc::mem_fun (pannable.get(), &Pannable::set_automation_state), (AutoState) Latch)));
|
2008-12-08 11:07:28 -05:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
PannerUI::build_astyle_menu ()
|
|
|
|
{
|
|
|
|
using namespace Menu_Helpers;
|
|
|
|
|
|
|
|
if (pan_astyle_menu == 0) {
|
|
|
|
pan_astyle_menu = new Menu;
|
|
|
|
pan_astyle_menu->set_name ("ArdourContextMenu");
|
|
|
|
} else {
|
|
|
|
pan_astyle_menu->items().clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
pan_astyle_menu->items().push_back (MenuElem (_("Trim")));
|
|
|
|
pan_astyle_menu->items().push_back (MenuElem (_("Abs")));
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2010-11-29 22:10:01 -05:00
|
|
|
void
|
|
|
|
PannerUI::on_size_allocate (Allocation& a)
|
|
|
|
{
|
2017-07-01 12:42:24 -04:00
|
|
|
HBox::on_size_allocate (a);
|
2010-11-29 22:10:01 -05:00
|
|
|
}
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
void
|
|
|
|
PannerUI::set_width (Width w)
|
|
|
|
{
|
|
|
|
_width = w;
|
|
|
|
}
|
|
|
|
|
|
|
|
PannerUI::~PannerUI ()
|
|
|
|
{
|
2010-04-17 18:51:22 -04:00
|
|
|
delete twod_panner;
|
2008-12-18 14:31:00 -05:00
|
|
|
delete big_window;
|
|
|
|
delete pan_menu;
|
|
|
|
delete pan_astyle_menu;
|
|
|
|
delete pan_astate_menu;
|
2017-07-01 12:42:24 -04:00
|
|
|
delete _stereo_panner;
|
|
|
|
delete _mono_panner;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2011-02-22 13:44:22 -05:00
|
|
|
PannerUI::panshell_changed ()
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2014-01-08 18:18:29 -05:00
|
|
|
set_panner (_panshell, _panshell->panner());
|
2005-09-25 14:42:24 -04:00
|
|
|
setup_pan ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
PannerUI::setup_pan ()
|
|
|
|
{
|
2011-11-17 19:22:31 -05:00
|
|
|
int const nouts = _panner ? _panner->out().n_audio() : -1;
|
|
|
|
int const nins = _panner ? _panner->in().n_audio() : -1;
|
2009-06-09 16:21:19 -04:00
|
|
|
|
2019-09-29 15:03:27 -04:00
|
|
|
assert (_panshell);
|
|
|
|
|
2014-02-07 12:05:47 -05:00
|
|
|
if (nouts == _current_nouts
|
|
|
|
&& nins == _current_nins
|
|
|
|
&& _current_uri == _panshell->panner_gui_uri()
|
|
|
|
)
|
|
|
|
{
|
2009-08-29 20:40:48 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-07-01 12:42:24 -04:00
|
|
|
_current_nins = nins;
|
|
|
|
_current_nouts = nouts;
|
|
|
|
_current_uri = _panshell->panner_gui_uri();
|
2011-02-22 13:44:22 -05:00
|
|
|
|
2017-07-01 12:42:24 -04:00
|
|
|
container_clear (pan_vbox);
|
2010-12-01 11:12:04 -05:00
|
|
|
|
2017-07-01 12:42:24 -04:00
|
|
|
delete twod_panner;
|
|
|
|
twod_panner = 0;
|
|
|
|
delete _stereo_panner;
|
|
|
|
_stereo_panner = 0;
|
2011-10-29 10:58:49 -04:00
|
|
|
delete _mono_panner;
|
|
|
|
_mono_panner = 0;
|
2011-02-22 13:44:22 -05:00
|
|
|
|
2011-11-17 19:22:31 -05:00
|
|
|
if (!_panner) {
|
2014-01-13 06:02:00 -05:00
|
|
|
delete big_window;
|
|
|
|
big_window = 0;
|
2011-11-17 19:22:31 -05:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-01-02 09:44:54 -05:00
|
|
|
const float scale = std::max (1.f, UIConfiguration::instance().get_ui_scale());
|
2015-04-20 14:45:14 -04:00
|
|
|
|
2014-02-07 12:05:47 -05:00
|
|
|
if (_current_uri == "http://ardour.org/plugin/panner_2in2out#ui")
|
2014-01-08 18:18:29 -05:00
|
|
|
{
|
2014-01-13 06:02:00 -05:00
|
|
|
delete big_window;
|
|
|
|
big_window = 0;
|
|
|
|
|
2014-01-08 18:18:29 -05:00
|
|
|
boost::shared_ptr<Pannable> pannable = _panner->pannable();
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2014-01-08 18:18:29 -05:00
|
|
|
_stereo_panner = new StereoPanner (_panshell);
|
2015-04-22 15:34:27 -04:00
|
|
|
_stereo_panner->set_size_request (-1, 5 * ceilf(7.f * scale));
|
2014-06-17 09:51:49 -04:00
|
|
|
_stereo_panner->set_send_drawing_mode (_send_mode);
|
2014-01-08 18:18:29 -05:00
|
|
|
pan_vbox.pack_start (*_stereo_panner, false, false);
|
2011-01-07 17:18:53 -05:00
|
|
|
|
2014-01-08 18:18:29 -05:00
|
|
|
boost::shared_ptr<AutomationControl> ac;
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2014-01-08 18:18:29 -05:00
|
|
|
ac = pannable->pan_azimuth_control;
|
|
|
|
_stereo_panner->StartPositionGesture.connect (sigc::bind (sigc::mem_fun (*this, &PannerUI::start_touch),
|
|
|
|
boost::weak_ptr<AutomationControl> (ac)));
|
|
|
|
_stereo_panner->StopPositionGesture.connect (sigc::bind (sigc::mem_fun (*this, &PannerUI::stop_touch),
|
|
|
|
boost::weak_ptr<AutomationControl>(ac)));
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2014-01-08 18:18:29 -05:00
|
|
|
ac = pannable->pan_width_control;
|
|
|
|
_stereo_panner->StartWidthGesture.connect (sigc::bind (sigc::mem_fun (*this, &PannerUI::start_touch),
|
|
|
|
boost::weak_ptr<AutomationControl> (ac)));
|
|
|
|
_stereo_panner->StopWidthGesture.connect (sigc::bind (sigc::mem_fun (*this, &PannerUI::stop_touch),
|
|
|
|
boost::weak_ptr<AutomationControl>(ac)));
|
|
|
|
_stereo_panner->signal_button_release_event().connect (sigc::mem_fun(*this, &PannerUI::pan_button_event));
|
|
|
|
}
|
2014-02-07 12:05:47 -05:00
|
|
|
else if (_current_uri == "http://ardour.org/plugin/panner_1in2out#ui"
|
|
|
|
|| _current_uri == "http://ardour.org/plugin/panner_balance#ui")
|
2014-01-08 18:18:29 -05:00
|
|
|
{
|
2014-01-13 06:02:00 -05:00
|
|
|
delete big_window;
|
|
|
|
big_window = 0;
|
2014-01-08 18:18:29 -05:00
|
|
|
boost::shared_ptr<Pannable> pannable = _panner->pannable();
|
|
|
|
boost::shared_ptr<AutomationControl> ac = pannable->pan_azimuth_control;
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2014-01-08 18:18:29 -05:00
|
|
|
_mono_panner = new MonoPanner (_panshell);
|
2011-01-26 20:31:03 -05:00
|
|
|
|
2014-01-08 18:18:29 -05:00
|
|
|
_mono_panner->StartGesture.connect (sigc::bind (sigc::mem_fun (*this, &PannerUI::start_touch),
|
|
|
|
boost::weak_ptr<AutomationControl> (ac)));
|
|
|
|
_mono_panner->StopGesture.connect (sigc::bind (sigc::mem_fun (*this, &PannerUI::stop_touch),
|
|
|
|
boost::weak_ptr<AutomationControl>(ac)));
|
2010-11-29 22:10:01 -05:00
|
|
|
|
2014-01-08 18:18:29 -05:00
|
|
|
_mono_panner->signal_button_release_event().connect (sigc::mem_fun(*this, &PannerUI::pan_button_event));
|
2010-12-01 11:12:04 -05:00
|
|
|
|
2015-04-22 15:34:27 -04:00
|
|
|
_mono_panner->set_size_request (-1, 5 * ceilf(7.f * scale));
|
2014-06-17 09:51:49 -04:00
|
|
|
_mono_panner->set_send_drawing_mode (_send_mode);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2014-01-08 18:18:29 -05:00
|
|
|
update_pan_sensitive ();
|
|
|
|
pan_vbox.pack_start (*_mono_panner, false, false);
|
|
|
|
}
|
2014-02-07 12:05:47 -05:00
|
|
|
else if (_current_uri == "http://ardour.org/plugin/panner_vbap#ui")
|
2014-01-08 18:18:29 -05:00
|
|
|
{
|
2010-04-17 18:51:22 -04:00
|
|
|
if (!twod_panner) {
|
2015-04-22 15:34:27 -04:00
|
|
|
twod_panner = new Panner2d (_panshell, rintf(61.f * scale));
|
2010-04-17 18:51:22 -04:00
|
|
|
twod_panner->set_name ("MixerPanZone");
|
|
|
|
twod_panner->show ();
|
2011-01-26 20:31:03 -05:00
|
|
|
twod_panner->signal_button_press_event().connect (sigc::mem_fun(*this, &PannerUI::pan_button_event), false);
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
update_pan_sensitive ();
|
2011-01-26 20:31:03 -05:00
|
|
|
twod_panner->reset (nins);
|
2014-01-08 18:18:29 -05:00
|
|
|
if (big_window) {
|
|
|
|
big_window->reset (nins);
|
|
|
|
}
|
2015-04-22 15:34:27 -04:00
|
|
|
twod_panner->set_size_request (-1, rintf(61.f * scale));
|
2014-06-17 09:51:49 -04:00
|
|
|
twod_panner->set_send_drawing_mode (_send_mode);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2019-04-08 15:40:33 -04:00
|
|
|
/* and finally, add it to the panner frame */
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2014-01-08 18:18:29 -05:00
|
|
|
pan_vbox.pack_start (*twod_panner, false, false);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* stick something into the panning viewport so that it redraws */
|
|
|
|
EventBox* eb = manage (new EventBox());
|
|
|
|
pan_vbox.pack_start (*eb, false, false);
|
|
|
|
|
|
|
|
delete big_window;
|
|
|
|
big_window = 0;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
2010-12-01 11:12:04 -05:00
|
|
|
|
2014-01-08 18:18:29 -05:00
|
|
|
pan_vbox.show_all ();
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2014-06-17 09:51:49 -04:00
|
|
|
void
|
|
|
|
PannerUI::set_send_drawing_mode (bool onoff)
|
|
|
|
{
|
|
|
|
if (_stereo_panner) {
|
|
|
|
_stereo_panner->set_send_drawing_mode (onoff);
|
|
|
|
} else if (_mono_panner) {
|
|
|
|
_mono_panner->set_send_drawing_mode (onoff);
|
|
|
|
} else if (twod_panner) {
|
|
|
|
twod_panner->set_send_drawing_mode (onoff);
|
|
|
|
}
|
|
|
|
_send_mode = onoff;
|
|
|
|
}
|
|
|
|
|
2010-08-19 17:09:40 -04:00
|
|
|
void
|
|
|
|
PannerUI::start_touch (boost::weak_ptr<AutomationControl> wac)
|
|
|
|
{
|
2017-07-01 12:42:24 -04:00
|
|
|
boost::shared_ptr<AutomationControl> ac = wac.lock();
|
|
|
|
if (!ac) {
|
|
|
|
return;
|
|
|
|
}
|
2017-09-18 12:39:17 -04:00
|
|
|
ac->start_touch (ac->session().transport_sample());
|
2010-08-19 17:09:40 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
PannerUI::stop_touch (boost::weak_ptr<AutomationControl> wac)
|
|
|
|
{
|
2017-07-01 12:42:24 -04:00
|
|
|
boost::shared_ptr<AutomationControl> ac = wac.lock();
|
|
|
|
if (!ac) {
|
|
|
|
return;
|
|
|
|
}
|
2017-09-18 12:39:17 -04:00
|
|
|
ac->stop_touch (ac->session().transport_sample());
|
2010-08-19 17:09:40 -04:00
|
|
|
}
|
|
|
|
|
2006-05-23 15:54:52 -04:00
|
|
|
bool
|
2011-01-26 20:31:03 -05:00
|
|
|
PannerUI::pan_button_event (GdkEventButton* ev)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
switch (ev->button) {
|
2008-12-13 10:18:32 -05:00
|
|
|
case 1:
|
2010-04-17 18:51:22 -04:00
|
|
|
if (twod_panner && ev->type == GDK_2BUTTON_PRESS) {
|
2008-12-13 10:18:32 -05:00
|
|
|
if (!big_window) {
|
2011-07-14 18:17:43 -04:00
|
|
|
big_window = new Panner2dWindow (_panshell, 400, _panner->in().n_audio());
|
2008-12-13 10:18:32 -05:00
|
|
|
}
|
|
|
|
big_window->show ();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
case 3:
|
|
|
|
if (pan_menu == 0) {
|
2019-03-07 10:40:16 -05:00
|
|
|
pan_menu = new Menu;
|
2005-09-25 14:42:24 -04:00
|
|
|
pan_menu->set_name ("ArdourContextMenu");
|
|
|
|
}
|
2011-01-26 20:31:03 -05:00
|
|
|
build_pan_menu ();
|
2017-03-24 09:36:17 -04:00
|
|
|
pan_menu->popup (1, ev->time);
|
2006-05-23 15:54:52 -04:00
|
|
|
return true;
|
2005-09-25 14:42:24 -04:00
|
|
|
break;
|
|
|
|
default:
|
2006-05-23 15:54:52 -04:00
|
|
|
return false;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2006-05-23 15:54:52 -04:00
|
|
|
return false; // what's wrong with gcc?
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2011-01-26 20:31:03 -05:00
|
|
|
PannerUI::build_pan_menu ()
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
using namespace Menu_Helpers;
|
|
|
|
MenuList& items (pan_menu->items());
|
|
|
|
|
|
|
|
items.clear ();
|
|
|
|
|
2009-12-11 18:29:48 -05:00
|
|
|
items.push_back (CheckMenuElem (_("Bypass"), sigc::mem_fun(*this, &PannerUI::pan_bypass_toggle)));
|
2013-07-11 15:32:31 -04:00
|
|
|
bypass_menu_item = static_cast<Gtk::CheckMenuItem*> (&items.back());
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
/* set state first, connect second */
|
|
|
|
|
2011-07-14 18:17:43 -04:00
|
|
|
bypass_menu_item->set_active (_panshell->bypassed());
|
2009-12-11 18:29:48 -05:00
|
|
|
bypass_menu_item->signal_toggled().connect (sigc::mem_fun(*this, &PannerUI::pan_bypass_toggle));
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2014-01-08 18:18:29 -05:00
|
|
|
if (!_panshell->bypassed()) {
|
|
|
|
items.push_back (MenuElem (_("Reset"), sigc::mem_fun (*this, &PannerUI::pan_reset)));
|
|
|
|
items.push_back (MenuElem (_("Edit..."), sigc::mem_fun (*this, &PannerUI::pan_edit)));
|
|
|
|
}
|
|
|
|
|
2014-01-13 09:13:37 -05:00
|
|
|
if (_panner_list.size() > 1 && !_panshell->bypassed()) {
|
2014-01-08 18:18:29 -05:00
|
|
|
RadioMenuItem::Group group;
|
|
|
|
items.push_back (SeparatorElem());
|
|
|
|
|
|
|
|
_suspend_menu_callbacks = true;
|
|
|
|
for (std::map<std::string,std::string>::const_iterator p = _panner_list.begin(); p != _panner_list.end(); ++p) {
|
|
|
|
items.push_back (RadioMenuElem (group, p->second,
|
|
|
|
sigc::bind(sigc::mem_fun (*this, &PannerUI::pan_set_custom_type), p->first)));
|
|
|
|
RadioMenuItem* i = dynamic_cast<RadioMenuItem *> (&items.back ());
|
|
|
|
i->set_active (_panshell->current_panner_uri() == p->first);
|
|
|
|
}
|
|
|
|
_suspend_menu_callbacks = false;
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
PannerUI::pan_bypass_toggle ()
|
|
|
|
{
|
2011-07-14 18:17:43 -04:00
|
|
|
if (bypass_menu_item && (_panshell->bypassed() != bypass_menu_item->get_active())) {
|
|
|
|
_panshell->set_bypassed (!_panshell->bypassed());
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-06-06 07:47:09 -04:00
|
|
|
void
|
|
|
|
PannerUI::pan_edit ()
|
|
|
|
{
|
2014-01-08 18:18:29 -05:00
|
|
|
if (_panshell->bypassed()) {
|
|
|
|
return;
|
|
|
|
}
|
2012-06-06 07:47:09 -04:00
|
|
|
if (_mono_panner) {
|
|
|
|
_mono_panner->edit ();
|
|
|
|
} else if (_stereo_panner) {
|
|
|
|
_stereo_panner->edit ();
|
2014-01-13 05:08:37 -05:00
|
|
|
} else if (twod_panner) {
|
|
|
|
if (!big_window) {
|
|
|
|
big_window = new Panner2dWindow (_panshell, 400, _panner->in().n_audio());
|
|
|
|
}
|
|
|
|
big_window->show ();
|
2012-06-06 07:47:09 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
void
|
2011-01-26 20:31:03 -05:00
|
|
|
PannerUI::pan_reset ()
|
2009-04-30 11:04:16 -04:00
|
|
|
{
|
2014-01-08 18:18:29 -05:00
|
|
|
if (_panshell->bypassed()) {
|
|
|
|
return;
|
|
|
|
}
|
2011-01-26 20:31:03 -05:00
|
|
|
_panner->reset ();
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2014-01-08 18:18:29 -05:00
|
|
|
void
|
|
|
|
PannerUI::pan_set_custom_type (std::string uri) {
|
|
|
|
if (_suspend_menu_callbacks) return;
|
2014-01-13 09:13:37 -05:00
|
|
|
_panshell->select_panner_by_uri(uri);
|
2014-01-08 18:18:29 -05:00
|
|
|
}
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
void
|
|
|
|
PannerUI::effective_pan_display ()
|
|
|
|
{
|
2017-07-01 12:42:24 -04:00
|
|
|
if (_stereo_panner) {
|
|
|
|
_stereo_panner->queue_draw ();
|
|
|
|
} else if (_mono_panner) {
|
|
|
|
_mono_panner->queue_draw ();
|
|
|
|
} else if (twod_panner) {
|
|
|
|
twod_panner->queue_draw ();
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2009-10-14 12:10:01 -04:00
|
|
|
PannerUI::update_pan_sensitive ()
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2011-02-01 21:06:30 -05:00
|
|
|
bool const sensitive = !(_panner->pannable()->automation_state() & Play);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2017-07-01 12:42:24 -04:00
|
|
|
pan_vbox.set_sensitive (sensitive);
|
2011-03-01 21:46:19 -05:00
|
|
|
|
2017-07-01 12:42:24 -04:00
|
|
|
if (big_window) {
|
|
|
|
big_window->set_sensitive (sensitive);
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2006-05-19 13:29:05 -04:00
|
|
|
gint
|
|
|
|
PannerUI::pan_automation_state_button_event (GdkEventButton *ev)
|
|
|
|
{
|
|
|
|
using namespace Menu_Helpers;
|
|
|
|
|
|
|
|
if (ev->type == GDK_BUTTON_RELEASE) {
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (ev->button) {
|
|
|
|
case 1:
|
2008-12-08 11:07:28 -05:00
|
|
|
if (pan_astate_menu == 0) {
|
|
|
|
build_astate_menu ();
|
|
|
|
}
|
2017-03-24 09:36:17 -04:00
|
|
|
pan_astate_menu->popup (1, ev->time);
|
2006-05-19 13:29:05 -04:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
PannerUI::pan_automation_state_changed ()
|
|
|
|
{
|
2017-07-01 12:42:24 -04:00
|
|
|
boost::shared_ptr<Pannable> pannable (_panner->pannable());
|
2019-10-31 10:55:46 -04:00
|
|
|
pan_automation_state_button.set_label (GainMeterBase::short_astate_string(pannable->automation_state()));
|
2006-05-19 13:29:05 -04:00
|
|
|
|
2012-02-07 12:43:55 -05:00
|
|
|
bool x = (pannable->automation_state() != ARDOUR::Off);
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2006-05-19 13:29:05 -04:00
|
|
|
if (pan_automation_state_button.get_active() != x) {
|
2017-07-01 12:42:24 -04:00
|
|
|
ignore_toggle = true;
|
2006-05-19 13:29:05 -04:00
|
|
|
pan_automation_state_button.set_active (x);
|
|
|
|
ignore_toggle = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
update_pan_sensitive ();
|
|
|
|
}
|
|
|
|
|
2010-11-29 22:10:01 -05:00
|
|
|
void
|
|
|
|
PannerUI::show_width ()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
PannerUI::width_adjusted ()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
PannerUI::show_position ()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
PannerUI::position_adjusted ()
|
|
|
|
{
|
|
|
|
}
|
2014-01-08 18:18:29 -05:00
|
|
|
|
|
|
|
void
|
2014-01-13 09:13:37 -05:00
|
|
|
PannerUI::set_available_panners(std::map<std::string,std::string> p)
|
2014-01-08 18:18:29 -05:00
|
|
|
{
|
|
|
|
_panner_list = p;
|
|
|
|
}
|