2005-09-25 14:42:24 -04:00
|
|
|
/*
|
|
|
|
Copyright (C) 2004 Paul Davis
|
|
|
|
|
|
|
|
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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <limits.h>
|
|
|
|
|
2009-02-25 13:26:51 -05:00
|
|
|
#include "ardour/io.h"
|
|
|
|
#include "ardour/dB.h"
|
2005-09-25 16:33:00 -04:00
|
|
|
#include <gtkmm2ext/utils.h>
|
|
|
|
#include <gtkmm2ext/stop_signal.h>
|
|
|
|
#include <gtkmm2ext/barcontroller.h>
|
2009-02-25 13:26:51 -05:00
|
|
|
#include "midi++/manager.h"
|
|
|
|
#include "pbd/fastlog.h"
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
#include "ardour_ui.h"
|
|
|
|
#include "panner_ui.h"
|
|
|
|
#include "panner2d.h"
|
|
|
|
#include "utils.h"
|
2007-01-09 18:24:54 -05:00
|
|
|
#include "panner.h"
|
2005-09-25 14:42:24 -04:00
|
|
|
#include "gui_thread.h"
|
|
|
|
|
2009-06-09 16:21:19 -04:00
|
|
|
#include "ardour/delivery.h"
|
2009-02-25 13:26:51 -05:00
|
|
|
#include "ardour/session.h"
|
|
|
|
#include "ardour/panner.h"
|
|
|
|
#include "ardour/route.h"
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
#include "i18n.h"
|
|
|
|
|
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;
|
|
|
|
|
2007-01-09 18:24:54 -05:00
|
|
|
const int PannerUI::pan_bar_height = 30;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-12-17 13:24:23 -05:00
|
|
|
PannerUI::PannerUI (Session* s)
|
|
|
|
: _current_nouts (-1)
|
|
|
|
, _current_npans (-1)
|
|
|
|
, hAdjustment(0.0, 0.0, 0.0)
|
|
|
|
, vAdjustment(0.0, 0.0, 0.0)
|
|
|
|
, panning_viewport(hAdjustment, vAdjustment)
|
|
|
|
, panning_up_arrow (Gtk::ARROW_UP, Gtk::SHADOW_OUT)
|
|
|
|
, panning_down_arrow (Gtk::ARROW_DOWN, Gtk::SHADOW_OUT)
|
|
|
|
, panning_link_button (_("link"))
|
|
|
|
, pan_automation_style_button ("")
|
|
|
|
, pan_automation_state_button ("")
|
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;
|
|
|
|
|
2006-05-19 13:29:05 -04:00
|
|
|
pan_automation_style_button.set_name ("MixerAutomationModeButton");
|
|
|
|
pan_automation_state_button.set_name ("MixerAutomationPlaybackButton");
|
|
|
|
|
2010-02-08 19:50:24 -05:00
|
|
|
ARDOUR_UI::instance()->set_tip (pan_automation_state_button, _("Pan automation mode"));
|
|
|
|
ARDOUR_UI::instance()->set_tip (pan_automation_style_button, _("Pan automation type"));
|
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);
|
|
|
|
//set_size_request_to_display_given_text (pan_automation_style_button, X_("0"), 2, 2);
|
2006-05-21 06:11:59 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
panning_viewport.set_name (X_("BaseFrame"));
|
|
|
|
|
2010-02-08 19:50:24 -05:00
|
|
|
ARDOUR_UI::instance()->set_tip (panning_link_button,
|
2005-09-25 14:42:24 -04:00
|
|
|
_("panning link control"));
|
2010-02-08 19:50:24 -05:00
|
|
|
ARDOUR_UI::instance()->set_tip (panning_link_direction_button,
|
2005-09-25 14:42:24 -04:00
|
|
|
_("panning link direction"));
|
|
|
|
|
2006-05-19 13:29:05 -04:00
|
|
|
pan_automation_style_button.unset_flags (Gtk::CAN_FOCUS);
|
|
|
|
pan_automation_state_button.unset_flags (Gtk::CAN_FOCUS);
|
|
|
|
|
2009-12-11 18:29:48 -05:00
|
|
|
pan_automation_style_button.signal_button_press_event().connect (sigc::mem_fun(*this, &PannerUI::pan_automation_style_button_event), false);
|
|
|
|
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
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
panning_link_button.set_name (X_("PanningLinkButton"));
|
|
|
|
panning_link_direction_button.set_name (X_("PanningLinkDirectionButton"));
|
|
|
|
|
2006-05-21 09:21:25 -04:00
|
|
|
panning_link_box.pack_start (panning_link_button, true, true);
|
|
|
|
panning_link_box.pack_start (panning_link_direction_button, true, true);
|
2006-06-13 03:27:52 -04:00
|
|
|
panning_link_box.pack_start (pan_automation_state_button, true, true);
|
2006-05-21 09:21:25 -04:00
|
|
|
|
2006-06-13 03:27:52 -04:00
|
|
|
/* the pixmap will be reset at some point, but the key thing is that
|
|
|
|
we need a pixmap in the button just to get started.
|
|
|
|
*/
|
2006-03-12 10:46:29 -05:00
|
|
|
panning_link_direction_button.add (*(manage (new Image (get_xpm("forwardblarrow.xpm")))));
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2005-10-09 01:03:29 -04:00
|
|
|
panning_link_direction_button.signal_clicked().connect
|
2009-12-11 18:29:48 -05:00
|
|
|
(sigc::mem_fun(*this, &PannerUI::panning_link_direction_clicked));
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2005-09-26 14:24:59 -04:00
|
|
|
panning_link_button.signal_button_press_event().connect
|
2009-12-11 18:29:48 -05:00
|
|
|
(sigc::mem_fun(*this, &PannerUI::panning_link_button_press), false);
|
2005-09-26 14:24:59 -04:00
|
|
|
panning_link_button.signal_button_release_event().connect
|
2009-12-11 18:29:48 -05:00
|
|
|
(sigc::mem_fun(*this, &PannerUI::panning_link_button_release), false);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
panning_up.set_border_width (3);
|
|
|
|
panning_down.set_border_width (3);
|
|
|
|
panning_up.add (panning_up_arrow);
|
|
|
|
panning_down.add (panning_down_arrow);
|
|
|
|
panning_up.set_name (X_("PanScrollerBase"));
|
|
|
|
panning_down.set_name (X_("PanScrollerBase"));
|
|
|
|
panning_up_arrow.set_name (X_("PanScrollerArrow"));
|
|
|
|
panning_down_arrow.set_name (X_("PanScrollerArrow"));
|
|
|
|
|
2007-01-09 18:24:54 -05:00
|
|
|
pan_vbox.set_spacing (2);
|
2005-12-18 08:19:02 -05:00
|
|
|
pan_vbox.pack_start (panning_viewport, Gtk::PACK_SHRINK);
|
2006-06-13 03:27:52 -04:00
|
|
|
pan_vbox.pack_start (panning_link_box, Gtk::PACK_SHRINK);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2007-03-18 02:07:08 -04:00
|
|
|
pack_start (pan_vbox, true, true);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
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
|
2009-06-09 16:21:19 -04:00
|
|
|
PannerUI::set_panner (boost::shared_ptr<Panner> p)
|
2008-12-08 11:07:28 -05:00
|
|
|
{
|
2009-12-17 13:24:23 -05: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
|
|
|
|
2009-06-09 16:21:19 -04:00
|
|
|
_panner = p;
|
|
|
|
|
2008-12-18 14:31:00 -05:00
|
|
|
delete panner;
|
|
|
|
panner = 0;
|
2009-05-16 22:08:13 -04: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
|
|
|
|
2010-03-30 11:18:43 -04:00
|
|
|
_panner->Changed.connect (connections, invalidator (*this), boost::bind (&PannerUI::panner_changed, this), gui_context());
|
|
|
|
_panner->LinkStateChanged.connect (connections, invalidator (*this), boost::bind (&PannerUI::update_pan_linkage, this), gui_context());
|
|
|
|
_panner->StateChanged.connect (connections, invalidator (*this), boost::bind (&PannerUI::update_pan_state, this), gui_context());
|
2009-08-29 20:40:48 -04:00
|
|
|
|
2008-12-12 09:43:24 -05:00
|
|
|
setup_pan ();
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
pan_changed (0);
|
|
|
|
update_pan_sensitive ();
|
|
|
|
update_pan_linkage ();
|
2006-05-19 13:29:05 -04:00
|
|
|
pan_automation_state_changed ();
|
2007-07-07 05:36:56 -04:00
|
|
|
|
2009-10-14 12:10:01 -04:00
|
|
|
#if WHERE_DOES_THIS_LIVE
|
2007-07-07 05:36:56 -04:00
|
|
|
pan_bar_packer.show();
|
|
|
|
panning_viewport.show();
|
|
|
|
panning_up.show();
|
|
|
|
panning_up_arrow.show();
|
|
|
|
panning_down.show();
|
|
|
|
panning_down_arrow.show();
|
|
|
|
pan_vbox.show();
|
|
|
|
panning_link_button.show();
|
|
|
|
panning_link_direction_button.show();
|
|
|
|
panning_link_box.show();
|
|
|
|
pan_automation_style_button.show();
|
|
|
|
pan_automation_state_button.show();
|
|
|
|
show();
|
2008-12-08 11:07:28 -05:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
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 ();
|
|
|
|
}
|
|
|
|
|
2009-12-11 18:29:48 -05:00
|
|
|
pan_astate_menu->items().push_back (MenuElem (_("Manual"), sigc::bind (
|
|
|
|
sigc::mem_fun (_panner.get(), &Panner::set_automation_state),
|
The great audio processing overhaul.
The vast majority of Route signal processing is now simply in the list of
processors. There are definitely regressions here, but there's also
a lot of things fixed. It's far too much work to let diverge anymore
regardless, so here it is.
The basic model is: A route has a fixed set of input channels (matching
its JACK input ports and diskstream). The first processor takes this
as input. The next processor is configured using the first processor's
output as input, and is allowed to choose whatever output it wants
given that input... and so on, and so on. Finally, the last processor's
requested output is used to set up the panner and create whatever Jack
ports are needed to output the data.
All 'special' internal processors (meter, fader, amp, insert, send) are
currently transparent: they read any input, and return the same set
of channels back (unmodified, except for amp).
User visible changes:
* LV2 Instrument support (tracks with both MIDI and audio channels)
* MIDI in/out plugin support
* Generic plugin replication (for MIDI plugins, MIDI/audio plugins)
* Movable meter point
Known Bugs:
* Things seem to get weird on loaded sessions
* Output delivery is sketchy
* 2.0 session loading was probably already broken...
but it's definitely broken now :)
Please test this and file bugs if you have any time...
git-svn-id: svn://localhost/ardour2/branches/3.0@5055 d708f5d6-7413-0410-9779-e7cbd77b26cf
2009-05-07 02:30:50 -04:00
|
|
|
(AutoState) Off)));
|
2009-12-11 18:29:48 -05:00
|
|
|
pan_astate_menu->items().push_back (MenuElem (_("Play"), sigc::bind (
|
|
|
|
sigc::mem_fun (_panner.get(), &Panner::set_automation_state),
|
The great audio processing overhaul.
The vast majority of Route signal processing is now simply in the list of
processors. There are definitely regressions here, but there's also
a lot of things fixed. It's far too much work to let diverge anymore
regardless, so here it is.
The basic model is: A route has a fixed set of input channels (matching
its JACK input ports and diskstream). The first processor takes this
as input. The next processor is configured using the first processor's
output as input, and is allowed to choose whatever output it wants
given that input... and so on, and so on. Finally, the last processor's
requested output is used to set up the panner and create whatever Jack
ports are needed to output the data.
All 'special' internal processors (meter, fader, amp, insert, send) are
currently transparent: they read any input, and return the same set
of channels back (unmodified, except for amp).
User visible changes:
* LV2 Instrument support (tracks with both MIDI and audio channels)
* MIDI in/out plugin support
* Generic plugin replication (for MIDI plugins, MIDI/audio plugins)
* Movable meter point
Known Bugs:
* Things seem to get weird on loaded sessions
* Output delivery is sketchy
* 2.0 session loading was probably already broken...
but it's definitely broken now :)
Please test this and file bugs if you have any time...
git-svn-id: svn://localhost/ardour2/branches/3.0@5055 d708f5d6-7413-0410-9779-e7cbd77b26cf
2009-05-07 02:30:50 -04:00
|
|
|
(AutoState) Play)));
|
2009-12-11 18:29:48 -05:00
|
|
|
pan_astate_menu->items().push_back (MenuElem (_("Write"), sigc::bind (
|
|
|
|
sigc::mem_fun (_panner.get(), &Panner::set_automation_state),
|
The great audio processing overhaul.
The vast majority of Route signal processing is now simply in the list of
processors. There are definitely regressions here, but there's also
a lot of things fixed. It's far too much work to let diverge anymore
regardless, so here it is.
The basic model is: A route has a fixed set of input channels (matching
its JACK input ports and diskstream). The first processor takes this
as input. The next processor is configured using the first processor's
output as input, and is allowed to choose whatever output it wants
given that input... and so on, and so on. Finally, the last processor's
requested output is used to set up the panner and create whatever Jack
ports are needed to output the data.
All 'special' internal processors (meter, fader, amp, insert, send) are
currently transparent: they read any input, and return the same set
of channels back (unmodified, except for amp).
User visible changes:
* LV2 Instrument support (tracks with both MIDI and audio channels)
* MIDI in/out plugin support
* Generic plugin replication (for MIDI plugins, MIDI/audio plugins)
* Movable meter point
Known Bugs:
* Things seem to get weird on loaded sessions
* Output delivery is sketchy
* 2.0 session loading was probably already broken...
but it's definitely broken now :)
Please test this and file bugs if you have any time...
git-svn-id: svn://localhost/ardour2/branches/3.0@5055 d708f5d6-7413-0410-9779-e7cbd77b26cf
2009-05-07 02:30:50 -04:00
|
|
|
(AutoState) Write)));
|
2009-12-11 18:29:48 -05:00
|
|
|
pan_astate_menu->items().push_back (MenuElem (_("Touch"), sigc::bind (
|
|
|
|
sigc::mem_fun (_panner.get(), &Panner::set_automation_state),
|
The great audio processing overhaul.
The vast majority of Route signal processing is now simply in the list of
processors. There are definitely regressions here, but there's also
a lot of things fixed. It's far too much work to let diverge anymore
regardless, so here it is.
The basic model is: A route has a fixed set of input channels (matching
its JACK input ports and diskstream). The first processor takes this
as input. The next processor is configured using the first processor's
output as input, and is allowed to choose whatever output it wants
given that input... and so on, and so on. Finally, the last processor's
requested output is used to set up the panner and create whatever Jack
ports are needed to output the data.
All 'special' internal processors (meter, fader, amp, insert, send) are
currently transparent: they read any input, and return the same set
of channels back (unmodified, except for amp).
User visible changes:
* LV2 Instrument support (tracks with both MIDI and audio channels)
* MIDI in/out plugin support
* Generic plugin replication (for MIDI plugins, MIDI/audio plugins)
* Movable meter point
Known Bugs:
* Things seem to get weird on loaded sessions
* Output delivery is sketchy
* 2.0 session loading was probably already broken...
but it's definitely broken now :)
Please test this and file bugs if you have any time...
git-svn-id: svn://localhost/ardour2/branches/3.0@5055 d708f5d6-7413-0410-9779-e7cbd77b26cf
2009-05-07 02:30:50 -04:00
|
|
|
(AutoState) Touch)));
|
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
|
|
|
}
|
|
|
|
|
2008-09-10 11:03:30 -04:00
|
|
|
boost::shared_ptr<PBD::Controllable>
|
2009-10-14 12:10:01 -04:00
|
|
|
PannerUI::get_controllable()
|
|
|
|
{
|
2008-04-11 10:06:50 -04:00
|
|
|
return pan_bars[0]->get_controllable();
|
|
|
|
}
|
|
|
|
|
2006-05-23 15:54:52 -04:00
|
|
|
bool
|
2009-07-21 11:55:17 -04:00
|
|
|
PannerUI::panning_link_button_press (GdkEventButton*)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2006-05-23 15:54:52 -04:00
|
|
|
return true;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2006-05-23 15:54:52 -04:00
|
|
|
bool
|
2009-07-21 11:55:17 -04:00
|
|
|
PannerUI::panning_link_button_release (GdkEventButton*)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
if (!ignore_toggle) {
|
2009-06-09 16:21:19 -04:00
|
|
|
_panner->set_linked (!_panner->linked());
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
2006-05-23 15:54:52 -04:00
|
|
|
return true;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
PannerUI::panning_link_direction_clicked()
|
|
|
|
{
|
2009-06-09 16:21:19 -04:00
|
|
|
switch (_panner->link_direction()) {
|
2005-09-25 14:42:24 -04:00
|
|
|
case Panner::SameDirection:
|
2009-06-09 16:21:19 -04:00
|
|
|
_panner->set_link_direction (Panner::OppositeDirection);
|
2005-09-25 14:42:24 -04:00
|
|
|
break;
|
|
|
|
default:
|
2009-06-09 16:21:19 -04:00
|
|
|
_panner->set_link_direction (Panner::SameDirection);
|
2005-09-25 14:42:24 -04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
PannerUI::update_pan_linkage ()
|
|
|
|
{
|
2009-12-11 18:29:48 -05:00
|
|
|
ENSURE_GUI_THREAD (*this, &PannerUI::update_pan_linkage)
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-06-09 16:21:19 -04:00
|
|
|
bool x = _panner->linked();
|
2005-09-25 14:42:24 -04:00
|
|
|
bool bx = panning_link_button.get_active();
|
2008-12-12 09:43:24 -05:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
if (x != bx) {
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
ignore_toggle = true;
|
|
|
|
panning_link_button.set_active (x);
|
|
|
|
ignore_toggle = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
panning_link_direction_button.set_sensitive (x);
|
|
|
|
|
2009-06-09 16:21:19 -04:00
|
|
|
switch (_panner->link_direction()) {
|
2005-09-25 14:42:24 -04:00
|
|
|
case Panner::SameDirection:
|
2006-03-12 10:46:29 -05:00
|
|
|
panning_link_direction_button.set_image (*(manage (new Image (get_xpm ("forwardblarrow.xpm")))));
|
2005-09-25 14:42:24 -04:00
|
|
|
break;
|
|
|
|
default:
|
2006-03-12 10:46:29 -05:00
|
|
|
panning_link_direction_button.set_image (*(manage (new Image (get_xpm("revdblarrow.xpm")))));
|
2005-09-25 14:42:24 -04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
PannerUI::set_width (Width w)
|
|
|
|
{
|
|
|
|
switch (w) {
|
|
|
|
case Wide:
|
2006-04-22 12:49:51 -04:00
|
|
|
panning_link_button.set_label (_("link"));
|
2005-09-25 14:42:24 -04:00
|
|
|
break;
|
|
|
|
case Narrow:
|
2006-04-22 12:49:51 -04:00
|
|
|
panning_link_button.set_label (_("L"));
|
2005-09-25 14:42:24 -04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
_width = w;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
PannerUI::~PannerUI ()
|
|
|
|
{
|
|
|
|
for (vector<Adjustment*>::iterator i = pan_adjustments.begin(); i != pan_adjustments.end(); ++i) {
|
|
|
|
delete (*i);
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2007-01-09 18:24:54 -05:00
|
|
|
for (vector<PannerBar*>::iterator i = pan_bars.begin(); i != pan_bars.end(); ++i) {
|
2005-09-25 14:42:24 -04:00
|
|
|
delete (*i);
|
|
|
|
}
|
|
|
|
|
2008-12-18 14:31:00 -05:00
|
|
|
delete panner;
|
|
|
|
delete big_window;
|
|
|
|
delete pan_menu;
|
|
|
|
delete pan_astyle_menu;
|
|
|
|
delete pan_astate_menu;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
PannerUI::panner_changed ()
|
|
|
|
{
|
2009-12-11 18:29:48 -05:00
|
|
|
ENSURE_GUI_THREAD (*this, &PannerUI::panner_changed)
|
2005-09-25 14:42:24 -04:00
|
|
|
setup_pan ();
|
2008-12-12 09:43:24 -05:00
|
|
|
pan_changed (0);
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
PannerUI::update_pan_state ()
|
|
|
|
{
|
|
|
|
/* currently nothing to do */
|
2009-12-11 18:29:48 -05:00
|
|
|
// ENSURE_GUI_THREAD (*this, &PannerUI::update_panner_state)
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
PannerUI::setup_pan ()
|
|
|
|
{
|
2009-06-09 16:21:19 -04:00
|
|
|
if (!_panner) {
|
The great audio processing overhaul.
The vast majority of Route signal processing is now simply in the list of
processors. There are definitely regressions here, but there's also
a lot of things fixed. It's far too much work to let diverge anymore
regardless, so here it is.
The basic model is: A route has a fixed set of input channels (matching
its JACK input ports and diskstream). The first processor takes this
as input. The next processor is configured using the first processor's
output as input, and is allowed to choose whatever output it wants
given that input... and so on, and so on. Finally, the last processor's
requested output is used to set up the panner and create whatever Jack
ports are needed to output the data.
All 'special' internal processors (meter, fader, amp, insert, send) are
currently transparent: they read any input, and return the same set
of channels back (unmodified, except for amp).
User visible changes:
* LV2 Instrument support (tracks with both MIDI and audio channels)
* MIDI in/out plugin support
* Generic plugin replication (for MIDI plugins, MIDI/audio plugins)
* Movable meter point
Known Bugs:
* Things seem to get weird on loaded sessions
* Output delivery is sketchy
* 2.0 session loading was probably already broken...
but it's definitely broken now :)
Please test this and file bugs if you have any time...
git-svn-id: svn://localhost/ardour2/branches/3.0@5055 d708f5d6-7413-0410-9779-e7cbd77b26cf
2009-05-07 02:30:50 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-10-14 19:47:44 -04:00
|
|
|
uint32_t const nouts = _panner->nouts();
|
|
|
|
uint32_t const npans = _panner->npanners();
|
2009-06-09 16:21:19 -04:00
|
|
|
|
2009-10-14 20:57:55 -04:00
|
|
|
if (int32_t (nouts) == _current_nouts && int32_t (npans) == _current_npans) {
|
2009-08-29 20:40:48 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
_current_nouts = nouts;
|
2009-10-14 19:47:44 -04:00
|
|
|
_current_npans = npans;
|
2009-08-29 20:40:48 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
if (nouts == 0 || nouts == 1) {
|
|
|
|
|
|
|
|
while (!pan_adjustments.empty()) {
|
|
|
|
delete pan_bars.back();
|
|
|
|
pan_bars.pop_back ();
|
|
|
|
delete pan_adjustments.back();
|
|
|
|
pan_adjustments.pop_back ();
|
|
|
|
}
|
|
|
|
|
2009-12-21 20:09:50 -05:00
|
|
|
delete panner;
|
|
|
|
panner = 0;
|
|
|
|
|
2007-03-18 02:07:08 -04:00
|
|
|
/* stick something into the panning viewport so that it redraws */
|
|
|
|
|
|
|
|
EventBox* eb = manage (new EventBox());
|
|
|
|
panning_viewport.remove ();
|
|
|
|
panning_viewport.add (*eb);
|
|
|
|
panning_viewport.show_all ();
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
} else if (nouts == 2) {
|
|
|
|
|
|
|
|
vector<Adjustment*>::size_type asz;
|
|
|
|
|
|
|
|
while (!pan_adjustments.empty()) {
|
|
|
|
delete pan_bars.back();
|
|
|
|
pan_bars.pop_back ();
|
|
|
|
delete pan_adjustments.back();
|
|
|
|
pan_adjustments.pop_back ();
|
|
|
|
}
|
|
|
|
|
2009-12-21 20:09:50 -05:00
|
|
|
delete panner;
|
|
|
|
panner = 0;
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
while ((asz = pan_adjustments.size()) < npans) {
|
|
|
|
|
2007-01-09 18:24:54 -05:00
|
|
|
float x, rx;
|
|
|
|
PannerBar* bc;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2007-01-09 18:24:54 -05:00
|
|
|
/* 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 */
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-06-09 16:21:19 -04:00
|
|
|
rx = _panner->pan_control( asz)->get_value();
|
2007-01-09 18:24:54 -05:00
|
|
|
|
|
|
|
if (npans == 1) {
|
|
|
|
x = 0.5;
|
|
|
|
} else if (asz == 0) {
|
|
|
|
x = 0.0;
|
|
|
|
} else if (asz == 1) {
|
|
|
|
x = 1.0;
|
|
|
|
} else {
|
|
|
|
x = rx;
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-05-20 09:28:30 -04:00
|
|
|
pan_adjustments.push_back (new Adjustment (x, 0, 1.0, 0.005, 0.05));
|
2008-10-02 23:16:19 -04:00
|
|
|
bc = new PannerBar (*pan_adjustments[asz],
|
2009-06-09 16:21:19 -04:00
|
|
|
boost::static_pointer_cast<PBD::Controllable>( _panner->pan_control( asz )) );
|
2007-01-09 18:24:54 -05:00
|
|
|
|
|
|
|
/* now set adjustment with current value of panner, then connect the signals */
|
|
|
|
pan_adjustments.back()->set_value(rx);
|
2009-12-11 18:29:48 -05:00
|
|
|
pan_adjustments.back()->signal_value_changed().connect (sigc::bind (sigc::mem_fun(*this, &PannerUI::pan_adjustment_changed), (uint32_t) asz));
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2010-03-30 11:18:43 -04:00
|
|
|
_panner->pan_control( asz )->Changed.connect (connections, invalidator (*this), boost::bind (&PannerUI::pan_value_changed, this, (uint32_t) asz), gui_context());
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
bc->set_name ("PanSlider");
|
2005-10-09 01:03:29 -04:00
|
|
|
bc->set_shadow_type (Gtk::SHADOW_NONE);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-06-09 16:21:19 -04:00
|
|
|
boost::shared_ptr<AutomationControl> ac = _panner->pan_control (asz);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-06-09 16:21:19 -04:00
|
|
|
if (asz) {
|
2009-12-11 18:29:48 -05:00
|
|
|
bc->StartGesture.connect (sigc::mem_fun (*ac, &AutomationControl::start_touch));
|
|
|
|
bc->StopGesture.connect (sigc::mem_fun (*ac, &AutomationControl::stop_touch));
|
2009-06-09 16:21:19 -04:00
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
char buf[64];
|
2006-07-23 08:03:19 -04:00
|
|
|
snprintf (buf, sizeof (buf), _("panner for channel %zu"), asz + 1);
|
2010-02-08 19:50:24 -05:00
|
|
|
ARDOUR_UI::instance()->set_tip (bc->event_widget(), buf);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2005-09-26 14:24:59 -04:00
|
|
|
bc->event_widget().signal_button_release_event().connect
|
2009-12-11 18:29:48 -05:00
|
|
|
(sigc::bind (sigc::mem_fun(*this, &PannerUI::pan_button_event), (uint32_t) asz));
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2007-03-18 02:07:08 -04:00
|
|
|
bc->set_size_request (-1, pan_bar_height);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2007-03-18 02:07:08 -04:00
|
|
|
pan_bars.push_back (bc);
|
2007-01-09 18:24:54 -05:00
|
|
|
pan_bar_packer.pack_start (*bc, false, false);
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* now that we actually have the pan bars,
|
|
|
|
set their sensitivity based on current
|
|
|
|
automation state.
|
|
|
|
*/
|
|
|
|
|
|
|
|
update_pan_sensitive ();
|
|
|
|
|
|
|
|
panning_viewport.remove ();
|
|
|
|
panning_viewport.add (pan_bar_packer);
|
|
|
|
panning_viewport.show_all ();
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
The great audio processing overhaul.
The vast majority of Route signal processing is now simply in the list of
processors. There are definitely regressions here, but there's also
a lot of things fixed. It's far too much work to let diverge anymore
regardless, so here it is.
The basic model is: A route has a fixed set of input channels (matching
its JACK input ports and diskstream). The first processor takes this
as input. The next processor is configured using the first processor's
output as input, and is allowed to choose whatever output it wants
given that input... and so on, and so on. Finally, the last processor's
requested output is used to set up the panner and create whatever Jack
ports are needed to output the data.
All 'special' internal processors (meter, fader, amp, insert, send) are
currently transparent: they read any input, and return the same set
of channels back (unmodified, except for amp).
User visible changes:
* LV2 Instrument support (tracks with both MIDI and audio channels)
* MIDI in/out plugin support
* Generic plugin replication (for MIDI plugins, MIDI/audio plugins)
* Movable meter point
Known Bugs:
* Things seem to get weird on loaded sessions
* Output delivery is sketchy
* 2.0 session loading was probably already broken...
but it's definitely broken now :)
Please test this and file bugs if you have any time...
git-svn-id: svn://localhost/ardour2/branches/3.0@5055 d708f5d6-7413-0410-9779-e7cbd77b26cf
2009-05-07 02:30:50 -04:00
|
|
|
if (!panner) {
|
2009-06-09 16:21:19 -04:00
|
|
|
panner = new Panner2d (_panner, 61);
|
2005-09-25 14:42:24 -04:00
|
|
|
panner->set_name ("MixerPanZone");
|
|
|
|
panner->show ();
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-12-21 20:09:50 -05:00
|
|
|
panner->signal_button_press_event().connect
|
|
|
|
(sigc::bind (sigc::mem_fun(*this, &PannerUI::pan_button_event), (uint32_t) 0), 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 ();
|
2009-11-16 19:38:47 -05:00
|
|
|
panner->reset (npans);
|
2008-12-13 10:18:32 -05:00
|
|
|
if (big_window) {
|
2009-11-16 19:39:55 -05:00
|
|
|
big_window->reset (npans);
|
2008-12-13 10:18:32 -05:00
|
|
|
}
|
2007-03-18 02:07:08 -04:00
|
|
|
panner->set_size_request (-1, 61);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
/* and finally, add it to the panner frame */
|
|
|
|
|
|
|
|
panning_viewport.remove ();
|
|
|
|
panning_viewport.add (*panner);
|
|
|
|
panning_viewport.show_all ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-05-23 15:54:52 -04:00
|
|
|
bool
|
2005-09-25 14:42:24 -04:00
|
|
|
PannerUI::pan_button_event (GdkEventButton* ev, uint32_t which)
|
|
|
|
{
|
|
|
|
switch (ev->button) {
|
2008-12-13 10:18:32 -05:00
|
|
|
case 1:
|
|
|
|
if (panner && ev->type == GDK_2BUTTON_PRESS) {
|
|
|
|
if (!big_window) {
|
2009-06-09 16:21:19 -04:00
|
|
|
big_window = new Panner2dWindow (_panner, 400, _panner->npanners());
|
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) {
|
|
|
|
pan_menu = manage (new Menu);
|
|
|
|
pan_menu->set_name ("ArdourContextMenu");
|
|
|
|
}
|
|
|
|
build_pan_menu (which);
|
|
|
|
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
|
|
|
|
PannerUI::build_pan_menu (uint32_t which)
|
|
|
|
{
|
|
|
|
using namespace Menu_Helpers;
|
|
|
|
MenuList& items (pan_menu->items());
|
|
|
|
|
|
|
|
items.clear ();
|
|
|
|
|
|
|
|
items.push_back (CheckMenuElem (_("Mute")));
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
/* set state first, connect second */
|
|
|
|
|
2009-06-09 16:21:19 -04:00
|
|
|
(dynamic_cast<CheckMenuItem*> (&items.back()))->set_active (_panner->streampanner(which).muted());
|
2005-10-09 01:03:29 -04:00
|
|
|
(dynamic_cast<CheckMenuItem*> (&items.back()))->signal_toggled().connect
|
2009-12-11 18:29:48 -05:00
|
|
|
(sigc::bind (sigc::mem_fun(*this, &PannerUI::pan_mute), which));
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-12-11 18:29:48 -05:00
|
|
|
items.push_back (CheckMenuElem (_("Bypass"), sigc::mem_fun(*this, &PannerUI::pan_bypass_toggle)));
|
2005-10-09 01:03:29 -04:00
|
|
|
bypass_menu_item = static_cast<CheckMenuItem*> (&items.back());
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
/* set state first, connect second */
|
|
|
|
|
2009-06-09 16:21:19 -04:00
|
|
|
bypass_menu_item->set_active (_panner->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
|
|
|
|
2009-12-11 18:29:48 -05:00
|
|
|
items.push_back (MenuElem (_("Reset"), sigc::bind (sigc::mem_fun (*this, &PannerUI::pan_reset), which)));
|
2005-09-25 14:42:24 -04:00
|
|
|
items.push_back (SeparatorElem());
|
2009-12-11 18:29:48 -05:00
|
|
|
items.push_back (MenuElem (_("Reset all"), sigc::mem_fun (*this, &PannerUI::pan_reset_all)));
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
PannerUI::pan_mute (uint32_t which)
|
|
|
|
{
|
2009-06-09 16:21:19 -04:00
|
|
|
StreamPanner& sp = _panner->streampanner(which);
|
2008-10-02 23:16:19 -04:00
|
|
|
sp.set_muted (!sp.muted());
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
PannerUI::pan_bypass_toggle ()
|
|
|
|
{
|
2009-06-09 16:21:19 -04:00
|
|
|
if (bypass_menu_item && (_panner->bypassed() != bypass_menu_item->get_active())) {
|
|
|
|
_panner->set_bypassed (!_panner->bypassed());
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2009-04-30 11:04:16 -04:00
|
|
|
PannerUI::pan_reset (uint32_t which)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2009-06-09 16:21:19 -04:00
|
|
|
_panner->reset_streampanner (which);
|
2009-04-30 11:04:16 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
PannerUI::pan_reset_all ()
|
|
|
|
{
|
2009-06-09 16:21:19 -04:00
|
|
|
_panner->reset_to_default ();
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
PannerUI::effective_pan_display ()
|
|
|
|
{
|
2009-06-09 16:21:19 -04:00
|
|
|
if (_panner->empty()) {
|
2005-09-25 14:42:24 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-06-09 16:21:19 -04:00
|
|
|
switch (_panner->nouts()) {
|
2009-10-14 12:10:01 -04:00
|
|
|
case 0:
|
2005-09-25 14:42:24 -04:00
|
|
|
case 1:
|
|
|
|
/* relax */
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
update_pan_bars (true);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2006-08-11 03:15:30 -04:00
|
|
|
//panner->move_puck (pan_value (v, right), 0.5);
|
2005-09-25 14:42:24 -04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
PannerUI::pan_changed (void *src)
|
|
|
|
{
|
|
|
|
if (src == this) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-06-09 16:21:19 -04:00
|
|
|
switch (_panner->npanners()) {
|
2005-09-25 14:42:24 -04:00
|
|
|
case 0:
|
2006-06-13 03:27:52 -04:00
|
|
|
panning_link_direction_button.set_sensitive (false);
|
|
|
|
panning_link_button.set_sensitive (false);
|
2005-09-25 14:42:24 -04:00
|
|
|
return;
|
|
|
|
case 1:
|
2006-06-13 03:27:52 -04:00
|
|
|
panning_link_direction_button.set_sensitive (false);
|
|
|
|
panning_link_button.set_sensitive (false);
|
2005-09-25 14:42:24 -04:00
|
|
|
break;
|
|
|
|
default:
|
2006-06-13 03:27:52 -04:00
|
|
|
panning_link_direction_button.set_sensitive (true);
|
|
|
|
panning_link_button.set_sensitive (true);
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2009-06-09 16:21:19 -04:00
|
|
|
uint32_t nouts = _panner->nouts();
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
switch (nouts) {
|
|
|
|
case 0:
|
|
|
|
case 1:
|
|
|
|
/* relax */
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
2008-12-12 09:43:24 -05:00
|
|
|
/* bring pan bar state up to date */
|
2005-09-25 14:42:24 -04:00
|
|
|
update_pan_bars (false);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
// panner->move_puck (pan_value (pans[0], pans[1]), 0.5);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
PannerUI::pan_adjustment_changed (uint32_t which)
|
|
|
|
{
|
2009-06-09 16:21:19 -04:00
|
|
|
if (!in_pan_update && which < _panner->npanners()) {
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
float val = pan_adjustments[which]->get_value ();
|
2010-02-06 21:48:43 -05:00
|
|
|
float const xpos = _panner->pan_control(which)->get_value();
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
/* add a kinda-sorta detent for the middle */
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
if (val != 0.5 && Panner::equivalent (val, 0.5)) {
|
2009-10-14 12:10:01 -04:00
|
|
|
/* this is going to be reentrant, so just
|
2005-09-25 14:42:24 -04:00
|
|
|
return after it.
|
|
|
|
*/
|
|
|
|
|
|
|
|
in_pan_update = true;
|
|
|
|
pan_adjustments[which]->set_value (0.5);
|
|
|
|
in_pan_update = false;
|
|
|
|
return;
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
if (!Panner::equivalent (val, xpos)) {
|
|
|
|
|
2010-02-06 21:48:43 -05:00
|
|
|
_panner->pan_control(which)->set_value (val);
|
2009-10-14 12:10:01 -04:00
|
|
|
/* XXX
|
2005-09-25 14:42:24 -04:00
|
|
|
the panner objects have no access to the session,
|
|
|
|
so do this here. ick.
|
|
|
|
*/
|
2009-12-17 13:24:23 -05:00
|
|
|
_session->set_dirty();
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
PannerUI::pan_value_changed (uint32_t which)
|
|
|
|
{
|
2009-12-11 18:29:48 -05:00
|
|
|
ENSURE_GUI_THREAD (*this, &PannerUI::pan_value_changed, which)
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-06-09 16:21:19 -04:00
|
|
|
if (_panner->npanners() > 1 && which < _panner->npanners()) {
|
2005-09-25 14:42:24 -04:00
|
|
|
float xpos;
|
|
|
|
float val = pan_adjustments[which]->get_value ();
|
|
|
|
|
2009-06-09 16:21:19 -04:00
|
|
|
_panner->streampanner(which).get_position (xpos);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
if (!Panner::equivalent (val, xpos)) {
|
|
|
|
in_pan_update = true;
|
|
|
|
pan_adjustments[which]->set_value (xpos);
|
|
|
|
in_pan_update = false;
|
|
|
|
}
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
void
|
|
|
|
PannerUI::update_pan_bars (bool only_if_aplay)
|
|
|
|
{
|
|
|
|
uint32_t n;
|
|
|
|
vector<Adjustment*>::iterator i;
|
|
|
|
|
|
|
|
in_pan_update = true;
|
|
|
|
|
|
|
|
/* this runs during automation playback, and moves the bar controllers
|
|
|
|
and/or pucks around.
|
|
|
|
*/
|
|
|
|
|
|
|
|
for (i = pan_adjustments.begin(), n = 0; i != pan_adjustments.end(); ++i, ++n) {
|
|
|
|
float xpos, val;
|
|
|
|
|
|
|
|
if (only_if_aplay) {
|
2009-06-09 16:21:19 -04:00
|
|
|
boost::shared_ptr<AutomationList> alist (_panner->streampanner(n).pan_control()->alist());
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2007-06-29 00:02:58 -04:00
|
|
|
if (!alist->automation_playback()) {
|
2005-09-25 14:42:24 -04:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-06-09 16:21:19 -04:00
|
|
|
_panner->streampanner(n).get_effective_position (xpos);
|
2005-09-25 14:42:24 -04:00
|
|
|
val = (*i)->get_value ();
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
if (!Panner::equivalent (val, xpos)) {
|
|
|
|
(*i)->set_value (xpos);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
in_pan_update = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2009-10-14 12:10:01 -04:00
|
|
|
PannerUI::update_pan_sensitive ()
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2009-10-19 10:46:15 -04:00
|
|
|
bool const sensitive = !(_panner->mono()) && !(_panner->automation_state() & Play);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-06-09 16:21:19 -04:00
|
|
|
switch (_panner->nouts()) {
|
2005-09-25 14:42:24 -04:00
|
|
|
case 0:
|
|
|
|
case 1:
|
|
|
|
break;
|
|
|
|
case 2:
|
2007-01-09 18:24:54 -05:00
|
|
|
for (vector<PannerBar*>::iterator i = pan_bars.begin(); i != pan_bars.end(); ++i) {
|
2005-09-25 14:42:24 -04:00
|
|
|
(*i)->set_sensitive (sensitive);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
if (panner) {
|
|
|
|
panner->set_sensitive (sensitive);
|
2008-12-13 10:18:32 -05:00
|
|
|
}
|
|
|
|
if (big_window) {
|
|
|
|
big_window->set_sensitive (sensitive);
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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 ();
|
|
|
|
}
|
|
|
|
pan_astate_menu->popup (1, ev->time);
|
2006-05-19 13:29:05 -04:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
gint
|
|
|
|
PannerUI::pan_automation_style_button_event (GdkEventButton *ev)
|
|
|
|
{
|
|
|
|
if (ev->type == GDK_BUTTON_RELEASE) {
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (ev->button) {
|
|
|
|
case 1:
|
2008-12-08 11:07:28 -05:00
|
|
|
if (pan_astyle_menu == 0) {
|
|
|
|
build_astyle_menu ();
|
|
|
|
}
|
|
|
|
pan_astyle_menu->popup (1, ev->time);
|
2006-05-19 13:29:05 -04:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
PannerUI::pan_automation_style_changed ()
|
|
|
|
{
|
2009-12-11 18:29:48 -05:00
|
|
|
ENSURE_GUI_THREAD (*this, &PannerUI::pan_automation_style_changed)
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2006-05-19 13:29:05 -04:00
|
|
|
switch (_width) {
|
|
|
|
case Wide:
|
2009-06-09 16:21:19 -04:00
|
|
|
pan_automation_style_button.set_label (astyle_string(_panner->automation_style()));
|
2006-05-19 13:29:05 -04:00
|
|
|
break;
|
|
|
|
case Narrow:
|
2009-06-09 16:21:19 -04:00
|
|
|
pan_automation_style_button.set_label (short_astyle_string(_panner->automation_style()));
|
2006-05-19 13:29:05 -04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
PannerUI::pan_automation_state_changed ()
|
|
|
|
{
|
2009-12-11 18:29:48 -05:00
|
|
|
ENSURE_GUI_THREAD (*this, &PannerUI::pan_automation_state_changed)
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2006-05-19 13:29:05 -04:00
|
|
|
bool x;
|
|
|
|
|
|
|
|
switch (_width) {
|
|
|
|
case Wide:
|
2009-06-09 16:21:19 -04:00
|
|
|
pan_automation_state_button.set_label (astate_string(_panner->automation_state()));
|
2006-05-19 13:29:05 -04:00
|
|
|
break;
|
|
|
|
case Narrow:
|
2009-06-09 16:21:19 -04:00
|
|
|
pan_automation_state_button.set_label (short_astate_string(_panner->automation_state()));
|
2006-05-19 13:29:05 -04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* when creating a new session, we get to create busses (and
|
|
|
|
sometimes tracks) with no outputs by the time they get
|
|
|
|
here.
|
|
|
|
*/
|
|
|
|
|
2009-06-09 16:21:19 -04:00
|
|
|
if (_panner->empty()) {
|
2006-05-19 13:29:05 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-06-09 16:21:19 -04:00
|
|
|
x = (_panner->streampanner(0).pan_control()->alist()->automation_state() != Off);
|
2006-05-19 13:29:05 -04:00
|
|
|
|
|
|
|
if (pan_automation_state_button.get_active() != x) {
|
|
|
|
ignore_toggle = true;
|
|
|
|
pan_automation_state_button.set_active (x);
|
|
|
|
ignore_toggle = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
update_pan_sensitive ();
|
|
|
|
|
|
|
|
/* start watching automation so that things move */
|
|
|
|
|
|
|
|
pan_watching.disconnect();
|
|
|
|
|
|
|
|
if (x) {
|
2009-12-11 18:29:48 -05:00
|
|
|
pan_watching = ARDOUR_UI::RapidScreenUpdate.connect (sigc::mem_fun (*this, &PannerUI::effective_pan_display));
|
2006-05-19 13:29:05 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
string
|
|
|
|
PannerUI::astate_string (AutoState state)
|
|
|
|
{
|
|
|
|
return _astate_string (state, false);
|
|
|
|
}
|
|
|
|
|
|
|
|
string
|
|
|
|
PannerUI::short_astate_string (AutoState state)
|
|
|
|
{
|
|
|
|
return _astate_string (state, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
string
|
|
|
|
PannerUI::_astate_string (AutoState state, bool shrt)
|
|
|
|
{
|
|
|
|
string sstr;
|
|
|
|
|
|
|
|
switch (state) {
|
|
|
|
case Off:
|
2007-03-18 02:07:08 -04:00
|
|
|
sstr = (shrt ? "M" : _("M"));
|
2006-05-19 13:29:05 -04:00
|
|
|
break;
|
|
|
|
case Play:
|
|
|
|
sstr = (shrt ? "P" : _("P"));
|
|
|
|
break;
|
|
|
|
case Touch:
|
|
|
|
sstr = (shrt ? "T" : _("T"));
|
|
|
|
break;
|
|
|
|
case Write:
|
|
|
|
sstr = (shrt ? "W" : _("W"));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return sstr;
|
|
|
|
}
|
|
|
|
|
|
|
|
string
|
|
|
|
PannerUI::astyle_string (AutoStyle style)
|
|
|
|
{
|
|
|
|
return _astyle_string (style, false);
|
|
|
|
}
|
|
|
|
|
|
|
|
string
|
|
|
|
PannerUI::short_astyle_string (AutoStyle style)
|
|
|
|
{
|
|
|
|
return _astyle_string (style, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
string
|
|
|
|
PannerUI::_astyle_string (AutoStyle style, bool shrt)
|
|
|
|
{
|
|
|
|
if (style & Trim) {
|
|
|
|
return _("Trim");
|
|
|
|
} else {
|
|
|
|
/* XXX it might different in different languages */
|
|
|
|
|
|
|
|
return (shrt ? _("Abs") : _("Abs"));
|
|
|
|
}
|
|
|
|
}
|
2009-10-19 10:46:15 -04:00
|
|
|
|
|
|
|
void
|
|
|
|
PannerUI::set_mono (bool yn)
|
|
|
|
{
|
|
|
|
_panner->set_mono (yn);
|
|
|
|
update_pan_sensitive ();
|
|
|
|
}
|
|
|
|
|
|
|
|
|