Can't call the wrong function when there's only one of them: remove ARDOUR::Parameter and just use Evoral::Parameter (move Ardour specific functionality to EventTypeMap where it belongs).

Less than pretty in places but easily seddable just in case...


git-svn-id: svn://localhost/ardour2/branches/3.0@3838 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
David Robillard 2008-09-29 22:47:40 +00:00
parent 03f188cc8b
commit b5ec66ae6c
56 changed files with 416 additions and 499 deletions

View file

@ -74,12 +74,12 @@ AddMidiCCTrackDialog::AddMidiCCTrackDialog ()
}
ARDOUR::Parameter
Evoral::Parameter
AddMidiCCTrackDialog::parameter ()
{
int chan = _chan_spinner.get_value_as_int() - 1;
int cc_num = _cc_num_spinner.get_value_as_int() - 1;
return Parameter(MidiCCAutomation, chan, cc_num);
return Evoral::Parameter(MidiCCAutomation, chan, cc_num);
}

View file

@ -27,14 +27,14 @@
#include <gtkmm/spinbutton.h>
#include <ardour/types.h>
#include <ardour/data_type.h>
#include <ardour/parameter.h>
#include <evoral/Parameter.hpp>
class AddMidiCCTrackDialog : public Gtk::Dialog
{
public:
AddMidiCCTrackDialog ();
ARDOUR::Parameter parameter ();
Evoral::Parameter parameter ();
private:
Gtk::Adjustment _chan_adjustment;

View file

@ -319,7 +319,7 @@ AudioTimeAxisView::set_waveform_scale (WaveformScale scale)
}
void
AudioTimeAxisView::create_automation_child (const Parameter& param, bool show)
AudioTimeAxisView::create_automation_child (const Evoral::Parameter& param, bool show)
{
if (param.type() == GainAutomation) {
@ -337,7 +337,7 @@ AudioTimeAxisView::create_automation_child (const Parameter& param, bool show)
parent_canvas,
_route->describe_parameter(param)));
add_automation_child(Parameter(GainAutomation), gain_track, show);
add_automation_child(Evoral::Parameter(GainAutomation), gain_track, show);
} else if (param.type() == PanAutomation) {
@ -345,7 +345,7 @@ AudioTimeAxisView::create_automation_child (const Parameter& param, bool show)
update_pans (show);
} else {
error << "AudioTimeAxisView: unknown automation child " << param.symbol() << endmsg;
error << "AudioTimeAxisView: unknown automation child " << EventTypeMap::instance().to_symbol(param) << endmsg;
}
}
@ -370,7 +370,7 @@ AudioTimeAxisView::update_pans (bool show)
false,
parent_canvas,
_route->describe_parameter(pan_control->parameter())));
add_automation_child(Parameter(PanAutomation, i), pan_track, show);
add_automation_child(Evoral::Parameter(PanAutomation, i), pan_track, show);
++i;
}
}

View file

@ -82,7 +82,7 @@ class AudioTimeAxisView : public RouteTimeAxisView
guint32 show_at (double y, int& nth, Gtk::VBox *parent);
void hide ();
void create_automation_child (const ARDOUR::Parameter& param, bool show);
void create_automation_child (const Evoral::Parameter& param, bool show);
void first_idle ();

View file

@ -68,7 +68,7 @@ AutomationController::create(
{
Gtk::Adjustment* adjustment = manage(new Gtk::Adjustment(param.normal(), param.min(), param.max()));
if (!ac) {
PBD::warning << "Creating AutomationController for " << param.symbol() << endmsg;
PBD::warning << "Creating AutomationController for " << EventTypeMap::instance().to_symbol(param) << endmsg;
ac = boost::dynamic_pointer_cast<AutomationControl>(parent->control_factory(param));
} else {
assert(ac->parameter() == param);

View file

@ -26,7 +26,7 @@
AutomationRegionView::AutomationRegionView(ArdourCanvas::Group* parent,
AutomationTimeAxisView& time_axis,
boost::shared_ptr<ARDOUR::Region> region,
const ARDOUR::Parameter& param,
const Evoral::Parameter& param,
boost::shared_ptr<ARDOUR::AutomationList> list,
double spu,
Gdk::Color& basic_color)
@ -65,7 +65,8 @@ void
AutomationRegionView::create_line (boost::shared_ptr<ARDOUR::AutomationList> list)
{
_line = boost::shared_ptr<AutomationLine>(new AutomationLine(
list->parameter().symbol(), trackview, *get_canvas_group(), list));
ARDOUR::EventTypeMap::instance().to_symbol(list->parameter()),
trackview, *get_canvas_group(), list));
_line->set_colors();
_line->show();
_line->show_all_control_points();

View file

@ -42,7 +42,7 @@ public:
AutomationRegionView(ArdourCanvas::Group*,
AutomationTimeAxisView&,
boost::shared_ptr<ARDOUR::Region>,
const ARDOUR::Parameter& parameter,
const Evoral::Parameter& parameter,
boost::shared_ptr<ARDOUR::AutomationList>,
double initial_samples_per_unit,
Gdk::Color& basic_color);
@ -73,7 +73,7 @@ protected:
void exited();
private:
ARDOUR::Parameter _parameter;
Evoral::Parameter _parameter;
boost::shared_ptr<AutomationLine> _line;
};

View file

@ -212,7 +212,7 @@ AutomationTimeAxisView::AutomationTimeAxisView (Session& s, boost::shared_ptr<Ro
} else {
boost::shared_ptr<AutomationLine> line(new AutomationLine (
_control->parameter().symbol(),
ARDOUR::EventTypeMap::instance().to_symbol(_control->parameter()),
*this,
*canvas_display,
_control->alist()));
@ -884,7 +884,7 @@ AutomationTimeAxisView::set_state (const XMLNode& node)
if ((*iter)->name() == state_node_name) {
XMLProperty* type = (*iter)->property("automation-id");
if (type && type->value() == _control->parameter().symbol()) {
if (type && type->value() == ARDOUR::EventTypeMap::instance().to_symbol(_control->parameter())) {
XMLProperty *shown = (*iter)->property("shown_editor");
if (shown && shown->value() == "yes") {

View file

@ -65,9 +65,9 @@ CrossfadeEditor::Presets* CrossfadeEditor::fade_out_presets = 0;
CrossfadeEditor::Half::Half ()
: line (0),
//normative_curve (Parameter(GainAutomation, 0.0, 1.0, 1.0)), // FIXME: GainAutomation?
normative_curve (Parameter(GainAutomation)),
gain_curve (Parameter(GainAutomation))
//normative_curve (Evoral::Parameter(GainAutomation, 0.0, 1.0, 1.0)), // FIXME: GainAutomation?
normative_curve (Evoral::Parameter(GainAutomation)),
gain_curve (Evoral::Parameter(GainAutomation))
{
}

View file

@ -34,8 +34,8 @@ curvetest (string filename)
{
ifstream in (filename.c_str());
stringstream line;
//Parameter param(GainAutomation, -1.0, +1.0, 0.0);
Parameter param(GainAutomation);
//Evoral::Parameter param(GainAutomation, -1.0, +1.0, 0.0);
Evoral::Parameter param(GainAutomation);
AutomationList al (param);
double minx = DBL_MAX;
double maxx = DBL_MIN;

View file

@ -148,16 +148,16 @@ GainMeterBase::GainMeterBase (boost::shared_ptr<IO> io, Session& s,
gain_astate_menu.items().push_back (MenuElem (_("Manual"),
bind (mem_fun (*_io, &IO::set_parameter_automation_state),
Parameter(GainAutomation), (AutoState) Off)));
Evoral::Parameter(GainAutomation), (AutoState) Off)));
gain_astate_menu.items().push_back (MenuElem (_("Play"),
bind (mem_fun (*_io, &IO::set_parameter_automation_state),
Parameter(GainAutomation), (AutoState) Play)));
Evoral::Parameter(GainAutomation), (AutoState) Play)));
gain_astate_menu.items().push_back (MenuElem (_("Write"),
bind (mem_fun (*_io, &IO::set_parameter_automation_state),
Parameter(GainAutomation), (AutoState) Write)));
Evoral::Parameter(GainAutomation), (AutoState) Write)));
gain_astate_menu.items().push_back (MenuElem (_("Touch"),
bind (mem_fun (*_io, &IO::set_parameter_automation_state),
Parameter(GainAutomation), (AutoState) Touch)));
Evoral::Parameter(GainAutomation), (AutoState) Touch)));
gain_astyle_menu.items().push_back (MenuElem (_("Trim")));
gain_astyle_menu.items().push_back (MenuElem (_("Abs")));

View file

