Ardour  9.0-pre0-582-g084a23a80d
panner_balance.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016-2017 Paul Davis <paul@linuxaudiosystems.com>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18 
19 #ifndef __ardour_panner_balance_h__
20 #define __ardour_panner_balance_h__
21 
22 #include <cassert>
23 #include <cmath>
24 #include <iostream>
25 #include <string>
26 #include <vector>
27 
28 #include "pbd/cartesian.h"
29 #include "pbd/controllable.h"
30 #include "pbd/stateful.h"
31 
32 #include "ardour/automatable.h"
34 #include "ardour/panner.h"
35 #include "ardour/types.h"
36 
37 namespace ARDOUR
38 {
39 class Pannerbalance : public Panner
40 {
41 public:
42  Pannerbalance (std::shared_ptr<Pannable>);
44 
45  ChanCount in () const
46  {
47  return ChanCount (DataType::AUDIO, 2);
48  }
49  ChanCount out () const
50  {
51  return ChanCount (DataType::AUDIO, 2);
52  }
53 
54  void set_position (double);
55  bool clamp_position (double&);
56  std::pair<double, double> position_range () const;
57  double position () const;
58 
59  static Panner* factory (std::shared_ptr<Pannable>, std::shared_ptr<Speakers>);
60 
61  std::string value_as_string (std::shared_ptr<const AutomationControl>) const;
62 
63  XMLNode& get_state () const;
64 
65  void reset ();
66  void thaw ();
67 
68 protected:
69  float pos[2];
70  float desired_pos[2];
71  float pos_interp[2];
72 
73  void update ();
74 
75 private:
76  void distribute_one (AudioBuffer& srcbuf, BufferSet& obufs, gain_t gain_coeff, pframes_t nframes, uint32_t which);
78  samplepos_t start, samplepos_t end, pframes_t nframes,
79  pan_t** buffers, uint32_t which);
80 };
81 
82 } // namespace ARDOUR
83 
84 #endif /* __ardour_panner_balance_h__ */
XMLNode & get_state() const
static Panner * factory(std::shared_ptr< Pannable >, std::shared_ptr< Speakers >)
Pannerbalance(std::shared_ptr< Pannable >)
double position() const
void distribute_one(AudioBuffer &srcbuf, BufferSet &obufs, gain_t gain_coeff, pframes_t nframes, uint32_t which)
void distribute_one_automated(AudioBuffer &srcbuf, BufferSet &obufs, samplepos_t start, samplepos_t end, pframes_t nframes, pan_t **buffers, uint32_t which)
ChanCount in() const
void set_position(double)
ChanCount out() const
std::pair< double, double > position_range() const
bool clamp_position(double &)
std::string value_as_string(std::shared_ptr< const AutomationControl >) const
Definition: xml++.h:114
PBD::PropertyDescriptor< timepos_t > start
uint32_t pframes_t
Temporal::samplepos_t samplepos_t