diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2009-12-30 16:48:58 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2009-12-30 16:48:58 +0000 |
commit | 74933f58659051f6d4ef52d1103b2b7ba4643883 (patch) | |
tree | 93069fda3163dce2e97b61a845863b68b300200d /libs/ardour | |
parent | 8a17b0fb9073bb21ef2c718113f9e41359faf4fe (diff) |
restore excess calls to sync-order stuff (for now); allow MIDI controllers to use the same non-linear fader response as the gui; add various flags to PBD::Controllable and remove URI from that class
git-svn-id: svn://localhost/ardour2/branches/3.0@6414 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour')
-rw-r--r-- | libs/ardour/ardour/amp.h | 5 | ||||
-rw-r--r-- | libs/ardour/ardour/route.h | 2 | ||||
-rw-r--r-- | libs/ardour/ardour/utils.h | 16 | ||||
-rw-r--r-- | libs/ardour/automation_control.cc | 2 | ||||
-rw-r--r-- | libs/ardour/enums.cc | 6 | ||||
-rw-r--r-- | libs/ardour/route.cc | 6 | ||||
-rw-r--r-- | libs/ardour/session.cc | 25 | ||||
-rw-r--r-- | libs/ardour/track.cc | 2 |
8 files changed, 47 insertions, 17 deletions
diff --git a/libs/ardour/ardour/amp.h b/libs/ardour/ardour/amp.h index c237479abd..54bd9defe2 100644 --- a/libs/ardour/ardour/amp.h +++ b/libs/ardour/ardour/amp.h @@ -73,8 +73,9 @@ public: GainControl (std::string name, Session& session, Amp* a, const Evoral::Parameter ¶m, boost::shared_ptr<AutomationList> al = boost::shared_ptr<AutomationList>() ) : AutomationControl (session, param, al, name) - , _amp (a) - {} + , _amp (a) { + set_flags (Controllable::Flag (flags() | Controllable::GainLike)); + } void set_value (float val); float get_value (void) const; diff --git a/libs/ardour/ardour/route.h b/libs/ardour/ardour/route.h index bb02396773..ac945703fd 100644 --- a/libs/ardour/ardour/route.h +++ b/libs/ardour/ardour/route.h @@ -304,7 +304,7 @@ class Route : public SessionObject, public AutomatableControls, public RouteGrou void automation_snapshot (nframes_t now, bool force=false); void protect_automation (); - void set_remote_control_id (uint32_t id); + void set_remote_control_id (uint32_t id, bool notify_class_listeners = true); uint32_t remote_control_id () const; /* for things concerned about *this* route's RID */ diff --git a/libs/ardour/ardour/utils.h b/libs/ardour/ardour/utils.h index 6c6f754cf9..e68f7a01df 100644 --- a/libs/ardour/ardour/utils.h +++ b/libs/ardour/ardour/utils.h @@ -69,6 +69,22 @@ const char* edit_mode_to_string (ARDOUR::EditMode); ARDOUR::EditMode string_to_edit_mode (std::string); +static inline double +gain_to_slider_position (ARDOUR::gain_t g) +{ + if (g == 0) return 0; + return pow((6.0*log(g)/log(2.0)+192.0)/198.0, 8.0); + +} + +static inline ARDOUR::gain_t +slider_position_to_gain (double pos) +{ + /* XXX Marcus writes: this doesn't seem right to me. but i don't have a better answer ... */ + if (pos == 0.0) return 0; + return pow (2.0,(sqrt(sqrt(sqrt(pos)))*198.0-192.0)/6.0); +} + /* I don't really like hard-coding these falloff rates here * Probably should use a map of some kind that could be configured * These rates are db/sec. diff --git a/libs/ardour/automation_control.cc b/libs/ardour/automation_control.cc index cad3ef57e8..1460c42c7b 100644 --- a/libs/ardour/automation_control.cc +++ b/libs/ardour/automation_control.cc @@ -34,7 +34,7 @@ AutomationControl::AutomationControl( const Evoral::Parameter& parameter, boost::shared_ptr<ARDOUR::AutomationList> list, const string& name) - : Controllable((name != "") ? name : EventTypeMap::instance().to_symbol(parameter), string("") /* XXX missing URI */) + : Controllable((name != "") ? name : EventTypeMap::instance().to_symbol(parameter)) , Evoral::Control(parameter, list) , _session(session) { diff --git a/libs/ardour/enums.cc b/libs/ardour/enums.cc index be61b2acb2..7d07a5a95f 100644 --- a/libs/ardour/enums.cc +++ b/libs/ardour/enums.cc @@ -48,7 +48,7 @@ namespace ARDOUR { void setup_enum_writer () { - EnumWriter* enum_writer = new EnumWriter(); + EnumWriter& enum_writer (EnumWriter::instance()); vector<int> i; vector<string> s; @@ -122,8 +122,8 @@ setup_enum_writer () Session::SlaveState _Session_SlaveState; MTC_Status _MIDI_MTC_Status; -#define REGISTER(e) enum_writer->register_distinct (typeid(e).name(), i, s); i.clear(); s.clear() -#define REGISTER_BITS(e) enum_writer->register_bits (typeid(e).name(), i, s); i.clear(); s.clear() +#define REGISTER(e) enum_writer.register_distinct (typeid(e).name(), i, s); i.clear(); s.clear() +#define REGISTER_BITS(e) enum_writer.register_bits (typeid(e).name(), i, s); i.clear(); s.clear() #define REGISTER_ENUM(e) i.push_back (e); s.push_back (#e) #define REGISTER_CLASS_ENUM(t,e) i.push_back (t::e); s.push_back (#e) diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index 9c08080d2d..c5d26f7b7c 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -174,12 +174,14 @@ Route::~Route () } void -Route::set_remote_control_id (uint32_t id) +Route::set_remote_control_id (uint32_t id, bool notify_class_listeners) { if (id != _remote_control_id) { _remote_control_id = id; RemoteControlIDChanged (); - RemoteControlIDChange (); + if (notify_class_listeners) { + RemoteControlIDChange (); + } } } diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 1f61322b4b..31693daff3 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -1863,20 +1863,27 @@ void Session::set_remote_control_ids () { RemoteModel m = Config->get_remote_model(); + bool emit_signal = false; shared_ptr<RouteList> r = routes.reader (); for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { - if ( MixerOrdered == m) { + if (MixerOrdered == m) { long order = (*i)->order_key(N_("signal")); - (*i)->set_remote_control_id( order+1 ); - } else if ( EditorOrdered == m) { + (*i)->set_remote_control_id (order+1, false); + emit_signal = true; + } else if (EditorOrdered == m) { long order = (*i)->order_key(N_("editor")); - (*i)->set_remote_control_id( order+1 ); - } else if ( UserOrdered == m) { + (*i)->set_remote_control_id (order+1, false); + emit_signal = true; + } else if (UserOrdered == m) { //do nothing ... only changes to remote id's are initiated by user } } + + if (emit_signal) { + Route::RemoteControlIDChange(); + } } @@ -2373,6 +2380,8 @@ Session::remove_route (shared_ptr<Route> route) sync_order_keys (N_("session")); + Route::RemoteControlIDChange(); /* EMIT SIGNAL */ + /* save the new state of the world */ if (save_state (_current_snapshot_name)) { @@ -4184,9 +4193,11 @@ Session::sync_order_keys (std::string const & base) } Route::SyncOrderKeys (base); // EMIT SIGNAL - Route::RemoteControlIDChange (); // EMIT SIGNAL -} + /* this might not do anything */ + + set_remote_control_ids (); +} /** @return true if there is at least one record-enabled diskstream, otherwise false */ bool diff --git a/libs/ardour/track.cc b/libs/ardour/track.cc index 7d19d23007..f286e07c25 100644 --- a/libs/ardour/track.cc +++ b/libs/ardour/track.cc @@ -124,7 +124,7 @@ Track::freeze_state() const } Track::RecEnableControllable::RecEnableControllable (Track& s) - : Controllable (X_("recenable"), string() /* XXX missing URI */), track (s) + : Controllable (X_("recenable")), track (s) { } |