#define __ardour_panner_h__
#include <cmath>
+#include <cassert>
#include <vector>
#include <string>
#include <iostream>
#include <ardour/types.h>
#include <ardour/curve.h>
+#include <ardour/automation_control.h>
using std::istream;
using std::ostream;
class BufferSet;
class AudioBuffer;
-class StreamPanner : public sigc::trackable, public Stateful
+class StreamPanner : public sigc::trackable, public PBD::Stateful
{
public:
- StreamPanner (Panner& p);
+ StreamPanner (Panner& p, ParamID param);
~StreamPanner ();
void set_muted (bool yn);
virtual void distribute_automated (AudioBuffer& src, BufferSet& obufs,
nframes_t start, nframes_t end, nframes_t nframes, pan_t** buffers) = 0;
- /* automation */
-
- virtual void snapshot (nframes_t now) = 0;
- virtual void transport_stopped (nframes_t frame) = 0;
- virtual void set_automation_state (AutoState) = 0;
- virtual void set_automation_style (AutoStyle) = 0;
-
- PBD::Controllable& control() { return _control; }
+ boost::shared_ptr<AutomationControl> pan_control() { return _control; }
- /* XXX this is wrong. for multi-dimensional panners, there
- must surely be more than 1 automation curve.
- */
-
- virtual Curve& automation() = 0;
-
sigc::signal<void> Changed; /* for position */
sigc::signal<void> StateChanged; /* for mute */
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;
bool _muted;
- struct PanControllable : public PBD::Controllable {
- PanControllable (std::string name, StreamPanner& p) : Controllable (name), panner (p) {}
+ struct PanControllable : public AutomationControl {
+ PanControllable (Session& s, std::string name, StreamPanner& p, ParamID param)
+ : AutomationControl (s, boost::shared_ptr<AutomationList>(new AutomationList(
+ param, 0.0, 1.0, 0.5)), name)
+ , panner (p) { assert(param.type() != NullAutomation); }
StreamPanner& panner;
bool can_send_feedback() const;
};
- PanControllable _control;
+ boost::shared_ptr<PanControllable> _control;
void add_state (XMLNode&);
virtual void update () = 0;
class BaseStereoPanner : public StreamPanner
{
public:
- BaseStereoPanner (Panner&);
+ BaseStereoPanner (Panner&, ParamID param);
~BaseStereoPanner ();
/* this class just leaves the pan law itself to be defined
void distribute (AudioBuffer& src, BufferSet& obufs, gain_t gain_coeff, nframes_t nframes);
- void snapshot (nframes_t now);
- void transport_stopped (nframes_t frame);
- void set_automation_state (AutoState);
- void set_automation_style (AutoStyle);
-
- Curve& automation() { return _automation; }
-
/* old school automation loading */
int load (istream&, string path, uint32_t&);
float desired_right;
float left_interp;
float right_interp;
-
- Curve _automation;
};
class EqualPowerStereoPanner : public BaseStereoPanner
{
public:
- EqualPowerStereoPanner (Panner&);
+ EqualPowerStereoPanner (Panner&, ParamID param);
~EqualPowerStereoPanner ();
void distribute_automated (AudioBuffer& src, BufferSet& obufs,
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);
class Multi2dPanner : public StreamPanner
{
public:
- Multi2dPanner (Panner& parent);
+ Multi2dPanner (Panner& parent, ParamID);
~Multi2dPanner ();
- void snapshot (nframes_t now);
- void transport_stopped (nframes_t frame);
- void set_automation_state (AutoState);
- void set_automation_style (AutoStyle);
-
- /* XXX this is wrong. for multi-dimensional panners, there
- must surely be more than 1 automation curve.
- */
-
- Curve& automation() { return _automation; }
-
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);
int load (istream&, string path, uint32_t&);
private:
- Curve _automation;
void update ();
};
-class Panner : public std::vector<StreamPanner*>, public Stateful, public sigc::trackable
+class Panner : public std::vector<StreamPanner*>, public PBD::Stateful, public sigc::trackable
{
public:
struct Output {