@ -185,7 +185,7 @@ GenericPluginUI::build ()
/* Don't show latency control ports */
if (plugin->describe_parameter (Parameter(PluginAutomation, i)) == X_("latency")) {
if (plugin->describe_parameter (Evoral::Parameter(PluginAutomation, i)) == X_("latency")) {
continue;
}
@ -211,7 +211,7 @@ GenericPluginUI::build ()
boost::shared_ptr<ARDOUR::AutomationControl> c
= boost::dynamic_pointer_cast<ARDOUR::AutomationControl>(
insert->data().control(Parameter(PluginAutomation, i)));
insert->data().control(Evoral::Parameter(PluginAutomation, i)));
if ((cui = build_control_ui (i, c)) == 0) {
error << string_compose(_("Plugin Editor: could not build control element for port %1"), i) << endmsg;

View file

@ -263,10 +263,10 @@ MidiTimeAxisView::build_automation_action_menu ()
mem_fun(*this, &MidiTimeAxisView::add_cc_track)));
automation_items.push_back (MenuElem (_("Bender"),
sigc::bind(mem_fun(*this, &MidiTimeAxisView::add_parameter_track),
Parameter(MidiPitchBenderAutomation))));
Evoral::Parameter(MidiPitchBenderAutomation))));
automation_items.push_back (MenuElem (_("Pressure"),
sigc::bind(mem_fun(*this, &MidiTimeAxisView::add_parameter_track),
Parameter(MidiChannelPressureAutomation))));
Evoral::Parameter(MidiChannelPressureAutomation))));
}
@ -328,10 +328,10 @@ void
MidiTimeAxisView::show_all_automation ()
{
if (midi_track()) {
const set<Parameter> params = midi_track()->midi_diskstream()->
const set<Evoral::Parameter> params = midi_track()->midi_diskstream()->
midi_playlist()->contained_automation();
for (set<Parameter>::const_iterator i = params.begin(); i != params.end(); ++i) {
for (set<Evoral::Parameter>::const_iterator i = params.begin(); i != params.end(); ++i) {
create_automation_child(*i, true);
}
}
@ -343,10 +343,10 @@ void
MidiTimeAxisView::show_existing_automation ()
{
if (midi_track()) {
const set<Parameter> params = midi_track()->midi_diskstream()->
const set<Evoral::Parameter> params = midi_track()->midi_diskstream()->
midi_playlist()->contained_automation();
for (set<Parameter>::const_iterator i = params.begin(); i != params.end(); ++i) {
for (set<Evoral::Parameter>::const_iterator i = params.begin(); i != params.end(); ++i) {
create_automation_child(*i, true);
}
}
@ -360,7 +360,7 @@ void
MidiTimeAxisView::add_cc_track()
{
int response;
Parameter param;
Evoral::Parameter param(0, 0, 0);
{
AddMidiCCTrackDialog dialog;
@ -371,7 +371,7 @@ MidiTimeAxisView::add_cc_track()
param = dialog.parameter();
}
if (response == Gtk::RESPONSE_ACCEPT)
if (param.type() != 0 && response == Gtk::RESPONSE_ACCEPT)
create_automation_child(param, true);
}
@ -379,13 +379,13 @@ MidiTimeAxisView::add_cc_track()
/** Add an automation track for the given parameter (pitch bend, channel pressure).
*/
void
MidiTimeAxisView::add_parameter_track(const Parameter& param)
MidiTimeAxisView::add_parameter_track(const Evoral::Parameter& param)
{
create_automation_child(param, true);
}
void
MidiTimeAxisView::create_automation_child (const Parameter& param, bool show)
MidiTimeAxisView::create_automation_child (const Evoral::Parameter& param, bool show)
{
if ( param.type() == MidiCCAutomation ||
param.type() == MidiPgmChangeAutomation ||
@ -419,7 +419,8 @@ MidiTimeAxisView::create_automation_child (const Parameter& param, bool show)
add_automation_child(param, track, show);
} else {
error << "MidiTimeAxisView: unknown automation child " << param.symbol() << endmsg;
error << "MidiTimeAxisView: unknown automation child "
<< ARDOUR::EventTypeMap::instance().to_symbol(param) << endmsg;
}
}

View file

@ -70,8 +70,8 @@ class MidiTimeAxisView : public RouteTimeAxisView
void show_all_automation ();
void show_existing_automation ();
void add_cc_track ();
void add_parameter_track (const ARDOUR::Parameter& param);
void create_automation_child (const ARDOUR::Parameter& param, bool show);
void add_parameter_track (const Evoral::Parameter& param);
void create_automation_child (const Evoral::Parameter& param, bool show);
ARDOUR::NoteMode note_mode() const { return _note_mode; }

View file

@ -152,7 +152,7 @@ class GenericPluginUI : public PlugUIBase, public Gtk::VBox
boost::shared_ptr<ARDOUR::AutomationControl> control;
ARDOUR::Parameter parameter() { return control->parameter(); }
Evoral::Parameter parameter() { return control->parameter(); }
/* input */

View file

@ -144,7 +144,7 @@ class RegionView : public TimeAxisViewItem
vector<GhostRegion*> ghosts;
typedef std::map<const ARDOUR::Parameter, boost::shared_ptr<AutomationRegionView> > AutomationChildren;
typedef std::map<const Evoral::Parameter, boost::shared_ptr<AutomationRegionView> > AutomationChildren;
AutomationChildren _automation_children;
};

View file

@ -51,7 +51,7 @@
#include <ardour/session.h>
#include <ardour/session_playlist.h>
#include <ardour/utils.h>
#include <ardour/parameter.h>
#include <evoral/Parameter.hpp>
#include <ardour/profile.h>
#include "ardour_ui.h"
@ -427,7 +427,7 @@ RouteTimeAxisView::set_state (const XMLNode& node)
for (iter = kids.begin(); iter != kids.end(); ++iter) {
if ((*iter)->name() == AutomationTimeAxisView::state_node_name) {
if ((prop = (*iter)->property ("automation-id")) != 0) {
Parameter param(prop->value());
Evoral::Parameter param = ARDOUR::EventTypeMap::instance().new_parameter(prop->value());
bool show = ((prop = (*iter)->property ("shown")) != 0) && prop->value() == "yes";
create_automation_child(param, show);
} else {
@ -461,7 +461,7 @@ RouteTimeAxisView::build_automation_action_menu ()
automation_items.push_back (MenuElem (_("Plugins"), subplugin_menu));
map<ARDOUR::Parameter, RouteAutomationNode*>::iterator i;
map<Evoral::Parameter, RouteAutomationNode*>::iterator i;
for (i = _automation_tracks.begin(); i != _automation_tracks.end(); ++i) {
automation_items.push_back (SeparatorElem());
@ -1187,7 +1187,7 @@ RouteTimeAxisView::get_inverted_selectables (Selection& sel, list<Selectable*>&
}
bool
RouteTimeAxisView::show_automation(Parameter param)
RouteTimeAxisView::show_automation(Evoral::Parameter param)
{
return (_show_automation.find(param) != _show_automation.end());
}
@ -1195,9 +1195,9 @@ RouteTimeAxisView::show_automation(Parameter param)
/** Retuns NULL if track for \a param doesn't exist.
*/
RouteTimeAxisView::RouteAutomationNode*
RouteTimeAxisView::automation_track(Parameter param)
RouteTimeAxisView::automation_track(Evoral::Parameter param)
{
map<ARDOUR::Parameter, RouteAutomationNode*>::iterator i = _automation_tracks.find(param);
map<Evoral::Parameter, RouteAutomationNode*>::iterator i = _automation_tracks.find(param);
if (i != _automation_tracks.end())
return i->second;
@ -1210,7 +1210,7 @@ RouteTimeAxisView::automation_track(Parameter param)
RouteTimeAxisView::RouteAutomationNode*
RouteTimeAxisView::automation_track(AutomationType type)
{
return automation_track(Parameter(type));
return automation_track(Evoral::Parameter(type));
}
RouteGroup*
@ -1515,7 +1515,7 @@ RouteTimeAxisView::color_handler ()
}
void
RouteTimeAxisView::toggle_automation_track (Parameter param)
RouteTimeAxisView::toggle_automation_track (Evoral::Parameter param)
{
RouteAutomationNode* node = automation_track(param);
@ -1544,7 +1544,7 @@ RouteTimeAxisView::toggle_automation_track (Parameter param)
}
void
RouteTimeAxisView::automation_track_hidden (Parameter param)
RouteTimeAxisView::automation_track_hidden (Evoral::Parameter param)
{
RouteAutomationNode* ran = automation_track(param);
if (!ran) {
@ -1569,7 +1569,7 @@ RouteTimeAxisView::show_all_automation ()
/* Show our automation */
map<ARDOUR::Parameter, RouteAutomationNode*>::iterator i;
map<Evoral::Parameter, RouteAutomationNode*>::iterator i;
for (i = _automation_tracks.begin(); i != _automation_tracks.end(); ++i) {
i->second->track->set_marked_for_display (true);
i->second->track->canvas_display->show();
@ -1604,7 +1604,7 @@ RouteTimeAxisView::show_existing_automation ()
/* Show our automation */
map<ARDOUR::Parameter, RouteAutomationNode*>::iterator i;
map<Evoral::Parameter, RouteAutomationNode*>::iterator i;
for (i = _automation_tracks.begin(); i != _automation_tracks.end(); ++i) {
if (i->second->track->line() && i->second->track->line()->npoints() > 0) {
i->second->track->set_marked_for_display (true);
@ -1637,7 +1637,7 @@ RouteTimeAxisView::hide_all_automation ()
/* Hide our automation */
for (map<ARDOUR::Parameter, RouteAutomationNode*>::iterator i = _automation_tracks.begin(); i != _automation_tracks.end(); ++i) {
for (map<Evoral::Parameter, RouteAutomationNode*>::iterator i = _automation_tracks.begin(); i != _automation_tracks.end(); ++i) {
i->second->track->set_marked_for_display (false);
i->second->track->hide ();
i->second->track->get_state_node()->add_property ("shown", X_("no"));
@ -1700,7 +1700,7 @@ RouteTimeAxisView::remove_processor_automation_node (ProcessorAutomationNode* pa
}
RouteTimeAxisView::ProcessorAutomationNode*
RouteTimeAxisView::find_processor_automation_node (boost::shared_ptr<Processor> processor, Parameter what)
RouteTimeAxisView::find_processor_automation_node (boost::shared_ptr<Processor> processor, Evoral::Parameter what)
{
for (list<ProcessorAutomationInfo*>::iterator i = processor_automation.begin(); i != processor_automation.end(); ++i) {
@ -1737,7 +1737,7 @@ legalize_for_xml_node (string str)
void
RouteTimeAxisView::add_processor_automation_curve (boost::shared_ptr<Processor> processor, Parameter what)
RouteTimeAxisView::add_processor_automation_curve (boost::shared_ptr<Processor> processor, Evoral::Parameter what)
{
string name;
ProcessorAutomationNode* pan;
@ -1803,12 +1803,12 @@ RouteTimeAxisView::processor_automation_track_hidden (RouteTimeAxisView::Process
void
RouteTimeAxisView::add_existing_processor_automation_curves (boost::shared_ptr<Processor> processor)
{
set<Parameter> s;
set<Evoral::Parameter> s;
boost::shared_ptr<AutomationLine> al;
processor->what_has_visible_data (s);
for (set<Parameter>::iterator i = s.begin(); i != s.end(); ++i) {
for (set<Evoral::Parameter>::iterator i = s.begin(); i != s.end(); ++i) {
if ((al = find_processor_automation_curve (processor, *i)) != 0) {
al->queue_reset ();
@ -1819,7 +1819,7 @@ RouteTimeAxisView::add_existing_processor_automation_curves (boost::shared_ptr<P
}
void
RouteTimeAxisView::add_automation_child(Parameter param, boost::shared_ptr<AutomationTimeAxisView> track, bool show)
RouteTimeAxisView::add_automation_child(Evoral::Parameter param, boost::shared_ptr<AutomationTimeAxisView> track, bool show)
{
using namespace Menu_Helpers;
@ -1864,8 +1864,8 @@ RouteTimeAxisView::add_processor_to_subplugin_menu (boost::shared_ptr<Processor>
ProcessorAutomationInfo *rai;
list<ProcessorAutomationInfo*>::iterator x;
const std::set<Parameter>& automatable = processor->what_can_be_automated ();
std::set<Parameter> has_visible_automation;
const std::set<Evoral::Parameter>& automatable = processor->what_can_be_automated ();
std::set<Evoral::Parameter> has_visible_automation;
processor->what_has_visible_data(has_visible_automation);
@ -1900,7 +1900,7 @@ RouteTimeAxisView::add_processor_to_subplugin_menu (boost::shared_ptr<Processor>
items.clear ();
for (std::set<Parameter>::const_iterator i = automatable.begin(); i != automatable.end(); ++i) {
for (std::set<Evoral::Parameter>::const_iterator i = automatable.begin(); i != automatable.end(); ++i) {
ProcessorAutomationNode* pan;
CheckMenuItem* mitem;
@ -2014,7 +2014,7 @@ RouteTimeAxisView::processors_changed ()
}
boost::shared_ptr<AutomationLine>
RouteTimeAxisView::find_processor_automation_curve (boost::shared_ptr<Processor> processor, Parameter what)
RouteTimeAxisView::find_processor_automation_curve (boost::shared_ptr<Processor> processor, Evoral::Parameter what)
{
ProcessorAutomationNode* pan;
@ -2050,7 +2050,7 @@ RouteTimeAxisView::set_layer_display (LayerDisplay d)
boost::shared_ptr<AutomationTimeAxisView>
RouteTimeAxisView::automation_child(ARDOUR::Parameter param)
RouteTimeAxisView::automation_child(Evoral::Parameter param)
{
AutomationTracks::iterator i = _automation_tracks.find(param);
if (i != _automation_tracks.end())

View file

@ -82,7 +82,7 @@ public:
void set_selected_regionviews (RegionSelection&);
void get_selectables (nframes_t start, nframes_t end, double top, double bot, list<Selectable *>&);
void get_inverted_selectables (Selection&, list<Selectable*>&);
bool show_automation(ARDOUR::Parameter param);
bool show_automation(Evoral::Parameter param);
void set_layer_display (LayerDisplay d);
boost::shared_ptr<ARDOUR::Region> find_next_region (nframes_t pos, ARDOUR::RegionPoint, int32_t dir);
@ -109,24 +109,24 @@ public:
/* This is a bit nasty to expose :/ */
struct RouteAutomationNode {
ARDOUR::Parameter param;
Evoral::Parameter param;
Gtk::CheckMenuItem* menu_item;
boost::shared_ptr<AutomationTimeAxisView> track;
RouteAutomationNode (ARDOUR::Parameter par, Gtk::CheckMenuItem* mi, boost::shared_ptr<AutomationTimeAxisView> tr)
RouteAutomationNode (Evoral::Parameter par, Gtk::CheckMenuItem* mi, boost::shared_ptr<AutomationTimeAxisView> tr)
: param (par), menu_item (mi), track (tr) {}
};
virtual void create_automation_child (const ARDOUR::Parameter& param, bool show) = 0;
virtual void create_automation_child (const Evoral::Parameter& param, bool show) = 0;
/* make sure we get the right version of this */
XMLNode* get_automation_child_xml_node (ARDOUR::Parameter param) { return RouteUI::get_automation_child_xml_node (param); }
XMLNode* get_automation_child_xml_node (Evoral::Parameter param) { return RouteUI::get_automation_child_xml_node (param); }
typedef map<ARDOUR::Parameter, RouteAutomationNode*> AutomationTracks;
typedef map<Evoral::Parameter, RouteAutomationNode*> AutomationTracks;
AutomationTracks automation_tracks() { return _automation_tracks; }
boost::shared_ptr<AutomationTimeAxisView> automation_child(ARDOUR::Parameter param);
boost::shared_ptr<AutomationTimeAxisView> automation_child(Evoral::Parameter param);
string name() const;
StreamView* view() const { return _view; }
@ -148,12 +148,12 @@ protected:
friend class StreamView;
struct ProcessorAutomationNode {
ARDOUR::Parameter what;
Evoral::Parameter what;
Gtk::CheckMenuItem* menu_item;
boost::shared_ptr<AutomationTimeAxisView> view;
RouteTimeAxisView& parent;
ProcessorAutomationNode (ARDOUR::Parameter w, Gtk::CheckMenuItem* mitem, RouteTimeAxisView& p)
ProcessorAutomationNode (Evoral::Parameter w, Gtk::CheckMenuItem* mitem, RouteTimeAxisView& p)
: what (w), menu_item (mitem), parent (p) {}
~ProcessorAutomationNode ();
@ -188,21 +188,21 @@ protected:
void processor_automation_track_hidden (ProcessorAutomationNode*,
boost::shared_ptr<ARDOUR::Processor>);
void automation_track_hidden (ARDOUR::Parameter param);
void automation_track_hidden (Evoral::Parameter param);
RouteAutomationNode* automation_track(ARDOUR::Parameter param);
RouteAutomationNode* automation_track(Evoral::Parameter param);
RouteAutomationNode* automation_track(ARDOUR::AutomationType type);
ProcessorAutomationNode*
find_processor_automation_node (boost::shared_ptr<ARDOUR::Processor> i, ARDOUR::Parameter);
find_processor_automation_node (boost::shared_ptr<ARDOUR::Processor> i, Evoral::Parameter);
boost::shared_ptr<AutomationLine>
find_processor_automation_curve (boost::shared_ptr<ARDOUR::Processor> i, ARDOUR::Parameter);
find_processor_automation_curve (boost::shared_ptr<ARDOUR::Processor> i, Evoral::Parameter);
void add_processor_automation_curve (boost::shared_ptr<ARDOUR::Processor> r, ARDOUR::Parameter);
void add_processor_automation_curve (boost::shared_ptr<ARDOUR::Processor> r, Evoral::Parameter);
void add_existing_processor_automation_curves (boost::shared_ptr<ARDOUR::Processor>);
void add_automation_child(ARDOUR::Parameter param, boost::shared_ptr<AutomationTimeAxisView> track, bool show=true);
void add_automation_child(Evoral::Parameter param, boost::shared_ptr<AutomationTimeAxisView> track, bool show=true);
void reset_processor_automation_curves ();
@ -237,7 +237,7 @@ protected:
void rename_current_playlist ();
void automation_click ();
void toggle_automation_track (ARDOUR::Parameter param);
void toggle_automation_track (Evoral::Parameter param);
virtual void show_all_automation ();
virtual void show_existing_automation ();
virtual void hide_all_automation ();
@ -297,7 +297,7 @@ protected:
ProcessorAutomationCurves processor_automation_curves;
// Set from XML so context menu automation buttons can be correctly initialized
set<ARDOUR::Parameter> _show_automation;
set<Evoral::Parameter> _show_automation;
AutomationTracks _automation_tracks;

View file

@ -766,24 +766,26 @@ RouteUI::ensure_xml_node ()
}
XMLNode*
RouteUI::get_automation_child_xml_node (Parameter param)
RouteUI::get_automation_child_xml_node (Evoral::Parameter param)
{
ensure_xml_node ();
XMLNodeList kids = xml_node->children();
XMLNodeConstIterator iter;
const string sym = ARDOUR::EventTypeMap::instance().to_symbol(param);
for (iter = kids.begin(); iter != kids.end(); ++iter) {
if ((*iter)->name() == AutomationTimeAxisView::state_node_name) {
XMLProperty* type = (*iter)->property("automation-id");
if (type && type->value() == param.symbol())
if (type && type->value() == sym)
return *iter;
}
}
// Didn't find it, make a new one
XMLNode* child = new XMLNode (AutomationTimeAxisView::state_node_name);
child->add_property("automation-id", param.symbol());
child->add_property("automation-id", sym);
xml_node->add_child_nocopy (*child);
return child;

View file

@ -86,7 +86,7 @@ class RouteUI : public virtual AxisView
XMLNode *xml_node;
void ensure_xml_node ();
virtual XMLNode* get_automation_child_xml_node (ARDOUR::Parameter param);
virtual XMLNode* get_automation_child_xml_node (Evoral::Parameter param);
bool mute_press(GdkEventButton*);
bool mute_release(GdkEventButton*);

View file

@ -37,7 +37,7 @@
#include <ardour/types.h>
#include <ardour/region.h>
#include <ardour/parameter.h>
#include <evoral/Parameter.hpp>
#include "prompter.h"
#include "axis_view.h"
@ -230,7 +230,7 @@ class TimeAxisView : public virtual AxisView, public PBD::Stateful
/* call this on the parent */
virtual XMLNode* get_automation_child_xml_node (ARDOUR::Parameter param) { return 0; }
virtual XMLNode* get_automation_child_xml_node (Evoral::Parameter param) { return 0; }
typedef std::vector<boost::shared_ptr<TimeAxisView> > Children;

View file

@ -117,7 +117,6 @@ mtc_slave.cc
named_selection.cc
onset_detector.cc
panner.cc
parameter.cc
pcm_utils.cc
playlist.cc
playlist_factory.cc

View file

@ -26,7 +26,6 @@
#include <ardour/session_object.h>
#include <ardour/automation_list.h>
#include <ardour/automation_control.h>
#include <ardour/parameter.h>
#include <ardour/event_type_map.h>
#include <evoral/ControlSet.hpp>
#include <evoral/Sequence.hpp>
@ -56,20 +55,20 @@ public:
virtual void automation_snapshot(nframes_t now, bool force);
virtual void transport_stopped(nframes_t now);
virtual string describe_parameter(Parameter param);
virtual string describe_parameter(Evoral::Parameter param);
AutoState get_parameter_automation_state (Parameter param, bool lock = true);
virtual void set_parameter_automation_state (Parameter param, AutoState);
AutoState get_parameter_automation_state (Evoral::Parameter param, bool lock = true);
virtual void set_parameter_automation_state (Evoral::Parameter param, AutoState);
AutoStyle get_parameter_automation_style (Parameter param);
void set_parameter_automation_style (Parameter param, AutoStyle);
AutoStyle get_parameter_automation_style (Evoral::Parameter param);
void set_parameter_automation_style (Evoral::Parameter param, AutoStyle);
void protect_automation ();
void what_has_visible_data(std::set<Parameter>&) const;
const std::set<Parameter>& what_can_be_automated() const { return _can_automate_list; }
void what_has_visible_data(std::set<Evoral::Parameter>&) const;
const std::set<Evoral::Parameter>& what_can_be_automated() const { return _can_automate_list; }
void mark_automation_visible(Parameter, bool);
void mark_automation_visible(Evoral::Parameter, bool);
inline bool should_snapshot (nframes_t now) {
return (_last_automation_snapshot > now
@ -92,18 +91,18 @@ public:
protected:
Session& _a_session;
void can_automate(Parameter);
void can_automate(Evoral::Parameter);
virtual void auto_state_changed (Parameter which) {}
virtual void auto_state_changed (Evoral::Parameter which) {}
int set_automation_state(const XMLNode&, Parameter default_param);
int set_automation_state(const XMLNode&, Evoral::Parameter default_param);
XMLNode& get_automation_state();
int load_automation (const std::string& path);
int old_set_automation_state(const XMLNode&);
std::set<Parameter> _visible_controls;
std::set<Parameter> _can_automate_list;
std::set<Evoral::Parameter> _visible_controls;
std::set<Evoral::Parameter> _can_automate_list;
nframes_t _last_automation_snapshot;
static nframes_t _automation_interval;

View file

@ -23,7 +23,6 @@
#include <boost/shared_ptr.hpp>
#include <pbd/controllable.h>
#include <ardour/parameter.h>
#include <evoral/Control.hpp>
#include <ardour/automation_list.h>
@ -40,7 +39,7 @@ class AutomationControl : public PBD::Controllable, public Evoral::Control
{
public:
AutomationControl(ARDOUR::Session&,
const Parameter& parameter,
const Evoral::Parameter& parameter,
boost::shared_ptr<ARDOUR::AutomationList> l=boost::shared_ptr<ARDOUR::AutomationList>(),
const string& name="");

View file

@ -32,19 +32,16 @@
#include <pbd/statefuldestructible.h>
#include <ardour/ardour.h>
#include <ardour/parameter.h>
#include <evoral/ControlList.hpp>
using Evoral::ControlEvent;
namespace ARDOUR {
class AutomationList : public PBD::StatefulDestructible, public Evoral::ControlList
{
public:
AutomationList (Parameter id);
AutomationList (const XMLNode&, Parameter id);
AutomationList (Evoral::Parameter id);
AutomationList (const XMLNode&, Evoral::Parameter id);
~AutomationList();
virtual boost::shared_ptr<Evoral::ControlList> create(Evoral::Parameter id);

View file

@ -21,17 +21,24 @@
#ifndef __ardour_event_type_map_h__
#define __ardour_event_type_map_h__
#include <string>
#include <evoral/TypeMap.hpp>
namespace ARDOUR {
/** This is the interface Ardour provides to Evoral about what
* parameter and event types/ranges/names etc. to use.
*/
class EventTypeMap : public Evoral::TypeMap {
public:
bool type_is_midi(uint32_t type) const;
uint8_t parameter_midi_type(const Evoral::Parameter& param) const;
uint32_t midi_event_type(uint8_t status) const;
bool is_integer(const Evoral::Parameter& param) const;
bool is_integer(const Evoral::Parameter& param) const;
Evoral::Parameter new_parameter(uint32_t type, uint8_t channel=0, uint32_t id=0) const;
Evoral::Parameter new_parameter(const std::string& str) const;
std::string to_symbol(const Evoral::Parameter& param) const;
static EventTypeMap& instance() { return event_type_map; }

View file

@ -248,7 +248,7 @@ class IO : public SessionObject, public AutomatableControls, public Latent
void clear_automation ();
void set_parameter_automation_state (Parameter, AutoState);
void set_parameter_automation_state (Evoral::Parameter, AutoState);
virtual void transport_stopped (nframes_t now);
virtual void automation_snapshot (nframes_t now, bool force);

View file

@ -58,7 +58,7 @@ class LadspaPlugin : public ARDOUR::Plugin
int get_parameter_descriptor (uint32_t which, ParameterDescriptor&) const;
uint32_t nth_parameter (uint32_t port, bool& ok) const;
std::set<Parameter> automatable() const;
std::set<Evoral::Parameter> automatable() const;
void activate () {
if (!_was_activated && _descriptor->activate)
@ -85,7 +85,7 @@ class LadspaPlugin : public ARDOUR::Plugin
void set_block_size (nframes_t nframes) {}
int connect_and_run (BufferSet& bufs, uint32_t& in, uint32_t& out, nframes_t nframes, nframes_t offset);
std::string describe_parameter (Parameter);
std::string describe_parameter (Evoral::Parameter);
std::string state_node_name() const { return "ladspa"; }
void print_parameter (uint32_t, char*, uint32_t len) const;

View file

@ -68,7 +68,7 @@ class LV2Plugin : public ARDOUR::Plugin
const LV2_Feature* const* features() { return _features; }
std::set<Parameter> automatable() const;
std::set<Evoral::Parameter> automatable() const;
void activate () {
if (!_was_activated) {
@ -94,7 +94,7 @@ class LV2Plugin : public ARDOUR::Plugin
void set_block_size (nframes_t nframes) {}
int connect_and_run (BufferSet& bufs, uint32_t& in, uint32_t& out, nframes_t nframes, nframes_t offset);
std::string describe_parameter (Parameter);
std::string describe_parameter (Evoral::Parameter);
std::string state_node_name() const { return "lv2"; }
void print_parameter (uint32_t, char*, uint32_t len) const;

View file

@ -25,7 +25,7 @@
#include <ardour/ardour.h>
#include <ardour/playlist.h>
#include <ardour/parameter.h>
#include <evoral/Parameter.hpp>
namespace ARDOUR
{
@ -57,7 +57,7 @@ public:
void set_note_mode (NoteMode m) { _note_mode = m; }
std::set<Parameter> contained_automation();
std::set<Evoral::Parameter> contained_automation();
protected:

View file

@ -75,7 +75,7 @@ public:
/** A control that will send "immediate" events to a MIDI track when twiddled */
struct MidiControl : public AutomationControl {
MidiControl(MidiTrack* route, const Parameter& param,
MidiControl(MidiTrack* route, const Evoral::Parameter& param,
boost::shared_ptr<AutomationList> al = boost::shared_ptr<AutomationList>())
: AutomationControl (route->session(), param, al)
, _route (route)

View file

@ -46,7 +46,7 @@ class AudioBuffer;
class StreamPanner : public sigc::trackable, public PBD::Stateful
{
public:
StreamPanner (Panner& p, Parameter param);
StreamPanner (Panner& p, Evoral::Parameter param);
~StreamPanner ();
void set_muted (bool yn);
@ -103,7 +103,7 @@ class StreamPanner : public sigc::trackable, public PBD::Stateful
bool _muted;
struct PanControllable : public AutomationControl {
PanControllable (Session& s, std::string name, StreamPanner& p, Parameter param)
PanControllable (Session& s, std::string name, StreamPanner& p, Evoral::Parameter param)
: AutomationControl (s, param,
boost::shared_ptr<AutomationList>(new AutomationList(param)), name)
, panner (p)
@ -125,7 +125,7 @@ class StreamPanner : public sigc::trackable, public PBD::Stateful
class BaseStereoPanner : public StreamPanner
{
public:
BaseStereoPanner (Panner&, Parameter param);
BaseStereoPanner (Panner&, Evoral::Parameter param);
~BaseStereoPanner ();
/* this class just leaves the pan law itself to be defined
@ -152,7 +152,7 @@ class BaseStereoPanner : public StreamPanner
class EqualPowerStereoPanner : public BaseStereoPanner
{
public:
EqualPowerStereoPanner (Panner&, Parameter param);
EqualPowerStereoPanner (Panner&, Evoral::Parameter param);
~EqualPowerStereoPanner ();
void distribute_automated (AudioBuffer& src, BufferSet& obufs,
@ -161,7 +161,7 @@ class EqualPowerStereoPanner : public BaseStereoPanner
void get_current_coefficients (pan_t*) const;
void get_desired_coefficients (pan_t*) const;
static StreamPanner* factory (Panner&, Parameter param);
static StreamPanner* factory (Panner&, Evoral::Parameter param);
static string name;
XMLNode& state (bool full_state);
@ -175,14 +175,14 @@ class EqualPowerStereoPanner : public BaseStereoPanner
class Multi2dPanner : public StreamPanner
{
public:
Multi2dPanner (Panner& parent, Parameter);
Multi2dPanner (Panner& parent, Evoral::Parameter);
~Multi2dPanner ();
void distribute (AudioBuffer& src, BufferSet& obufs, gain_t gain_coeff, nframes_t nframes);
void distribute_automated (AudioBuffer& src, BufferSet& obufs,
nframes_t start, nframes_t end, nframes_t nframes, pan_t** buffers);
static StreamPanner* factory (Panner&, Parameter);
static StreamPanner* factory (Panner&, Evoral::Parameter);
static string name;
XMLNode& state (bool full_state);

View file

@ -1,103 +0,0 @@
/*
Copyright (C) 2007 Paul Davis
Author: Dave Robillard
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.
*/
#ifndef __ardour_parameter_h__
#define __ardour_parameter_h__
#include <string>
#include <pbd/compose.h>
#include <pbd/error.h>
#include <ardour/types.h>
#include <evoral/Parameter.hpp>
#include <evoral/MIDIParameters.hpp>
namespace ARDOUR {
/** ID of an automatable parameter.
*
* A given automatable object has a number of automatable parameters. This is
* the unique ID for those parameters. Anything automatable (AutomationList,
* Curve) must have unique Parameter ID with respect to it's Automatable parent.
*
* These are fast to compare, but passing a (const) reference around is
* probably more efficient than copying because the Parameter contains
* metadata not used for comparison.
*
* See evoral/Parameter.hpp for precise definition.
*/
class Parameter : public Evoral::Parameter
{
public:
Parameter(AutomationType type = NullAutomation, uint32_t id=0, uint8_t channel=0)
: Evoral::Parameter((uint32_t)type, channel, id)
{
init_metadata(type);
}
Parameter(const Evoral::Parameter& copy)
: Evoral::Parameter(copy)
{
}
static void init_metadata(AutomationType type) {
double min = 0.0f;
double max = 1.0f;
double normal = 0.0f;
switch(type) {
case NullAutomation:
case GainAutomation:
max = 2.0f;
normal = 1.0f;
break;
case PanAutomation:
normal = 0.5f;
break;
case PluginAutomation:
case SoloAutomation:
case MuteAutomation:
case FadeInAutomation:
case FadeOutAutomation:
case EnvelopeAutomation:
max = 2.0f;
normal = 1.0f;
break;
case MidiCCAutomation:
case MidiPgmChangeAutomation:
case MidiChannelPressureAutomation:
Evoral::MIDI::controller_range(min, max, normal); break;
case MidiPitchBenderAutomation:
Evoral::MIDI::bender_range(min, max, normal); break;
}
set_range(type, min, max, normal);
}
Parameter(const std::string& str);
inline AutomationType type() const { return (AutomationType)_type; }
std::string symbol() const;
inline operator Parameter() { return (Parameter)*this; }
};
} // namespace ARDOUR
#endif // __ardour_parameter_h__

View file

@ -32,7 +32,6 @@
#include <ardour/chan_count.h>
#include <ardour/cycles.h>
#include <ardour/latent.h>
#include <ardour/parameter.h>
#include <ardour/plugin_insert.h>
#include <vector>
@ -129,8 +128,8 @@ class Plugin : public PBD::StatefulDestructible, public Latent
virtual int connect_and_run (BufferSet& bufs, uint32_t& in, uint32_t& out, nframes_t nframes, nframes_t offset) = 0;
virtual std::set<Parameter> automatable() const = 0;
virtual string describe_parameter (Parameter) = 0;
virtual std::set<Evoral::Parameter> automatable() const = 0;
virtual string describe_parameter (Evoral::Parameter) = 0;
virtual string state_node_name() const = 0;
virtual void print_parameter (uint32_t, char*, uint32_t len) const = 0;

View file

@ -74,14 +74,14 @@ class PluginInsert : public Processor
bool is_generator() const;
void set_parameter (Parameter param, float val);
float get_parameter (Parameter param);
void set_parameter (Evoral::Parameter param, float val);
float get_parameter (Evoral::Parameter param);
float default_parameter_value (const Evoral::Parameter& param);
struct PluginControl : public AutomationControl
{
PluginControl (PluginInsert* p, const Parameter &param,
PluginControl (PluginInsert* p, const Evoral::Parameter &param,
boost::shared_ptr<AutomationList> list = boost::shared_ptr<AutomationList>());
void set_value (float val);
@ -103,13 +103,13 @@ class PluginInsert : public Processor
PluginType type ();
string describe_parameter (Parameter param);
string describe_parameter (Evoral::Parameter param);
nframes_t signal_latency() const;
private:
void parameter_changed (Parameter, float);
void parameter_changed (Evoral::Parameter, float);
std::vector<boost::shared_ptr<Plugin> > _plugins;
@ -118,7 +118,7 @@ class PluginInsert : public Processor
void init ();
void set_automatable ();
void auto_state_changed (Parameter which);
void auto_state_changed (Evoral::Parameter which);
int32_t count_for_configuration (ChanCount in, ChanCount out) const;

View file

@ -86,20 +86,22 @@ AudioEngine::AudioEngine (string client_name)
Port::set_engine (this);
Parameter::init_metadata(NullAutomation);
Parameter::init_metadata(GainAutomation);
Parameter::init_metadata(PanAutomation);
Parameter::init_metadata(PluginAutomation);
Parameter::init_metadata(SoloAutomation);
Parameter::init_metadata(MuteAutomation);
Parameter::init_metadata(MidiCCAutomation);
Parameter::init_metadata(MidiPgmChangeAutomation);
Parameter::init_metadata(MidiPitchBenderAutomation);
Parameter::init_metadata(MidiChannelPressureAutomation);
Parameter::init_metadata(FadeInAutomation);
Parameter::init_metadata(FadeOutAutomation);
Parameter::init_metadata(EnvelopeAutomation);
Parameter::init_metadata(MidiCCAutomation);
// Initialize parameter metadata (e.g. ranges)
Evoral::Parameter p(NullAutomation);
p = EventTypeMap::instance().new_parameter(NullAutomation);
p = EventTypeMap::instance().new_parameter(GainAutomation);
p = EventTypeMap::instance().new_parameter(PanAutomation);
p = EventTypeMap::instance().new_parameter(PluginAutomation);
p = EventTypeMap::instance().new_parameter(SoloAutomation);
p = EventTypeMap::instance().new_parameter(MuteAutomation);
p = EventTypeMap::instance().new_parameter(MidiCCAutomation);
p = EventTypeMap::instance().new_parameter(MidiPgmChangeAutomation);
p = EventTypeMap::instance().new_parameter(MidiPitchBenderAutomation);
p = EventTypeMap::instance().new_parameter(MidiChannelPressureAutomation);
p = EventTypeMap::instance().new_parameter(FadeInAutomation);
p = EventTypeMap::instance().new_parameter(FadeOutAutomation);
p = EventTypeMap::instance().new_parameter(EnvelopeAutomation);
p = EventTypeMap::instance().new_parameter(MidiCCAutomation);
}
AudioEngine::~AudioEngine ()

View file

@ -78,9 +78,9 @@ AudioRegion::init ()
AudioRegion::AudioRegion (Session& s, nframes_t start, nframes_t length, string name)
: Region (s, start, length, name, DataType::AUDIO)
, _automatable(s)
, _fade_in (new AutomationList(Parameter(FadeInAutomation)))
, _fade_out (new AutomationList(Parameter(FadeOutAutomation)))
, _envelope (new AutomationList(Parameter(EnvelopeAutomation)))
, _fade_in (new AutomationList(Evoral::Parameter(FadeInAutomation)))
, _fade_out (new AutomationList(Evoral::Parameter(FadeOutAutomation)))
, _envelope (new AutomationList(Evoral::Parameter(EnvelopeAutomation)))
{
init ();
}
@ -89,9 +89,9 @@ AudioRegion::AudioRegion (Session& s, nframes_t start, nframes_t length, string
AudioRegion::AudioRegion (boost::shared_ptr<AudioSource> src, nframes_t start, nframes_t length)
: Region (src, start, length, PBD::basename_nosuffix(src->name()), DataType::AUDIO, 0, Region::Flag(Region::DefaultFlags|Region::External))
, _automatable(src->session())
, _fade_in (new AutomationList(Parameter(FadeInAutomation)))
, _fade_out (new AutomationList(Parameter(FadeOutAutomation)))
, _envelope (new AutomationList(Parameter(EnvelopeAutomation)))
, _fade_in (new AutomationList(Evoral::Parameter(FadeInAutomation)))
, _fade_out (new AutomationList(Evoral::Parameter(FadeOutAutomation)))
, _envelope (new AutomationList(Evoral::Parameter(EnvelopeAutomation)))
{
boost::shared_ptr<AudioFileSource> afs = boost::dynamic_pointer_cast<AudioFileSource> (src);
if (afs) {
@ -105,9 +105,9 @@ AudioRegion::AudioRegion (boost::shared_ptr<AudioSource> src, nframes_t start, n
AudioRegion::AudioRegion (boost::shared_ptr<AudioSource> src, nframes_t start, nframes_t length, const string& name, layer_t layer, Flag flags)
: Region (src, start, length, name, DataType::AUDIO, layer, flags)
, _automatable(src->session())
, _fade_in (new AutomationList(Parameter(FadeInAutomation)))
, _fade_out (new AutomationList(Parameter(FadeOutAutomation)))
, _envelope (new AutomationList(Parameter(EnvelopeAutomation)))
, _fade_in (new AutomationList(Evoral::Parameter(FadeInAutomation)))
, _fade_out (new AutomationList(Evoral::Parameter(FadeOutAutomation)))
, _envelope (new AutomationList(Evoral::Parameter(EnvelopeAutomation)))
{
boost::shared_ptr<AudioFileSource> afs = boost::dynamic_pointer_cast<AudioFileSource> (src);
if (afs) {
@ -121,9 +121,9 @@ AudioRegion::AudioRegion (boost::shared_ptr<AudioSource> src, nframes_t start, n
AudioRegion::AudioRegion (const SourceList& srcs, nframes_t start, nframes_t length, const string& name, layer_t layer, Flag flags)
: Region (srcs, start, length, name, DataType::AUDIO, layer, flags)
, _automatable(srcs[0]->session())
, _fade_in (new AutomationList(Parameter(FadeInAutomation)))
, _fade_out (new AutomationList(Parameter(FadeOutAutomation)))
, _envelope (new AutomationList(Parameter(EnvelopeAutomation)))
, _fade_in (new AutomationList(Evoral::Parameter(FadeInAutomation)))
, _fade_out (new AutomationList(Evoral::Parameter(FadeOutAutomation)))
, _envelope (new AutomationList(Evoral::Parameter(EnvelopeAutomation)))
{
init ();
listen_to_my_sources ();
@ -133,9 +133,9 @@ AudioRegion::AudioRegion (const SourceList& srcs, nframes_t start, nframes_t len
AudioRegion::AudioRegion (boost::shared_ptr<const AudioRegion> other, nframes_t offset, nframes_t length, const string& name, layer_t layer, Flag flags)
: Region (other, offset, length, name, layer, flags)
, _automatable(other->session())
, _fade_in (new AutomationList(Parameter(FadeInAutomation)))
, _fade_out (new AutomationList(Parameter(FadeOutAutomation)))
, _envelope (new AutomationList(Parameter(EnvelopeAutomation)))
, _fade_in (new AutomationList(Evoral::Parameter(FadeInAutomation)))
, _fade_out (new AutomationList(Evoral::Parameter(FadeOutAutomation)))
, _envelope (new AutomationList(Evoral::Parameter(EnvelopeAutomation)))
{
set<boost::shared_ptr<Source> > unique_srcs;
@ -186,9 +186,9 @@ AudioRegion::AudioRegion (boost::shared_ptr<const AudioRegion> other, nframes_t
AudioRegion::AudioRegion (boost::shared_ptr<const AudioRegion> other)
: Region (other)
, _automatable(other->session())
, _fade_in (new AutomationList(Parameter(FadeInAutomation)))
, _fade_out (new AutomationList(Parameter(FadeOutAutomation)))
, _envelope (new AutomationList(Parameter(EnvelopeAutomation)))
, _fade_in (new AutomationList(Evoral::Parameter(FadeInAutomation)))
, _fade_out (new AutomationList(Evoral::Parameter(FadeOutAutomation)))
, _envelope (new AutomationList(Evoral::Parameter(EnvelopeAutomation)))
{
assert(_type == DataType::AUDIO);
_scale_amplitude = other->_scale_amplitude;
@ -203,9 +203,9 @@ AudioRegion::AudioRegion (boost::shared_ptr<const AudioRegion> other)
AudioRegion::AudioRegion (boost::shared_ptr<AudioSource> src, const XMLNode& node)
: Region (src, node)
, _automatable(src->session())
, _fade_in (new AutomationList(Parameter(FadeInAutomation)))
, _fade_out (new AutomationList(Parameter(FadeOutAutomation)))
, _envelope (new AutomationList(Parameter(EnvelopeAutomation)))
, _fade_in (new AutomationList(Evoral::Parameter(FadeInAutomation)))
, _fade_out (new AutomationList(Evoral::Parameter(FadeOutAutomation)))
, _envelope (new AutomationList(Evoral::Parameter(EnvelopeAutomation)))
{
boost::shared_ptr<AudioFileSource> afs = boost::dynamic_pointer_cast<AudioFileSource> (src);
if (afs) {
@ -225,9 +225,9 @@ AudioRegion::AudioRegion (boost::shared_ptr<AudioSource> src, const XMLNode& nod
AudioRegion::AudioRegion (SourceList& srcs, const XMLNode& node)
: Region (srcs, node)
, _automatable(srcs[0]->session())
, _fade_in (new AutomationList(Parameter(FadeInAutomation)))
, _fade_out (new AutomationList(Parameter(FadeOutAutomation)))
, _envelope (new AutomationList(Parameter(EnvelopeAutomation)))
, _fade_in (new AutomationList(Evoral::Parameter(FadeInAutomation)))
, _fade_out (new AutomationList(Evoral::Parameter(FadeOutAutomation)))
, _envelope (new AutomationList(Evoral::Parameter(EnvelopeAutomation)))
{
init ();

View file

@ -67,7 +67,7 @@ Automatable::old_set_automation_state (const XMLNode& node)
if (sstr.fail()) {
break;
}
mark_automation_visible (Parameter(PluginAutomation, what), true);
mark_automation_visible (Evoral::Parameter(PluginAutomation, what), true);
}
}
@ -96,7 +96,7 @@ Automatable::load_automation (const string& path)
}
Glib::Mutex::Lock lm (control_lock());
set<Parameter> tosave;
set<Evoral::Parameter> tosave;
controls().clear ();
_last_automation_snapshot = 0;
@ -110,10 +110,11 @@ Automatable::load_automation (const string& path)
in >> when; if (!in) goto bad;
in >> value; if (!in) goto bad;
Evoral::Parameter param(PluginAutomation, port);
/* FIXME: this is legacy and only used for plugin inserts? I think? */
boost::shared_ptr<Evoral::Control> c = control (Parameter(PluginAutomation, port), true);
boost::shared_ptr<Evoral::Control> c = control (param, true);
c->list()->add (when, value);
tosave.insert (Parameter(PluginAutomation, port));
tosave.insert (param);
}
return 0;
@ -127,7 +128,7 @@ Automatable::load_automation (const string& path)
void
Automatable::add_control(boost::shared_ptr<Evoral::Control> ac)
{
Parameter param = ac->parameter();
Evoral::Parameter param = ac->parameter();
ControlSet::add_control(ac);
_can_automate_list.insert(param);
@ -135,10 +136,10 @@ Automatable::add_control(boost::shared_ptr<Evoral::Control> ac)
}
void
Automatable::what_has_visible_data(set<Parameter>& s) const
Automatable::what_has_visible_data(set<Evoral::Parameter>& s) const
{
Glib::Mutex::Lock lm (control_lock());
set<Parameter>::const_iterator li;
set<Evoral::Parameter>::const_iterator li;
for (li = _visible_controls.begin(); li != _visible_controls.end(); ++li) {
s.insert (*li);
@ -146,11 +147,11 @@ Automatable::what_has_visible_data(set<Parameter>& s) const
}
string
Automatable::describe_parameter (Parameter param)
Automatable::describe_parameter (Evoral::Parameter param)
{
/* derived classes like PluginInsert should override this */
if (param == Parameter(GainAutomation)) {
if (param == Evoral::Parameter(GainAutomation)) {
return _("Fader");
} else if (param.type() == PanAutomation) {
/* ID's are zero-based, present them as 1-based */
@ -165,23 +166,23 @@ Automatable::describe_parameter (Parameter param)
} else if (param.type() == MidiChannelPressureAutomation) {
return string_compose("Pressure [%1]", int(param.channel()) + 1);
} else {
return param.symbol();
return EventTypeMap::instance().to_symbol(param);
}
}
void
Automatable::can_automate (Parameter what)
Automatable::can_automate (Evoral::Parameter what)
{
_can_automate_list.insert (what);
}
void
Automatable::mark_automation_visible (Parameter what, bool yn)
Automatable::mark_automation_visible (Evoral::Parameter what, bool yn)
{
if (yn) {
_visible_controls.insert (what);
} else {
set<Parameter>::iterator i;
set<Evoral::Parameter>::iterator i;
if ((i = _visible_controls.find (what)) != _visible_controls.end()) {
_visible_controls.erase (i);
@ -194,7 +195,7 @@ Automatable::mark_automation_visible (Parameter what, bool yn)
* pass that type and it will be used for the untyped AutomationList found.
*/
int
Automatable::set_automation_state (const XMLNode& node, Parameter legacy_param)
Automatable::set_automation_state (const XMLNode& node, Evoral::Parameter legacy_param)
{
Glib::Mutex::Lock lm (control_lock());
@ -216,7 +217,10 @@ Automatable::set_automation_state (const XMLNode& node, Parameter legacy_param)
const XMLProperty* id_prop = (*niter)->property("automation-id");
Parameter param = (id_prop ? Parameter(id_prop->value()) : legacy_param);
Evoral::Parameter param = (id_prop
? EventTypeMap::instance().new_parameter(id_prop->value())
: legacy_param);
if (param.type() == NullAutomation) {
warning << "Automation has null type" << endl;
continue;
@ -226,7 +230,7 @@ Automatable::set_automation_state (const XMLNode& node, Parameter legacy_param)
if (!id_prop) {
warning << "AutomationList node without automation-id property, "
<< "using default: " << legacy_param.symbol() << endmsg;
<< "using default: " << EventTypeMap::instance().to_symbol(legacy_param) << endmsg;
}
boost::shared_ptr<Evoral::Control> existing = control(param);
@ -265,7 +269,7 @@ Automatable::get_automation_state ()
}
void
Automatable::set_parameter_automation_state (Parameter param, AutoState s)
Automatable::set_parameter_automation_state (Evoral::Parameter param, AutoState s)
{
Glib::Mutex::Lock lm (control_lock());
@ -279,7 +283,7 @@ Automatable::set_parameter_automation_state (Parameter param, AutoState s)
}
AutoState
Automatable::get_parameter_automation_state (Parameter param, bool lock)
Automatable::get_parameter_automation_state (Evoral::Parameter param, bool lock)
{
AutoState result = Off;
@ -299,7 +303,7 @@ Automatable::get_parameter_automation_state (Parameter param, bool lock)
}
void
Automatable::set_parameter_automation_style (Parameter param, AutoStyle s)
Automatable::set_parameter_automation_style (Evoral::Parameter param, AutoStyle s)
{
Glib::Mutex::Lock lm (control_lock());
@ -313,7 +317,7 @@ Automatable::set_parameter_automation_style (Parameter param, AutoStyle s)
}
AutoStyle
Automatable::get_parameter_automation_style (Parameter param)
Automatable::get_parameter_automation_style (Evoral::Parameter param)
{
Glib::Mutex::Lock lm (control_lock());

View file

@ -31,10 +31,10 @@ using namespace PBD;
AutomationControl::AutomationControl(
ARDOUR::Session& session,
const Parameter& parameter,
const Evoral::Parameter& parameter,
boost::shared_ptr<ARDOUR::AutomationList> list,
const string& name)
: Controllable((name != "") ? name : parameter.symbol())
: Controllable((name != "") ? name : EventTypeMap::instance().to_symbol(parameter))
, Evoral::Control(parameter, list)
, _session(session)
{

View file

@ -24,8 +24,8 @@
#include <sstream>
#include <algorithm>
#include <sigc++/bind.h>
#include <ardour/parameter.h>
#include <ardour/automation_list.h>
#include <ardour/event_type_map.h>
#include <evoral/Curve.hpp>
#include <pbd/stacktrace.h>
#include <pbd/enumwriter.h>
@ -51,7 +51,7 @@ static void dumpit (const AutomationList& al, string prefix = "")
#endif
/* XXX: min_val max_val redundant? (param.min() param.max()) */
AutomationList::AutomationList (Parameter id)
AutomationList::AutomationList (Evoral::Parameter id)
: ControlList(id)
{
_state = Off;
@ -86,7 +86,7 @@ AutomationList::AutomationList (const AutomationList& other, double start, doubl
/** \a id is used for legacy sessions where the type is not present
* in or below the <AutomationList> node. It is used if \a id is non-null.
*/
AutomationList::AutomationList (const XMLNode& node, Parameter id)
AutomationList::AutomationList (const XMLNode& node, Evoral::Parameter id)
: ControlList(id)
{
_touching = false;
@ -127,7 +127,7 @@ AutomationList::operator= (const AutomationList& other)
_events.clear ();
for (const_iterator i = other._events.begin(); i != other._events.end(); ++i) {
_events.push_back (new ControlEvent (**i));
_events.push_back (new Evoral::ControlEvent (**i));
}
_min_yval = other._min_yval;
@ -220,7 +220,7 @@ AutomationList::state (bool full)
char buf[64];
LocaleGuard lg (X_("POSIX"));
root->add_property ("automation-id", _parameter.symbol());
root->add_property ("automation-id", EventTypeMap::instance().to_symbol(_parameter));
root->add_property ("id", _id.to_s());
@ -388,7 +388,7 @@ AutomationList::set_state (const XMLNode& node)
}
if ((prop = node.property (X_("automation-id"))) != 0){
_parameter = Evoral::Parameter(prop->value());
_parameter = EventTypeMap::instance().new_parameter(prop->value());
} else {
warning << "Legacy session: automation list has no automation-id property.";
}

View file

@ -78,8 +78,8 @@ Crossfade::Crossfade (boost::shared_ptr<AudioRegion> in, boost::shared_ptr<Audio
nframes_t position,
AnchorPoint ap)
: AudioRegion (in->session(), position, length, "foobar"),
_fade_in (Parameter(FadeInAutomation)), // linear (gain coefficient) => -inf..+6dB
_fade_out (Parameter(FadeOutAutomation)) // linear (gain coefficient) => -inf..+6dB
_fade_in (Evoral::Parameter(FadeInAutomation)), // linear (gain coefficient) => -inf..+6dB
_fade_out (Evoral::Parameter(FadeOutAutomation)) // linear (gain coefficient) => -inf..+6dB
{
_in = in;
@ -95,8 +95,8 @@ Crossfade::Crossfade (boost::shared_ptr<AudioRegion> in, boost::shared_ptr<Audio
Crossfade::Crossfade (boost::shared_ptr<AudioRegion> a, boost::shared_ptr<AudioRegion> b, CrossfadeModel model, bool act)
: AudioRegion (a->session(), 0, 0, "foobar"),
_fade_in (Parameter(FadeInAutomation)), // linear (gain coefficient) => -inf..+6dB
_fade_out (Parameter(FadeOutAutomation)) // linear (gain coefficient) => -inf..+6dB
_fade_in (Evoral::Parameter(FadeInAutomation)), // linear (gain coefficient) => -inf..+6dB
_fade_out (Evoral::Parameter(FadeOutAutomation)) // linear (gain coefficient) => -inf..+6dB
{
_in_update = false;
_fixed = false;
@ -114,8 +114,8 @@ Crossfade::Crossfade (boost::shared_ptr<AudioRegion> a, boost::shared_ptr<AudioR
Crossfade::Crossfade (const Playlist& playlist, XMLNode& node)
: AudioRegion (playlist.session(), 0, 0, "foobar"),
_fade_in (Parameter(FadeInAutomation)), // linear (gain coefficient) => -inf..+6dB
_fade_out (Parameter(FadeOutAutomation)) // linear (gain coefficient) => -inf..+6dB
_fade_in (Evoral::Parameter(FadeInAutomation)), // linear (gain coefficient) => -inf..+6dB
_fade_out (Evoral::Parameter(FadeOutAutomation)) // linear (gain coefficient) => -inf..+6dB
{
boost::shared_ptr<Region> r;

View file

@ -22,6 +22,11 @@
#include <ardour/event_type_map.h>
#include <evoral/Parameter.hpp>
#include <evoral/midi_events.h>
#include <evoral/MIDIParameters.hpp>
#include <pbd/error.h>
#include <pbd/compose.h>
using namespace std;
namespace ARDOUR {
@ -64,5 +69,142 @@ EventTypeMap::is_integer(const Evoral::Parameter& param) const
&& param.type() <= MidiChannelPressureAutomation);
}
Evoral::Parameter
EventTypeMap::new_parameter(uint32_t type, uint8_t channel, uint32_t id) const
{
Evoral::Parameter p(type, channel, id);
double min = 0.0f;
double max = 1.0f;
double normal = 0.0f;
switch((AutomationType)type) {
case NullAutomation:
case GainAutomation:
max = 2.0f;
normal = 1.0f;
break;
case PanAutomation:
normal = 0.5f;
break;
case PluginAutomation:
case SoloAutomation:
case MuteAutomation:
case FadeInAutomation:
case FadeOutAutomation:
case EnvelopeAutomation:
max = 2.0f;
normal = 1.0f;
break;
case MidiCCAutomation:
case MidiPgmChangeAutomation:
case MidiChannelPressureAutomation:
Evoral::MIDI::controller_range(min, max, normal); break;
case MidiPitchBenderAutomation:
Evoral::MIDI::bender_range(min, max, normal); break;
}
p.set_range(type, min, max, normal);
return p;
}
Evoral::Parameter
EventTypeMap::new_parameter(const string& str) const
{
AutomationType p_type = NullAutomation;
uint8_t p_channel = 0;
uint32_t p_id = 0;
if (str == "gain") {
p_type = GainAutomation;
} else if (str == "solo") {
p_type = SoloAutomation;
} else if (str == "mute") {
p_type = MuteAutomation;
} else if (str == "fadein") {
p_type = FadeInAutomation;
} else if (str == "fadeout") {
p_type = FadeOutAutomation;
} else if (str == "envelope") {
p_type = EnvelopeAutomation;
} else if (str == "pan") {
p_type = PanAutomation;
} else if (str.length() > 4 && str.substr(0, 4) == "pan-") {
p_type = PanAutomation;
p_id = atoi(str.c_str()+4);
} else if (str.length() > 10 && str.substr(0, 10) == "parameter-") {
p_type = PluginAutomation;
p_id = atoi(str.c_str()+10);
} else if (str.length() > 7 && str.substr(0, 7) == "midicc-") {
p_type = MidiCCAutomation;
uint32_t channel = 0;
sscanf(str.c_str(), "midicc-%d-%d", &channel, &p_id);
assert(channel < 16);
p_channel = channel;
} else if (str.length() > 16 && str.substr(0, 16) == "midi-pgm-change-") {
p_type = MidiPgmChangeAutomation;
uint32_t channel = 0;
sscanf(str.c_str(), "midi-pgm-change-%d", &channel);
assert(channel < 16);
p_id = 0;
p_channel = channel;
} else if (str.length() > 18 && str.substr(0, 18) == "midi-pitch-bender-") {
p_type = MidiPitchBenderAutomation;
uint32_t channel = 0;
sscanf(str.c_str(), "midi-pitch-bender-%d", &channel);
assert(channel < 16);
p_id = 0;
p_channel = channel;
} else if (str.length() > 24 && str.substr(0, 24) == "midi-channel-pressure-") {
p_type = MidiChannelPressureAutomation;
uint32_t channel = 0;
sscanf(str.c_str(), "midi-channel-pressure-%d", &channel);
assert(channel < 16);
p_id = 0;
p_channel = channel;
} else {
PBD::warning << "Unknown Parameter '" << str << "'" << endmsg;
}
return new_parameter(p_type, p_channel, p_id);
}
/** Unique string representation, suitable as an XML property value.
* e.g. <AutomationList automation-id="whatthisreturns">
*/
std::string
EventTypeMap::to_symbol(const Evoral::Parameter& param) const
{
AutomationType t = (AutomationType)param.type();
if (t == GainAutomation) {
return "gain";
} else if (t == PanAutomation) {
return string_compose("pan-%1", param.id());
} else if (t == SoloAutomation) {
return "solo";
} else if (t == MuteAutomation) {
return "mute";
} else if (t == FadeInAutomation) {
return "fadein";
} else if (t == FadeOutAutomation) {
return "fadeout";
} else if (t == EnvelopeAutomation) {
return "envelope";
} else if (t == PluginAutomation) {
return string_compose("parameter-%1", param.id());
} else if (t == MidiCCAutomation) {
return string_compose("midicc-%1-%2", int(param.channel()), param.id());
} else if (t == MidiPgmChangeAutomation) {
return string_compose("midi-pgm-change-%1", int(param.channel()));
} else if (t == MidiPitchBenderAutomation) {
return string_compose("midi-pitch-bender-%1", int(param.channel()));
} else if (t == MidiChannelPressureAutomation) {
return string_compose("midi-channel-pressure-%1", int(param.channel()));
} else {
PBD::warning << "Uninitialized Parameter symbol() called." << endmsg;
return "";
}
}
} // namespace ARDOUR

View file

@ -22,7 +22,7 @@
using namespace ARDOUR;
Gain::Gain ()
: AutomationList (Parameter(GainAutomation)) /* XXX yuck; clamps gain to -inf .. +6db */
: AutomationList (Evoral::Parameter(GainAutomation)) /* XXX yuck; clamps gain to -inf .. +6db */
{
}

View file

@ -138,7 +138,7 @@ IO::IO (Session& s, const string& name,
deferred_state = 0;
boost::shared_ptr<AutomationList> gl(
new AutomationList(Parameter(GainAutomation)));
new AutomationList(Evoral::Parameter(GainAutomation)));
_gain_control = boost::shared_ptr<GainControl>(
new GainControl(X_("gaincontrol"), *this, gl));
@ -180,7 +180,7 @@ IO::IO (Session& s, const XMLNode& node, DataType dt)
apply_gain_automation = false;
boost::shared_ptr<AutomationList> gl(
new AutomationList(Parameter(GainAutomation)));
new AutomationList(Evoral::Parameter(GainAutomation)));
_gain_control = boost::shared_ptr<GainControl>(
new GainControl(X_("gaincontrol"), *this, gl));
@ -1411,7 +1411,7 @@ IO::set_state (const XMLNode& node)
if ((*iter)->name() == X_("Automation")) {
set_automation_state (*(*iter), Parameter(GainAutomation));
set_automation_state (*(*iter), Evoral::Parameter(GainAutomation));
}
if ((*iter)->name() == X_("controllable")) {
@ -2274,7 +2274,7 @@ IO::clear_automation ()
}
void
IO::set_parameter_automation_state (Parameter param, AutoState state)
IO::set_parameter_automation_state (Evoral::Parameter param, AutoState state)
{
// XXX: would be nice to get rid of this special hack

View file

@ -471,7 +471,7 @@ LadspaPlugin::get_parameter_descriptor (uint32_t which, ParameterDescriptor& des
}
string
LadspaPlugin::describe_parameter (Parameter which)
LadspaPlugin::describe_parameter (Evoral::Parameter which)
{
if (which.type() == PluginAutomation && which.id() < parameter_count()) {
return port_names()[which.id()];
@ -494,16 +494,16 @@ LadspaPlugin::signal_latency () const
}
}
set<Parameter>
set<Evoral::Parameter>
LadspaPlugin::automatable () const
{
set<Parameter> ret;
set<Evoral::Parameter> ret;
for (uint32_t i = 0; i < parameter_count(); ++i){
if (LADSPA_IS_PORT_INPUT(port_descriptor (i)) &&
LADSPA_IS_PORT_CONTROL(port_descriptor (i))){
ret.insert (ret.end(), Parameter(PluginAutomation, i));
ret.insert (ret.end(), Evoral::Parameter(PluginAutomation, i));
}
}

View file

@ -360,7 +360,7 @@ LV2Plugin::get_parameter_descriptor (uint32_t which, ParameterDescriptor& desc)
string
LV2Plugin::describe_parameter (Parameter which)
LV2Plugin::describe_parameter (Evoral::Parameter which)
{
if (which.type() == PluginAutomation && which.id() < parameter_count()) {
SLV2Value name = slv2_port_get_name(_plugin,
@ -383,14 +383,14 @@ LV2Plugin::signal_latency () const
}
}
set<Parameter>
set<Evoral::Parameter>
LV2Plugin::automatable () const
{
set<Parameter> ret;
set<Evoral::Parameter> ret;
for (uint32_t i = 0; i < parameter_count(); ++i){
if (parameter_is_input(i) && parameter_is_control(i)) {
ret.insert (ret.end(), Parameter(PluginAutomation, i));
ret.insert (ret.end(), Evoral::Parameter(PluginAutomation, i));
}
}

View file

@ -265,7 +265,7 @@ MidiPlaylist::destroy_region (boost::shared_ptr<Region> region)
return changed;
}
set<Parameter>
set<Evoral::Parameter>
MidiPlaylist::contained_automation()
{
/* this function is never called from a realtime thread, so
@ -274,7 +274,7 @@ MidiPlaylist::contained_automation()
Glib::Mutex::Lock rm (region_lock);
set<Parameter> ret;
set<Evoral::Parameter> ret;
for (RegionList::const_iterator r = regions.begin(); r != regions.end(); ++r) {
boost::shared_ptr<MidiRegion> mr = boost::dynamic_pointer_cast<MidiRegion>(*r);

View file

@ -69,7 +69,7 @@ static double direct_pan_to_control (pan_t val) {
return val;
}
StreamPanner::StreamPanner (Panner& p, Parameter param)
StreamPanner::StreamPanner (Panner& p, Evoral::Parameter param)
: parent (p)
, _control (new PanControllable(p.session(), X_("panner"), *this, param))
{
@ -179,7 +179,7 @@ StreamPanner::add_state (XMLNode& node)
/*---------------------------------------------------------------------- */
BaseStereoPanner::BaseStereoPanner (Panner& p, Parameter param)
BaseStereoPanner::BaseStereoPanner (Panner& p, Evoral::Parameter param)
: StreamPanner (p, param)
{
}
@ -336,7 +336,7 @@ BaseStereoPanner::distribute (AudioBuffer& srcbuf, BufferSet& obufs, gain_t gain
/*---------------------------------------------------------------------- */
EqualPowerStereoPanner::EqualPowerStereoPanner (Panner& p, Parameter param)
EqualPowerStereoPanner::EqualPowerStereoPanner (Panner& p, Evoral::Parameter param)
: BaseStereoPanner (p, param)
{
update ();
@ -451,7 +451,7 @@ EqualPowerStereoPanner::distribute_automated (AudioBuffer& srcbuf, BufferSet& ob
}
StreamPanner*
EqualPowerStereoPanner::factory (Panner& parent, Parameter param)
EqualPowerStereoPanner::factory (Panner& parent, Evoral::Parameter param)
{
return new EqualPowerStereoPanner (parent, param);
}
@ -520,7 +520,7 @@ EqualPowerStereoPanner::set_state (const XMLNode& node)
/*----------------------------------------------------------------------*/
Multi2dPanner::Multi2dPanner (Panner& p, Parameter param)
Multi2dPanner::Multi2dPanner (Panner& p, Evoral::Parameter param)
: StreamPanner (p, param)
{
update ();
@ -638,7 +638,7 @@ Multi2dPanner::distribute_automated (AudioBuffer& src, BufferSet& obufs,
}
StreamPanner*
Multi2dPanner::factory (Panner& p, Parameter param)
Multi2dPanner::factory (Panner& p, Evoral::Parameter param)
{
return new Multi2dPanner (p, param);
}
@ -788,7 +788,7 @@ Panner::reset (uint32_t nouts, uint32_t npans)
outputs.push_back (Output (1.0, 0));
for (n = 0; n < npans; ++n) {
push_back (new EqualPowerStereoPanner (*this, Parameter(PanAutomation, n)));
push_back (new EqualPowerStereoPanner (*this, Evoral::Parameter(PanAutomation, n)));
}
break;
@ -798,7 +798,7 @@ Panner::reset (uint32_t nouts, uint32_t npans)
outputs.push_back (Output (1.0, 1.0));
for (n = 0; n < npans; ++n) {
push_back (new Multi2dPanner (*this, Parameter(PanAutomation, n)));
push_back (new Multi2dPanner (*this, Evoral::Parameter(PanAutomation, n)));
}
break;
@ -810,7 +810,7 @@ Panner::reset (uint32_t nouts, uint32_t npans)
outputs.push_back (Output (0, 1.0));
for (n = 0; n < npans; ++n) {
push_back (new Multi2dPanner (*this, Parameter(PanAutomation, n)));
push_back (new Multi2dPanner (*this, Evoral::Parameter(PanAutomation, n)));
}
break;
@ -823,7 +823,7 @@ Panner::reset (uint32_t nouts, uint32_t npans)
outputs.push_back (Output (0.5, 0.75));
for (n = 0; n < npans; ++n) {
push_back (new Multi2dPanner (*this, Parameter(PanAutomation, n)));
push_back (new Multi2dPanner (*this, Evoral::Parameter(PanAutomation, n)));
}
break;
@ -835,7 +835,7 @@ Panner::reset (uint32_t nouts, uint32_t npans)
}
for (n = 0; n < npans; ++n) {
push_back (new Multi2dPanner (*this, Parameter(PanAutomation, n)));
push_back (new Multi2dPanner (*this, Evoral::Parameter(PanAutomation, n)));
}
break;
@ -969,7 +969,7 @@ Panner::clear_automation ()
struct PanPlugins {
string name;
uint32_t nouts;
StreamPanner* (*factory)(Panner&, Parameter);
StreamPanner* (*factory)(Panner&, Evoral::Parameter);
};
PanPlugins pan_plugins[] = {
@ -1071,7 +1071,7 @@ Panner::set_state (const XMLNode& node)
assumption, but its still an assumption.
*/
sp = pan_plugins[i].factory (*this, Parameter(PanAutomation, 0));
sp = pan_plugins[i].factory (*this, Evoral::Parameter(PanAutomation, 0));
if (sp->set_state (**niter) == 0) {
push_back (sp);

View file

@ -1,121 +0,0 @@
/*
Copyright (C) 2008 Paul Davis
Written by Dave Robillard
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 <ardour/parameter.h>
using namespace ARDOUR;
/** Construct an Parameter from a string returned from Parameter::to_string
* (AutomationList automation-id property)
*/
Parameter::Parameter(const std::string& str)
: Evoral::Parameter (NullAutomation, 0)
{
if (str == "gain") {
_type = GainAutomation;
} else if (str == "solo") {
_type = SoloAutomation;
} else if (str == "mute") {
_type = MuteAutomation;
} else if (str == "fadein") {
_type = FadeInAutomation;
} else if (str == "fadeout") {
_type = FadeOutAutomation;
} else if (str == "envelope") {
_type = EnvelopeAutomation;
} else if (str == "pan") {
_type = PanAutomation;
} else if (str.length() > 4 && str.substr(0, 4) == "pan-") {
_type = PanAutomation;
_id = atoi(str.c_str()+4);
} else if (str.length() > 10 && str.substr(0, 10) == "parameter-") {
_type = PluginAutomation;
_id = atoi(str.c_str()+10);
} else if (str.length() > 7 && str.substr(0, 7) == "midicc-") {
_type = MidiCCAutomation;
uint32_t channel = 0;
sscanf(str.c_str(), "midicc-%d-%d", &channel, &_id);
assert(channel < 16);
_channel = channel;
} else if (str.length() > 16 && str.substr(0, 16) == "midi-pgm-change-") {
_type = MidiPgmChangeAutomation;
uint32_t channel = 0;
sscanf(str.c_str(), "midi-pgm-change-%d", &channel);
assert(channel < 16);
_id = 0;
_channel = channel;
} else if (str.length() > 18 && str.substr(0, 18) == "midi-pitch-bender-") {
_type = MidiPitchBenderAutomation;
uint32_t channel = 0;
sscanf(str.c_str(), "midi-pitch-bender-%d", &channel);
assert(channel < 16);
_id = 0;
_channel = channel;
} else if (str.length() > 24 && str.substr(0, 24) == "midi-channel-pressure-") {
_type = MidiChannelPressureAutomation;
uint32_t channel = 0;
sscanf(str.c_str(), "midi-channel-pressure-%d", &channel);
assert(channel < 16);
_id = 0;
_channel = channel;
} else {
PBD::warning << "Unknown Parameter '" << str << "'" << endmsg;
}
init_metadata((AutomationType)_type); // set min/max/normal
}
/** Unique string representation, suitable as an XML property value.
* e.g. <AutomationList automation-id="whatthisreturns">
*/
std::string
Parameter::symbol() const
{
if (_type == GainAutomation) {
return "gain";
} else if (_type == PanAutomation) {
return string_compose("pan-%1", _id);
} else if (_type == SoloAutomation) {
return "solo";
} else if (_type == MuteAutomation) {
return "mute";
} else if (_type == FadeInAutomation) {
return "fadein";
} else if (_type == FadeOutAutomation) {
return "fadeout";
} else if (_type == EnvelopeAutomation) {
return "envelope";
} else if (_type == PluginAutomation) {
return string_compose("parameter-%1", _id);
} else if (_type == MidiCCAutomation) {
return string_compose("midicc-%1-%2", int(_channel), _id);
} else if (_type == MidiPgmChangeAutomation) {
return string_compose("midi-pgm-change-%1", int(_channel));
} else if (_type == MidiPitchBenderAutomation) {
return string_compose("midi-pitch-bender-%1", int(_channel));
} else if (_type == MidiChannelPressureAutomation) {
return string_compose("midi-channel-pressure-%1", int(_channel));
} else {
PBD::warning << "Uninitialized Parameter symbol() called." << endmsg;
return "";
}
}

View file

@ -147,7 +147,7 @@ PluginInsert::~PluginInsert ()
}
void
PluginInsert::auto_state_changed (Parameter which)
PluginInsert::auto_state_changed (Evoral::Parameter which)
{
if (which.type() != PluginAutomation)
return;
@ -218,15 +218,15 @@ PluginInsert::is_generator() const
void
PluginInsert::set_automatable ()
{
set<Parameter> a = _plugins.front()->automatable ();
set<Evoral::Parameter> a = _plugins.front()->automatable ();
Plugin::ParameterDescriptor desc;
for (set<Parameter>::iterator i = a.begin(); i != a.end(); ++i) {
for (set<Evoral::Parameter>::iterator i = a.begin(); i != a.end(); ++i) {
if (i->type() == PluginAutomation) {
can_automate (*i);
_plugins.front()->get_parameter_descriptor(i->id(), desc);
Parameter param(*i);
Evoral::Parameter param(*i);
param.set_range(desc.lower, desc.upper, _plugins.front()->default_value(i->id()));
boost::shared_ptr<AutomationList> list(new AutomationList(param));
add_control(boost::shared_ptr<AutomationControl>(new PluginControl(this, *i, list)));
@ -235,7 +235,7 @@ PluginInsert::set_automatable ()
}
void
PluginInsert::parameter_changed (Parameter which, float val)
PluginInsert::parameter_changed (Evoral::Parameter which, float val)
{
if (which.type() != PluginAutomation)
return;
@ -359,7 +359,7 @@ PluginInsert::run_in_place (BufferSet& bufs, nframes_t start_frame, nframes_t en
}
void
PluginInsert::set_parameter (Parameter param, float val)
PluginInsert::set_parameter (Evoral::Parameter param, float val)
{
if (param.type() != PluginAutomation)
return;
@ -375,14 +375,14 @@ PluginInsert::set_parameter (Parameter param, float val)
ac->set_value(val);
} else {
warning << "set_parameter called for nonexistant parameter "
<< param.symbol() << endmsg;
<< EventTypeMap::instance().to_symbol(param) << endmsg;
}
_session.set_dirty();
}
float
PluginInsert::get_parameter (Parameter param)
PluginInsert::get_parameter (Evoral::Parameter param)
{
if (param.type() != PluginAutomation)
return 0.0;
@ -394,7 +394,7 @@ PluginInsert::get_parameter (Parameter param)
void
PluginInsert::automation_run (BufferSet& bufs, nframes_t nframes, nframes_t offset)
{
ControlEvent next_event (0, 0.0f);
Evoral::ControlEvent next_event (0, 0.0f);
nframes_t now = _session.transport_frame ();
nframes_t end = now + nframes;
@ -631,9 +631,9 @@ PluginInsert::state (bool full)
/* add port automation state */
XMLNode *autonode = new XMLNode(port_automation_node_name);
set<Parameter> automatable = _plugins[0]->automatable();
set<Evoral::Parameter> automatable = _plugins[0]->automatable();
for (set<Parameter>::iterator x = automatable.begin(); x != automatable.end(); ++x) {
for (set<Evoral::Parameter>::iterator x = automatable.begin(); x != automatable.end(); ++x) {
/*XMLNode* child = new XMLNode("port");
snprintf(buf, sizeof(buf), "%" PRIu32, *x);
@ -766,7 +766,7 @@ PluginInsert::set_state(const XMLNode& node)
}
boost::shared_ptr<AutomationControl> c = boost::dynamic_pointer_cast<AutomationControl>(
data().control(Parameter(PluginAutomation, port_id), true));
data().control(Evoral::Parameter(PluginAutomation, port_id), true));
if (!child->children().empty()) {
c->alist()->set_state (*child->children().front());
@ -805,7 +805,7 @@ PluginInsert::set_state(const XMLNode& node)
}
string
PluginInsert::describe_parameter (Parameter param)
PluginInsert::describe_parameter (Evoral::Parameter param)
{
if (param.type() != PluginAutomation)
return Automatable::describe_parameter(param);
@ -852,7 +852,7 @@ PluginInsert::type ()
}
}
PluginInsert::PluginControl::PluginControl (PluginInsert* p, const Parameter &param, boost::shared_ptr<AutomationList> list)
PluginInsert::PluginControl::PluginControl (PluginInsert* p, const Evoral::Parameter &param, boost::shared_ptr<AutomationList> list)
: AutomationControl (p->session(), param, list, p->describe_parameter(param))
, _plugin (p)
{

View file

@ -158,7 +158,7 @@ Processor::state (bool full_state)
XMLNode& automation = Automatable::get_automation_state();
for (set<Parameter>::iterator x = _visible_controls.begin(); x != _visible_controls.end(); ++x) {
for (set<Evoral::Parameter>::iterator x = _visible_controls.begin(); x != _visible_controls.end(); ++x) {
if (x != _visible_controls.begin()) {
sstr << ' ';
}
@ -198,7 +198,7 @@ Processor::set_state (const XMLNode& node)
if ((prop = (*niter)->property ("path")) != 0) {
old_set_automation_state (*(*niter));
} else {
set_automation_state (*(*niter), Parameter(PluginAutomation));
set_automation_state (*(*niter), Evoral::Parameter(PluginAutomation));
}
if ((prop = (*niter)->property ("visible")) != 0) {
@ -214,7 +214,7 @@ Processor::set_state (const XMLNode& node)
break;
}
// FIXME: other automation types?
mark_automation_visible (Parameter(PluginAutomation, what), true);
mark_automation_visible (Evoral::Parameter(PluginAutomation, what), true);
}
}

View file

@ -103,7 +103,7 @@ Send::set_state(const XMLNode& node)
if ((*niter)->name() == "IOProcessor") {
insert_node = *niter;
} else if ((*niter)->name() == X_("Automation")) {
_io->set_automation_state (*(*niter), Parameter(GainAutomation));
_io->set_automation_state (*(*niter), Evoral::Parameter(GainAutomation));
}
}

View file

@ -40,22 +40,10 @@ namespace Evoral {
class Parameter
{
public:
Parameter(uint32_t type, uint8_t channel, uint32_t id=0)
Parameter(uint32_t type, uint8_t channel=0, uint32_t id=0)
: _type(type), _id(id), _channel(channel)
{}
Parameter(const std::string& str) {
int channel;
if (sscanf(str.c_str(), "%d_c%d_n%d", &_type, &channel, &_id) == 3) {
if (channel >= 0 && channel <= 127) {
_channel = channel;
} else {
std::cerr << "WARNING: Channel out of range: " << channel << std::endl;
}
}
std::cerr << "WARNING: Unable to create parameter from string: " << str << std::endl;
}
virtual ~Parameter() {}
inline uint32_t type() const { return _type; }
@ -113,10 +101,6 @@ public:
inline operator bool() const { return (_type != 0); }
virtual std::string symbol() const {
return (boost::format("%1%_c%2%_n%3%") % _type % (int)_channel % _id).str();
}
/** Not used in indentity/comparison */
struct Metadata {
Metadata(double low=0.0, double high=1.0, double mid=0.0)

View file

@ -47,7 +47,12 @@ public:
virtual uint32_t midi_event_type(uint8_t status) const = 0;
/** Return true iff parameter should be locked to integer boundaries */
bool is_integer(const Evoral::Parameter& param) const;
virtual bool is_integer(const Evoral::Parameter& param) const = 0;
/** Create a parameter with the given type ID */
virtual Parameter new_parameter(uint32_t type, uint8_t channel, uint32_t id) const = 0;
virtual std::string to_symbol(const Parameter& param) const = 0;
};
} // namespace Evoral

View file

@ -18,8 +18,8 @@
*
*/
#ifndef RAUL_MIDI_EVENTS_H
#define RAUL_MIDI_EVENTS_H
#ifndef EVORAL_MIDI_EVENTS_H
#define EVORAL_MIDI_EVENTS_H
/**
@ -130,4 +130,4 @@
/** \} */
#endif /* RAUL_MIDI_EVENTS_H */
#endif /* EVORAL_MIDI_EVENTS_H */

View file

@ -92,7 +92,7 @@ Sequence::const_iterator::const_iterator(const Sequence& seq, EventTime t)
// find the earliest control event available
for (Controls::const_iterator i = seq._controls.begin(); i != seq._controls.end(); ++i) {
debugout << "Iterator: control: " << i->first.symbol() << endl;
debugout << "Iterator: control: " << seq._type_map.to_symbol(i->first) << endl;
double x, y;
bool ret = i->second->list()->rt_safe_earliest_event_unlocked(t, DBL_MAX, x, y);
if (!ret) {
@ -628,7 +628,7 @@ Sequence::append_note_off_unlocked(uint8_t chan, EventTime time, uint8_t note_nu
void
Sequence::append_control_unlocked(const Parameter& param, EventTime time, double value)
{
debugout << this << " " << param.symbol() << " @ " << time << " \t= \t" << value
debugout << this << " " << _type_map.to_symbol(param) << " @ " << time << " \t= \t" << value
<< " # controls: " << _controls.size() << endl;
control(param, true)->list()->rt_add(time, value);
}