diff options
author | David Robillard <d@drobilla.net> | 2007-06-30 22:08:39 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2007-06-30 22:08:39 +0000 |
commit | ef0b9a740996c432a6a96180814d4f8d0ee16842 (patch) | |
tree | e872bbbeb9f0358e4fd8a1445088f825338840ad /libs | |
parent | bbf41757133a29df0d37905f2fdce091878d2ffd (diff) |
Pan automation work. Almost, but not quite, working.
git-svn-id: svn://localhost/ardour2/trunk@2093 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r-- | libs/ardour/ardour/panner.h | 14 | ||||
-rw-r--r-- | libs/ardour/ardour/param_id.h | 6 | ||||
-rw-r--r-- | libs/ardour/automatable.cc | 4 | ||||
-rw-r--r-- | libs/ardour/panner.cc | 36 |
4 files changed, 32 insertions, 28 deletions
diff --git a/libs/ardour/ardour/panner.h b/libs/ardour/ardour/panner.h index ec3cb59b9b..a6cfc9a6c1 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); + StreamPanner (Panner& p, ParamID param); ~StreamPanner (); void set_muted (bool yn); @@ -79,7 +79,7 @@ class StreamPanner : public sigc::trackable, public PBD::Stateful virtual XMLNode& state (bool full_state) = 0; Panner & get_parent() { return parent; } - + /* old school automation loading */ virtual int load (istream&, string path, uint32_t&) = 0; @@ -103,9 +103,9 @@ class StreamPanner : public sigc::trackable, public PBD::Stateful bool _muted; struct PanControllable : public AutomationControl { - PanControllable (Session& s, std::string name, StreamPanner& p) + PanControllable (Session& s, std::string name, StreamPanner& p, ParamID param) : AutomationControl (s, boost::shared_ptr<AutomationList>(new AutomationList( - ParamID(PanAutomation), 0.0, 1.0, 0.5)), name) + param, 0.0, 1.0, 0.5)), name) , panner (p) {} StreamPanner& panner; @@ -160,7 +160,7 @@ class EqualPowerStereoPanner : public BaseStereoPanner void get_current_coefficients (pan_t*) const; void get_desired_coefficients (pan_t*) const; - static StreamPanner* factory (Panner&); + static StreamPanner* factory (Panner&, ParamID param); static string name; XMLNode& state (bool full_state); @@ -174,14 +174,14 @@ class EqualPowerStereoPanner : public BaseStereoPanner class Multi2dPanner : public StreamPanner { public: - Multi2dPanner (Panner& parent); + Multi2dPanner (Panner& parent, ParamID); ~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&); + static StreamPanner* factory (Panner&, ParamID); static string name; XMLNode& state (bool full_state); diff --git a/libs/ardour/ardour/param_id.h b/libs/ardour/ardour/param_id.h index eb5563b06d..d9763d5594 100644 --- a/libs/ardour/ardour/param_id.h +++ b/libs/ardour/ardour/param_id.h @@ -70,11 +70,11 @@ public: } else if (str.length() > 10 && str.substr(0, 10) == "parameter-") { _type = PluginAutomation; _id = atoi(str.c_str()+10); - PBD::info << "Parameter: " << str << " -> " << _id << endl; + //PBD::info << "Parameter: " << str << " -> " << _id << endl; } else if (str.length() > 7 && str.substr(0, 7) == "midicc-") { _type = MidiCCAutomation; _id = atoi(str.c_str()+7); - PBD::info << "MIDI CC: " << str << " -> " << _id << endl; + //PBD::info << "MIDI CC: " << str << " -> " << _id << endl; } else { PBD::warning << "Unknown ParamID '" << str << "'" << endmsg; } @@ -103,7 +103,7 @@ public: if (_type == GainAutomation) { return "gain"; } else if (_type == PanAutomation) { - return "pan"; + return string_compose("pan-%1", _id); } else if (_type == SoloAutomation) { return "solo"; } else if (_type == MuteAutomation) { diff --git a/libs/ardour/automatable.cc b/libs/ardour/automatable.cc index 8c061ad296..5b31904615 100644 --- a/libs/ardour/automatable.cc +++ b/libs/ardour/automatable.cc @@ -201,8 +201,8 @@ Automatable::describe_parameter (ParamID param) if (param == ParamID(GainAutomation)) return _("Fader"); - else if (param == ParamID(PanAutomation)) - return _("Pan"); + else if (param.type() == PanAutomation) + return (string_compose(_("Pan %1"), param.id())); else if (param.type() == MidiCCAutomation) return string_compose("CC %1", param.id()); else diff --git a/libs/ardour/panner.cc b/libs/ardour/panner.cc index e0dcf20634..a20342330f 100644 --- a/libs/ardour/panner.cc +++ b/libs/ardour/panner.cc @@ -69,9 +69,9 @@ static double direct_pan_to_control (pan_t val) { return val; } -StreamPanner::StreamPanner (Panner& p) - : parent (p), - _control (new PanControllable(p.session(), X_("panner"), *this)) +StreamPanner::StreamPanner (Panner& p, ParamID param) + : parent (p) + , _control (new PanControllable(p.session(), X_("panner"), *this, param)) { _muted = false; @@ -190,7 +190,7 @@ StreamPanner::add_state (XMLNode& node) /*---------------------------------------------------------------------- */ BaseStereoPanner::BaseStereoPanner (Panner& p) - : StreamPanner (p) + : StreamPanner (p, ParamID(PanAutomation, 0)) { } @@ -386,6 +386,7 @@ EqualPowerStereoPanner::update () desired_right = panR * (scale * panR + 1.0f - scale); effective_x = x; + _control->set_value(x); } void @@ -411,8 +412,10 @@ EqualPowerStereoPanner::distribute_automated (AudioBuffer& srcbuf, BufferSet& ob /* store effective pan position. do this even if we are muted */ - if (nframes > 0) + if (nframes > 0) { effective_x = buffers[0][nframes-1]; + _control->set_value(effective_x); // signal, update UI + } if (_muted) { return; @@ -458,7 +461,7 @@ EqualPowerStereoPanner::distribute_automated (AudioBuffer& srcbuf, BufferSet& ob } StreamPanner* -EqualPowerStereoPanner::factory (Panner& parent) +EqualPowerStereoPanner::factory (Panner& parent, ParamID who_cares) { return new EqualPowerStereoPanner (parent); } @@ -527,8 +530,8 @@ EqualPowerStereoPanner::set_state (const XMLNode& node) /*----------------------------------------------------------------------*/ -Multi2dPanner::Multi2dPanner (Panner& p) - : StreamPanner (p) +Multi2dPanner::Multi2dPanner (Panner& p, ParamID param) + : StreamPanner (p, param) { update (); } @@ -567,6 +570,7 @@ Multi2dPanner::update () } effective_x = x; + _control->set_value(x); } void @@ -644,9 +648,9 @@ Multi2dPanner::distribute_automated (AudioBuffer& src, BufferSet& obufs, } StreamPanner* -Multi2dPanner::factory (Panner& p) +Multi2dPanner::factory (Panner& p, ParamID param) { - return new Multi2dPanner (p); + return new Multi2dPanner (p, param); } int @@ -804,7 +808,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)); + push_back (new Multi2dPanner (*this, ParamID(PanAutomation, n))); } break; @@ -816,7 +820,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)); + push_back (new Multi2dPanner (*this, ParamID(PanAutomation, n))); } break; @@ -829,7 +833,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)); + push_back (new Multi2dPanner (*this, ParamID(PanAutomation, n))); } break; @@ -841,7 +845,7 @@ Panner::reset (uint32_t nouts, uint32_t npans) } for (n = 0; n < npans; ++n) { - push_back (new Multi2dPanner (*this)); + push_back (new Multi2dPanner (*this, ParamID(PanAutomation, n))); } break; @@ -975,7 +979,7 @@ Panner::clear_automation () struct PanPlugins { string name; uint32_t nouts; - StreamPanner* (*factory)(Panner&); + StreamPanner* (*factory)(Panner&, ParamID); }; PanPlugins pan_plugins[] = { @@ -1077,7 +1081,7 @@ Panner::set_state (const XMLNode& node) assumption, but its still an assumption. */ - sp = pan_plugins[i].factory (*this); + sp = pan_plugins[i].factory (*this, ParamID(PanAutomation, 0)); if (sp->set_state (**niter) == 0) { push_back (sp); |