From b5ec66ae6cb60fa43c343d3d29340b2370d0b9d1 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 29 Sep 2008 22:47:40 +0000 Subject: 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 --- libs/ardour/ardour/automatable.h | 27 ++++----- libs/ardour/ardour/automation_control.h | 3 +- libs/ardour/ardour/automation_list.h | 7 +-- libs/ardour/ardour/event_type_map.h | 9 ++- libs/ardour/ardour/io.h | 2 +- libs/ardour/ardour/ladspa_plugin.h | 4 +- libs/ardour/ardour/lv2_plugin.h | 4 +- libs/ardour/ardour/midi_playlist.h | 4 +- libs/ardour/ardour/midi_track.h | 2 +- libs/ardour/ardour/panner.h | 14 ++--- libs/ardour/ardour/parameter.h | 103 -------------------------------- libs/ardour/ardour/plugin.h | 5 +- libs/ardour/ardour/plugin_insert.h | 12 ++-- 13 files changed, 47 insertions(+), 149 deletions(-) delete mode 100644 libs/ardour/ardour/parameter.h (limited to 'libs/ardour/ardour') diff --git a/libs/ardour/ardour/automatable.h b/libs/ardour/ardour/automatable.h index dbce7de0bf..8cfadec638 100644 --- a/libs/ardour/ardour/automatable.h +++ b/libs/ardour/ardour/automatable.h @@ -26,7 +26,6 @@ #include #include #include -#include #include #include #include @@ -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&) const; - const std::set& what_can_be_automated() const { return _can_automate_list; } + void what_has_visible_data(std::set&) const; + const std::set& 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 _visible_controls; - std::set _can_automate_list; + std::set _visible_controls; + std::set _can_automate_list; nframes_t _last_automation_snapshot; static nframes_t _automation_interval; diff --git a/libs/ardour/ardour/automation_control.h b/libs/ardour/ardour/automation_control.h index 7878077a98..db481b2f99 100644 --- a/libs/ardour/ardour/automation_control.h +++ b/libs/ardour/ardour/automation_control.h @@ -23,7 +23,6 @@ #include #include -#include #include #include @@ -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 l=boost::shared_ptr(), const string& name=""); diff --git a/libs/ardour/ardour/automation_list.h b/libs/ardour/ardour/automation_list.h index cae8d3cbba..d5aff74ab9 100644 --- a/libs/ardour/ardour/automation_list.h +++ b/libs/ardour/ardour/automation_list.h @@ -32,19 +32,16 @@ #include #include -#include #include -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 create(Evoral::Parameter id); diff --git a/libs/ardour/ardour/event_type_map.h b/libs/ardour/ardour/event_type_map.h index 4d7180c028..99911121c5 100644 --- a/libs/ardour/ardour/event_type_map.h +++ b/libs/ardour/ardour/event_type_map.h @@ -21,17 +21,24 @@ #ifndef __ardour_event_type_map_h__ #define __ardour_event_type_map_h__ +#include #include 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; } diff --git a/libs/ardour/ardour/io.h b/libs/ardour/ardour/io.h index 521efbafb4..34ffad94ce 100644 --- a/libs/ardour/ardour/io.h +++ b/libs/ardour/ardour/io.h @@ -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); diff --git a/libs/ardour/ardour/ladspa_plugin.h b/libs/ardour/ardour/ladspa_plugin.h index b26e4120b1..1e7a53a65a 100644 --- a/libs/ardour/ardour/ladspa_plugin.h +++ b/libs/ardour/ardour/ladspa_plugin.h @@ -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 automatable() const; + std::set 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; diff --git a/libs/ardour/ardour/lv2_plugin.h b/libs/ardour/ardour/lv2_plugin.h index b3711c5588..978e52b446 100644 --- a/libs/ardour/ardour/lv2_plugin.h +++ b/libs/ardour/ardour/lv2_plugin.h @@ -68,7 +68,7 @@ class LV2Plugin : public ARDOUR::Plugin const LV2_Feature* const* features() { return _features; } - std::set automatable() const; + std::set 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; diff --git a/libs/ardour/ardour/midi_playlist.h b/libs/ardour/ardour/midi_playlist.h index dcc202bbf4..697d80611b 100644 --- a/libs/ardour/ardour/midi_playlist.h +++ b/libs/ardour/ardour/midi_playlist.h @@ -25,7 +25,7 @@ #include #include -#include +#include namespace ARDOUR { @@ -57,7 +57,7 @@ public: void set_note_mode (NoteMode m) { _note_mode = m; } - std::set contained_automation(); + std::set contained_automation(); protected: diff --git a/libs/ardour/ardour/midi_track.h b/libs/ardour/ardour/midi_track.h index 02313c7e6e..56f73fbe9d 100644 --- a/libs/ardour/ardour/midi_track.h +++ b/libs/ardour/ardour/midi_track.h @@ -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 al = boost::shared_ptr()) : AutomationControl (route->session(), param, al) , _route (route) diff --git a/libs/ardour/ardour/panner.h b/libs/ardour/ardour/panner.h index 6cd3b0755d..7b4f2d1039 100644 --- a/libs/ardour/ardour/panner.h +++ b/libs/ardour/ardour/panner.h @@ -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(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); diff --git a/libs/ardour/ardour/parameter.h b/libs/ardour/ardour/parameter.h deleted file mode 100644 index a9aa051924..0000000000 --- a/libs/ardour/ardour/parameter.h +++ /dev/null @@ -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 -#include -#include -#include -#include -#include - -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__ - diff --git a/libs/ardour/ardour/plugin.h b/libs/ardour/ardour/plugin.h index fec044e885..bb81776d53 100644 --- a/libs/ardour/ardour/plugin.h +++ b/libs/ardour/ardour/plugin.h @@ -32,7 +32,6 @@ #include #include #include -#include #include #include @@ -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 automatable() const = 0; - virtual string describe_parameter (Parameter) = 0; + virtual std::set 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; diff --git a/libs/ardour/ardour/plugin_insert.h b/libs/ardour/ardour/plugin_insert.h index 28c7718971..25a9e52e88 100644 --- a/libs/ardour/ardour/plugin_insert.h +++ b/libs/ardour/ardour/plugin_insert.h @@ -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 ¶m, + PluginControl (PluginInsert* p, const Evoral::Parameter ¶m, boost::shared_ptr list = boost::shared_ptr()); 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 > _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; -- cgit v1.2.3