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