2011-01-17 12:51:44 -05:00
|
|
|
/*
|
2019-08-03 08:34:29 -04:00
|
|
|
* Copyright (C) 2011-2017 Paul Davis <paul@linuxaudiosystems.com>
|
|
|
|
* Copyright (C) 2011 Carl Hetherington <carl@carlh.net>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
2011-01-17 12:51:44 -05:00
|
|
|
|
|
|
|
#ifndef __libardour_vbap_h__
|
|
|
|
#define __libardour_vbap_h__
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <map>
|
|
|
|
|
|
|
|
#include "pbd/cartesian.h"
|
|
|
|
|
|
|
|
#include "ardour/panner.h"
|
|
|
|
#include "ardour/panner_shell.h"
|
2011-01-26 20:31:03 -05:00
|
|
|
|
|
|
|
#include "vbap_speakers.h"
|
2011-01-17 12:51:44 -05:00
|
|
|
|
|
|
|
namespace ARDOUR {
|
|
|
|
|
|
|
|
class Speakers;
|
|
|
|
class Pannable;
|
|
|
|
|
2015-10-04 14:51:05 -04:00
|
|
|
class VBAPanner : public Panner
|
|
|
|
{
|
2011-01-17 12:51:44 -05:00
|
|
|
public:
|
2011-02-17 11:43:55 -05:00
|
|
|
VBAPanner (boost::shared_ptr<Pannable>, boost::shared_ptr<Speakers>);
|
2011-01-17 12:51:44 -05:00
|
|
|
~VBAPanner ();
|
|
|
|
|
2011-01-26 20:31:03 -05:00
|
|
|
void configure_io (ChanCount in, ChanCount /* ignored - we use Speakers */);
|
2011-01-17 12:51:44 -05:00
|
|
|
ChanCount in() const;
|
|
|
|
ChanCount out() const;
|
|
|
|
|
2011-02-17 15:15:26 -05:00
|
|
|
void set_position (double);
|
|
|
|
void set_width (double);
|
2014-01-11 16:59:25 -05:00
|
|
|
void set_elevation (double);
|
2011-02-17 15:15:26 -05:00
|
|
|
|
2011-01-26 20:31:03 -05:00
|
|
|
std::set<Evoral::Parameter> what_can_be_automated() const;
|
|
|
|
|
2011-02-17 11:43:55 -05:00
|
|
|
static Panner* factory (boost::shared_ptr<Pannable>, boost::shared_ptr<Speakers>);
|
2011-01-17 12:51:44 -05:00
|
|
|
|
2011-01-26 20:31:03 -05:00
|
|
|
void distribute (BufferSet& ibufs, BufferSet& obufs, gain_t gain_coeff, pframes_t nframes);
|
2011-01-17 12:51:44 -05:00
|
|
|
|
|
|
|
void set_azimuth_elevation (double azimuth, double elevation);
|
|
|
|
|
2011-01-26 20:31:03 -05:00
|
|
|
std::string describe_parameter (Evoral::Parameter);
|
2016-05-16 16:18:52 -04:00
|
|
|
std::string value_as_string (boost::shared_ptr<const AutomationControl>) const;
|
2011-01-26 20:31:03 -05:00
|
|
|
|
2011-01-17 12:51:44 -05:00
|
|
|
XMLNode& get_state ();
|
|
|
|
|
2011-02-17 13:54:13 -05:00
|
|
|
PBD::AngularVector signal_position (uint32_t n) const;
|
2011-02-17 14:47:53 -05:00
|
|
|
boost::shared_ptr<Speakers> get_speakers() const;
|
2011-01-17 12:51:44 -05:00
|
|
|
|
2011-10-22 12:19:27 -04:00
|
|
|
void reset ();
|
|
|
|
|
2011-01-17 12:51:44 -05:00
|
|
|
private:
|
|
|
|
struct Signal {
|
|
|
|
PBD::AngularVector direction;
|
2011-02-19 12:42:38 -05:00
|
|
|
std::vector<double> gains; /* most recently used gain for all speakers */
|
2011-01-17 12:51:44 -05:00
|
|
|
|
2011-02-19 12:42:38 -05:00
|
|
|
int outputs[3]; /* most recent set of outputs used (2 or 3, depending on dimension) */
|
|
|
|
int desired_outputs[3]; /* outputs to use the next time we distribute */
|
|
|
|
double desired_gains[3]; /* target gains for desired_outputs */
|
|
|
|
|
|
|
|
Signal (Session&, VBAPanner&, uint32_t which, uint32_t n_speakers);
|
|
|
|
void resize_gains (uint32_t n_speakers);
|
2011-01-17 12:51:44 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
std::vector<Signal*> _signals;
|
2011-02-17 11:43:55 -05:00
|
|
|
boost::shared_ptr<VBAPSpeakers> _speakers;
|
2015-10-04 14:51:05 -04:00
|
|
|
|
2011-01-17 12:51:44 -05:00
|
|
|
void compute_gains (double g[3], int ls[3], int azi, int ele);
|
2011-01-26 20:31:03 -05:00
|
|
|
void update ();
|
|
|
|
void clear_signals ();
|
2011-01-17 12:51:44 -05:00
|
|
|
|
2011-01-26 20:31:03 -05:00
|
|
|
void distribute_one (AudioBuffer& src, BufferSet& obufs, gain_t gain_coeff, pframes_t nframes, uint32_t which);
|
|
|
|
void distribute_one_automated (AudioBuffer& src, BufferSet& obufs,
|
2017-09-18 12:39:17 -04:00
|
|
|
samplepos_t start, samplepos_t end, pframes_t nframes,
|
2011-01-17 12:51:44 -05:00
|
|
|
pan_t** buffers, uint32_t which);
|
|
|
|
};
|
|
|
|
|
|
|
|
} /* namespace */
|
|
|
|
|
|
|
|
#endif /* __libardour_vbap_h__ */
|