NO-OP: re-indent, and cleanup
This commit is contained in:
parent
4339e3c729
commit
86597d7e1c
@ -23,14 +23,14 @@
|
||||
#ifndef __ardour_export_channel_h__
|
||||
#define __ardour_export_channel_h__
|
||||
|
||||
#include <set>
|
||||
#include <list>
|
||||
#include <set>
|
||||
|
||||
#include <boost/scoped_array.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#include "pbd/signals.h"
|
||||
#include "pbd/ringbuffer.h"
|
||||
#include "pbd/signals.h"
|
||||
|
||||
#include "ardour/buffer_set.h"
|
||||
#include "ardour/export_pointers.h"
|
||||
@ -46,31 +46,31 @@ class CapturingProcessor;
|
||||
/// Export channel base class interface for different source types
|
||||
class LIBARDOUR_API ExportChannel : public boost::less_than_comparable<ExportChannel>
|
||||
{
|
||||
public:
|
||||
|
||||
public:
|
||||
virtual ~ExportChannel () {}
|
||||
|
||||
virtual samplecnt_t common_port_playback_latency () const { return 0; }
|
||||
virtual void prepare_export (samplecnt_t max_samples, sampleoffset_t common_latency) { }
|
||||
virtual void prepare_export (samplecnt_t max_samples, sampleoffset_t common_latency) {}
|
||||
|
||||
virtual void read (Sample const*& data, samplecnt_t samples) const = 0;
|
||||
|
||||
virtual void read (Sample const *& data, samplecnt_t samples) const = 0;
|
||||
virtual bool empty () const = 0;
|
||||
|
||||
/// Adds state to node passed
|
||||
virtual void get_state (XMLNode * node) const = 0;
|
||||
virtual void get_state (XMLNode* node) const = 0;
|
||||
|
||||
/// Sets state from node passed
|
||||
virtual void set_state (XMLNode * node, Session & session) = 0;
|
||||
virtual void set_state (XMLNode* node, Session& session) = 0;
|
||||
|
||||
// Operator< must be defined for usage in e.g. std::map or std::set to disallow duplicates when necessary
|
||||
virtual bool operator< (ExportChannel const & other) const = 0;
|
||||
virtual bool operator< (ExportChannel const& other) const = 0;
|
||||
};
|
||||
|
||||
/// Basic export channel that reads from AudioPorts
|
||||
class LIBARDOUR_API PortExportChannel : public ExportChannel
|
||||
{
|
||||
public:
|
||||
typedef std::set<boost::weak_ptr<AudioPort> > PortSet;
|
||||
public:
|
||||
typedef std::set<boost::weak_ptr<AudioPort>> PortSet;
|
||||
|
||||
PortExportChannel ();
|
||||
~PortExportChannel ();
|
||||
@ -78,49 +78,54 @@ class LIBARDOUR_API PortExportChannel : public ExportChannel
|
||||
samplecnt_t common_port_playback_latency () const;
|
||||
void prepare_export (samplecnt_t max_samples, sampleoffset_t common_latency);
|
||||
|
||||
void read (Sample const *& data, samplecnt_t samples) const;
|
||||
bool empty () const { return ports.empty(); }
|
||||
void read (Sample const*& data, samplecnt_t samples) const;
|
||||
|
||||
void get_state (XMLNode * node) const;
|
||||
void set_state (XMLNode * node, Session & session);
|
||||
bool empty () const { return ports.empty (); }
|
||||
|
||||
bool operator< (ExportChannel const & other) const;
|
||||
void get_state (XMLNode* node) const;
|
||||
void set_state (XMLNode* node, Session& session);
|
||||
|
||||
bool operator< (ExportChannel const& other) const;
|
||||
|
||||
void add_port (boost::weak_ptr<AudioPort> port) { ports.insert (port); }
|
||||
PortSet const & get_ports () { return ports; }
|
||||
PortSet const& get_ports () { return ports; }
|
||||
|
||||
private:
|
||||
private:
|
||||
PortSet ports;
|
||||
samplecnt_t _buffer_size;
|
||||
boost::scoped_array<Sample> _buffer;
|
||||
std::list <boost::shared_ptr<PBD::RingBuffer<Sample> > > _delaylines;
|
||||
std::list<boost::shared_ptr<PBD::RingBuffer<Sample>>> _delaylines;
|
||||
};
|
||||
|
||||
|
||||
/// Handles RegionExportChannels and does actual reading from region
|
||||
class LIBARDOUR_API RegionExportChannelFactory
|
||||
{
|
||||
public:
|
||||
public:
|
||||
enum Type {
|
||||
None,
|
||||
Raw,
|
||||
Fades,
|
||||
};
|
||||
|
||||
RegionExportChannelFactory (Session * session, AudioRegion const & region, AudioTrack & track, Type type);
|
||||
RegionExportChannelFactory (Session* session, AudioRegion const& region, AudioTrack& track, Type type);
|
||||
~RegionExportChannelFactory ();
|
||||
|
||||
ExportChannelPtr create (uint32_t channel);
|
||||
void read (uint32_t channel, Sample const *& data, samplecnt_t samples_to_read);
|
||||
|
||||
private:
|
||||
void read (uint32_t channel, Sample const*& data, samplecnt_t samples_to_read);
|
||||
|
||||
private:
|
||||
int new_cycle_started (samplecnt_t)
|
||||
{
|
||||
buffers_up_to_date = false;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int new_cycle_started (samplecnt_t) { buffers_up_to_date = false; return 0; }
|
||||
void update_buffers (samplecnt_t samples);
|
||||
|
||||
AudioRegion const & region;
|
||||
Type type;
|
||||
AudioRegion const& region;
|
||||
|
||||
Type type;
|
||||
samplecnt_t samples_per_cycle;
|
||||
size_t n_channels;
|
||||
BufferSet buffers;
|
||||
@ -139,22 +144,31 @@ class LIBARDOUR_API RegionExportChannel : public ExportChannel
|
||||
{
|
||||
friend class RegionExportChannelFactory;
|
||||
|
||||
public:
|
||||
void read (Sample const *& data, samplecnt_t samples_to_read) const { factory.read (channel, data, samples_to_read); }
|
||||
void get_state (XMLNode * /*node*/) const {};
|
||||
void set_state (XMLNode * /*node*/, Session & /*session*/) {};
|
||||
public:
|
||||
void read (Sample const*& data, samplecnt_t samples_to_read) const
|
||||
{
|
||||
factory.read (channel, data, samples_to_read);
|
||||
}
|
||||
|
||||
void get_state (XMLNode* /*node*/) const {};
|
||||
void set_state (XMLNode* /*node*/, Session& /*session*/){};
|
||||
|
||||
bool empty () const { return false; }
|
||||
|
||||
// Region export should never have duplicate channels, so there need not be any semantics here
|
||||
bool operator< (ExportChannel const & other) const { return this < &other; }
|
||||
bool operator< (ExportChannel const& other) const
|
||||
{
|
||||
return this < &other;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
RegionExportChannel (RegionExportChannelFactory & factory, uint32_t channel)
|
||||
private:
|
||||
RegionExportChannel (RegionExportChannelFactory& factory, uint32_t channel)
|
||||
: factory (factory)
|
||||
, channel (channel)
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
RegionExportChannelFactory & factory;
|
||||
RegionExportChannelFactory& factory;
|
||||
uint32_t channel;
|
||||
};
|
||||
|
||||
@ -163,32 +177,38 @@ class LIBARDOUR_API RouteExportChannel : public ExportChannel
|
||||
{
|
||||
class ProcessorRemover; // fwd declaration
|
||||
|
||||
public:
|
||||
RouteExportChannel(boost::shared_ptr<CapturingProcessor> processor, size_t channel,
|
||||
public:
|
||||
RouteExportChannel (boost::shared_ptr<CapturingProcessor> processor,
|
||||
size_t channel,
|
||||
boost::shared_ptr<ProcessorRemover> remover);
|
||||
~RouteExportChannel();
|
||||
~RouteExportChannel ();
|
||||
|
||||
static void create_from_route(std::list<ExportChannelPtr> & result, boost::shared_ptr<Route> route);
|
||||
static void create_from_route (std::list<ExportChannelPtr>& result, boost::shared_ptr<Route> route);
|
||||
|
||||
public: // ExportChannel interface
|
||||
public: // ExportChannel interface
|
||||
void prepare_export (samplecnt_t max_samples, sampleoffset_t common_latency);
|
||||
|
||||
void read (Sample const *& data, samplecnt_t samples) const;
|
||||
void read (Sample const*& data, samplecnt_t samples) const;
|
||||
|
||||
bool empty () const { return false; }
|
||||
|
||||
void get_state (XMLNode * node) const;
|
||||
void set_state (XMLNode * node, Session & session);
|
||||
void get_state (XMLNode* node) const;
|
||||
void set_state (XMLNode* node, Session& session);
|
||||
|
||||
bool operator< (ExportChannel const & other) const;
|
||||
|
||||
private:
|
||||
bool operator< (ExportChannel const& other) const;
|
||||
|
||||
private:
|
||||
// Removes the processor from the track when deleted
|
||||
class ProcessorRemover {
|
||||
class ProcessorRemover
|
||||
{
|
||||
public:
|
||||
ProcessorRemover (boost::shared_ptr<Route> route, boost::shared_ptr<CapturingProcessor> processor)
|
||||
: route (route), processor (processor) {}
|
||||
~ProcessorRemover();
|
||||
: route (route)
|
||||
, processor (processor)
|
||||
{
|
||||
}
|
||||
~ProcessorRemover ();
|
||||
|
||||
private:
|
||||
boost::shared_ptr<Route> route;
|
||||
boost::shared_ptr<CapturingProcessor> processor;
|
||||
|
@ -21,9 +21,9 @@
|
||||
#ifndef __ardour_export_channel_configuration_h__
|
||||
#define __ardour_export_channel_configuration_h__
|
||||
|
||||
#include <algorithm>
|
||||
#include <list>
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
|
||||
#include <boost/enable_shared_from_this.hpp>
|
||||
|
||||
@ -32,53 +32,57 @@
|
||||
|
||||
#include "pbd/xml++.h"
|
||||
|
||||
namespace ARDOUR
|
||||
{
|
||||
namespace ARDOUR {
|
||||
|
||||
class Session;
|
||||
|
||||
class LIBARDOUR_API ExportChannelConfiguration : public boost::enable_shared_from_this<ExportChannelConfiguration>
|
||||
{
|
||||
|
||||
private:
|
||||
private:
|
||||
friend class ExportElementFactory;
|
||||
ExportChannelConfiguration (Session & session);
|
||||
ExportChannelConfiguration (Session& session);
|
||||
|
||||
public:
|
||||
bool operator== (ExportChannelConfiguration const & other) const { return channels == other.channels; }
|
||||
bool operator!= (ExportChannelConfiguration const & other) const { return channels != other.channels; }
|
||||
public:
|
||||
bool operator== (ExportChannelConfiguration const& other) const
|
||||
{
|
||||
return channels == other.channels;
|
||||
}
|
||||
bool operator!= (ExportChannelConfiguration const& other) const
|
||||
{
|
||||
return channels != other.channels;
|
||||
}
|
||||
|
||||
XMLNode & get_state () const;
|
||||
int set_state (const XMLNode &);
|
||||
XMLNode& get_state () const;
|
||||
int set_state (const XMLNode&);
|
||||
|
||||
typedef std::list<ExportChannelPtr> ChannelList;
|
||||
|
||||
ChannelList const & get_channels () const { return channels; }
|
||||
bool all_channels_have_ports () const;
|
||||
|
||||
std::string name () const { return _name; }
|
||||
void set_name (std::string name) { _name = name; }
|
||||
void set_split (bool value) { split = value; }
|
||||
|
||||
RegionExportChannelFactory::Type region_processing_type() const { return region_type; }
|
||||
void set_region_processing_type(RegionExportChannelFactory::Type type) { region_type = type; }
|
||||
RegionExportChannelFactory::Type region_processing_type () const { return region_type; }
|
||||
void set_region_processing_type (RegionExportChannelFactory::Type type) { region_type = type; }
|
||||
|
||||
bool get_split () const { return split; }
|
||||
uint32_t get_n_chans () const { return channels.size(); }
|
||||
void set_split (bool value) { split = value; }
|
||||
|
||||
void register_channel (ExportChannelPtr channel) { channels.push_back (channel); }
|
||||
void register_channels (ChannelList const & new_channels) {
|
||||
std::copy (new_channels.begin(), new_channels.end(), std::back_inserter(channels));
|
||||
}
|
||||
uint32_t get_n_chans () const { return channels.size (); }
|
||||
ChannelList const& get_channels () const { return channels; }
|
||||
void clear_channels () { channels.clear (); }
|
||||
void register_channel (ExportChannelPtr channel) { channels.push_back (channel); }
|
||||
void register_channels (ChannelList const& new_channels)
|
||||
{
|
||||
std::copy (new_channels.begin (), new_channels.end (), std::back_inserter (channels));
|
||||
}
|
||||
|
||||
/** Returns a list of channel configurations that match the files created.
|
||||
* I.e. many configurations if splitting is enabled, one if not. */
|
||||
void configurations_for_files (std::list<boost::shared_ptr<ExportChannelConfiguration> > & configs);
|
||||
void configurations_for_files (std::list<boost::shared_ptr<ExportChannelConfiguration>>& configs);
|
||||
|
||||
private:
|
||||
|
||||
Session & session;
|
||||
private:
|
||||
Session& session;
|
||||
|
||||
ChannelList channels;
|
||||
bool split; // Split to mono files
|
||||
|
@ -20,13 +20,13 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include "ardour/export_channel.h"
|
||||
#include "ardour/audio_buffer.h"
|
||||
#include "ardour/audio_port.h"
|
||||
#include "ardour/audio_track.h"
|
||||
#include "ardour/audioengine.h"
|
||||
#include "ardour/audioregion.h"
|
||||
#include "ardour/capturing_processor.h"
|
||||
#include "ardour/export_channel.h"
|
||||
#include "ardour/export_failed.h"
|
||||
#include "ardour/session.h"
|
||||
|
||||
@ -46,13 +46,16 @@ PortExportChannel::~PortExportChannel ()
|
||||
_delaylines.clear ();
|
||||
}
|
||||
|
||||
samplecnt_t PortExportChannel::common_port_playback_latency () const
|
||||
samplecnt_t
|
||||
PortExportChannel::common_port_playback_latency () const
|
||||
{
|
||||
samplecnt_t l = 0;
|
||||
bool first = true;
|
||||
for (PortSet::const_iterator it = ports.begin(); it != ports.end(); ++it) {
|
||||
for (PortSet::const_iterator it = ports.begin (); it != ports.end (); ++it) {
|
||||
boost::shared_ptr<AudioPort> p = it->lock ();
|
||||
if (!p) { continue; }
|
||||
if (!p) {
|
||||
continue;
|
||||
}
|
||||
samplecnt_t latency = p->private_latency_range (true).max;
|
||||
if (first) {
|
||||
first = false;
|
||||
@ -64,60 +67,63 @@ samplecnt_t PortExportChannel::common_port_playback_latency () const
|
||||
return l;
|
||||
}
|
||||
|
||||
void PortExportChannel::prepare_export (samplecnt_t max_samples, sampleoffset_t common_latency)
|
||||
void
|
||||
PortExportChannel::prepare_export (samplecnt_t max_samples, sampleoffset_t common_latency)
|
||||
{
|
||||
_buffer_size = max_samples;
|
||||
_buffer.reset (new Sample[max_samples]);
|
||||
|
||||
_delaylines.clear ();
|
||||
|
||||
for (PortSet::const_iterator it = ports.begin(); it != ports.end(); ++it) {
|
||||
for (PortSet::const_iterator it = ports.begin (); it != ports.end (); ++it) {
|
||||
boost::shared_ptr<AudioPort> p = it->lock ();
|
||||
if (!p) { continue; }
|
||||
if (!p) {
|
||||
continue;
|
||||
}
|
||||
samplecnt_t latency = p->private_latency_range (true).max - common_latency;
|
||||
PBD::RingBuffer<Sample>* rb = new PBD::RingBuffer<Sample> (latency + 1 + _buffer_size);
|
||||
for (samplepos_t i = 0; i < latency; ++i) {
|
||||
Sample zero = 0;
|
||||
rb->write (&zero, 1);
|
||||
}
|
||||
_delaylines.push_back (boost::shared_ptr<PBD::RingBuffer<Sample> >(rb));
|
||||
_delaylines.push_back (boost::shared_ptr<PBD::RingBuffer<Sample>> (rb));
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
PortExportChannel::operator< (ExportChannel const & other) const
|
||||
PortExportChannel::operator< (ExportChannel const& other) const
|
||||
{
|
||||
PortExportChannel const * pec;
|
||||
if (!(pec = dynamic_cast<PortExportChannel const *> (&other))) {
|
||||
PortExportChannel const* pec;
|
||||
if (!(pec = dynamic_cast<PortExportChannel const*> (&other))) {
|
||||
return this < &other;
|
||||
}
|
||||
return ports < pec->ports;
|
||||
}
|
||||
|
||||
void
|
||||
PortExportChannel::read (Sample const *& data, samplecnt_t samples) const
|
||||
PortExportChannel::read (Sample const*& data, samplecnt_t samples) const
|
||||
{
|
||||
assert(_buffer);
|
||||
assert(samples <= _buffer_size);
|
||||
assert (_buffer);
|
||||
assert (samples <= _buffer_size);
|
||||
|
||||
if (ports.size() == 1 && _delaylines.size() ==1 && _delaylines.front()->bufsize () == _buffer_size + 1) {
|
||||
boost::shared_ptr<AudioPort> p = ports.begin()->lock ();
|
||||
AudioBuffer& ab (p->get_audio_buffer(samples)); // unsets AudioBuffer::_written
|
||||
data = ab.data();
|
||||
if (ports.size () == 1 && _delaylines.size () == 1 && _delaylines.front ()->bufsize () == _buffer_size + 1) {
|
||||
boost::shared_ptr<AudioPort> p = ports.begin ()->lock ();
|
||||
AudioBuffer& ab (p->get_audio_buffer (samples)); // unsets AudioBuffer::_written
|
||||
data = ab.data ();
|
||||
ab.set_written (true);
|
||||
return;
|
||||
}
|
||||
|
||||
memset (_buffer.get(), 0, samples * sizeof (Sample));
|
||||
memset (_buffer.get (), 0, samples * sizeof (Sample));
|
||||
|
||||
std::list <boost::shared_ptr<PBD::RingBuffer<Sample> > >::const_iterator di = _delaylines.begin ();
|
||||
for (PortSet::const_iterator it = ports.begin(); it != ports.end(); ++it) {
|
||||
std::list<boost::shared_ptr<PBD::RingBuffer<Sample>>>::const_iterator di = _delaylines.begin ();
|
||||
for (PortSet::const_iterator it = ports.begin (); it != ports.end (); ++it) {
|
||||
boost::shared_ptr<AudioPort> p = it->lock ();
|
||||
if (!p) {
|
||||
continue;
|
||||
}
|
||||
AudioBuffer& ab (p->get_audio_buffer(samples)); // unsets AudioBuffer::_written
|
||||
Sample* port_buffer = ab.data();
|
||||
AudioBuffer& ab (p->get_audio_buffer (samples)); // unsets AudioBuffer::_written
|
||||
Sample* port_buffer = ab.data ();
|
||||
ab.set_written (true);
|
||||
(*di)->write (port_buffer, samples);
|
||||
|
||||
@ -125,10 +131,10 @@ PortExportChannel::read (Sample const *& data, samplecnt_t samples) const
|
||||
(*di)->get_read_vector (&vec);
|
||||
assert (vec.len[0] + vec.len[1] >= samples);
|
||||
|
||||
samplecnt_t to_write = std::min (samples, (samplecnt_t) vec.len[0]);
|
||||
samplecnt_t to_write = std::min (samples, (samplecnt_t)vec.len[0]);
|
||||
mix_buffers_no_gain (&_buffer[0], vec.buf[0], to_write);
|
||||
|
||||
to_write = std::min (samples - to_write, (samplecnt_t) vec.len[1]);
|
||||
to_write = std::min (samples - to_write, (samplecnt_t)vec.len[1]);
|
||||
if (to_write > 0) {
|
||||
mix_buffers_no_gain (&_buffer[vec.len[0]], vec.buf[1], to_write);
|
||||
}
|
||||
@ -137,29 +143,29 @@ PortExportChannel::read (Sample const *& data, samplecnt_t samples) const
|
||||
++di;
|
||||
}
|
||||
|
||||
data = _buffer.get();
|
||||
data = _buffer.get ();
|
||||
}
|
||||
|
||||
void
|
||||
PortExportChannel::get_state (XMLNode * node) const
|
||||
PortExportChannel::get_state (XMLNode* node) const
|
||||
{
|
||||
XMLNode * port_node;
|
||||
for (PortSet::const_iterator it = ports.begin(); it != ports.end(); ++it) {
|
||||
XMLNode* port_node;
|
||||
for (PortSet::const_iterator it = ports.begin (); it != ports.end (); ++it) {
|
||||
boost::shared_ptr<Port> p = it->lock ();
|
||||
if (p && (port_node = node->add_child ("Port"))) {
|
||||
port_node->set_property ("name", p->name());
|
||||
port_node->set_property ("name", p->name ());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
PortExportChannel::set_state (XMLNode * node, Session & session)
|
||||
PortExportChannel::set_state (XMLNode* node, Session& session)
|
||||
{
|
||||
XMLNodeList xml_ports = node->children ("Port");
|
||||
for (XMLNodeList::iterator it = xml_ports.begin(); it != xml_ports.end(); ++it) {
|
||||
for (XMLNodeList::iterator it = xml_ports.begin (); it != xml_ports.end (); ++it) {
|
||||
std::string name;
|
||||
if ((*it)->get_property ("name", name)) {
|
||||
boost::shared_ptr<AudioPort> port = boost::dynamic_pointer_cast<AudioPort> (session.engine().get_port_by_name (name));
|
||||
boost::shared_ptr<AudioPort> port = boost::dynamic_pointer_cast<AudioPort> (session.engine ().get_port_by_name (name));
|
||||
if (port) {
|
||||
ports.insert (port);
|
||||
} else {
|
||||
@ -169,24 +175,24 @@ PortExportChannel::set_state (XMLNode * node, Session & session)
|
||||
}
|
||||
}
|
||||
|
||||
RegionExportChannelFactory::RegionExportChannelFactory (Session * session, AudioRegion const & region, AudioTrack&, Type type)
|
||||
RegionExportChannelFactory::RegionExportChannelFactory (Session* session, AudioRegion const& region, AudioTrack&, Type type)
|
||||
: region (region)
|
||||
, type (type)
|
||||
, samples_per_cycle (session->engine().samples_per_cycle ())
|
||||
, samples_per_cycle (session->engine ().samples_per_cycle ())
|
||||
, buffers_up_to_date (false)
|
||||
, region_start (region.position_sample())
|
||||
, region_start (region.position_sample ())
|
||||
, position (region_start)
|
||||
{
|
||||
switch (type) {
|
||||
case Raw:
|
||||
n_channels = region.n_channels();
|
||||
n_channels = region.n_channels ();
|
||||
break;
|
||||
case Fades:
|
||||
n_channels = region.n_channels();
|
||||
n_channels = region.n_channels ();
|
||||
|
||||
mixdown_buffer.reset (new Sample [samples_per_cycle]);
|
||||
gain_buffer.reset (new Sample [samples_per_cycle]);
|
||||
std::fill_n (gain_buffer.get(), samples_per_cycle, Sample (1.0));
|
||||
mixdown_buffer.reset (new Sample[samples_per_cycle]);
|
||||
gain_buffer.reset (new Sample[samples_per_cycle]);
|
||||
std::fill_n (gain_buffer.get (), samples_per_cycle, Sample (1.0));
|
||||
|
||||
break;
|
||||
default:
|
||||
@ -211,17 +217,17 @@ RegionExportChannelFactory::create (uint32_t channel)
|
||||
}
|
||||
|
||||
void
|
||||
RegionExportChannelFactory::read (uint32_t channel, Sample const *& data, samplecnt_t samples_to_read)
|
||||
RegionExportChannelFactory::read (uint32_t channel, Sample const*& data, samplecnt_t samples_to_read)
|
||||
{
|
||||
assert (channel < n_channels);
|
||||
assert (samples_to_read <= samples_per_cycle);
|
||||
|
||||
if (!buffers_up_to_date) {
|
||||
update_buffers(samples_to_read);
|
||||
update_buffers (samples_to_read);
|
||||
buffers_up_to_date = true;
|
||||
}
|
||||
|
||||
data = buffers.get_audio (channel).data();
|
||||
data = buffers.get_audio (channel).data ();
|
||||
}
|
||||
|
||||
void
|
||||
@ -232,15 +238,15 @@ RegionExportChannelFactory::update_buffers (samplecnt_t samples)
|
||||
switch (type) {
|
||||
case Raw:
|
||||
for (size_t channel = 0; channel < n_channels; ++channel) {
|
||||
region.read (buffers.get_audio (channel).data(), position - region_start, samples, channel);
|
||||
region.read (buffers.get_audio (channel).data (), position - region_start, samples, channel);
|
||||
}
|
||||
break;
|
||||
case Fades:
|
||||
assert (mixdown_buffer && gain_buffer);
|
||||
for (size_t channel = 0; channel < n_channels; ++channel) {
|
||||
memset (mixdown_buffer.get(), 0, sizeof (Sample) * samples);
|
||||
buffers.get_audio (channel).silence(samples);
|
||||
region.read_at (buffers.get_audio (channel).data(), mixdown_buffer.get(), gain_buffer.get(), position, samples, channel);
|
||||
memset (mixdown_buffer.get (), 0, sizeof (Sample) * samples);
|
||||
buffers.get_audio (channel).silence (samples);
|
||||
region.read_at (buffers.get_audio (channel).data (), mixdown_buffer.get (), gain_buffer.get (), position, samples, channel);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@ -250,8 +256,7 @@ RegionExportChannelFactory::update_buffers (samplecnt_t samples)
|
||||
position += samples;
|
||||
}
|
||||
|
||||
|
||||
RouteExportChannel::RouteExportChannel(boost::shared_ptr<CapturingProcessor> processor, size_t channel,
|
||||
RouteExportChannel::RouteExportChannel (boost::shared_ptr<CapturingProcessor> processor, size_t channel,
|
||||
boost::shared_ptr<ProcessorRemover> remover)
|
||||
: processor (processor)
|
||||
, channel (channel)
|
||||
@ -259,18 +264,18 @@ RouteExportChannel::RouteExportChannel(boost::shared_ptr<CapturingProcessor> pro
|
||||
{
|
||||
}
|
||||
|
||||
RouteExportChannel::~RouteExportChannel()
|
||||
RouteExportChannel::~RouteExportChannel ()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
RouteExportChannel::create_from_route(std::list<ExportChannelPtr> & result, boost::shared_ptr<Route> route)
|
||||
RouteExportChannel::create_from_route (std::list<ExportChannelPtr>& result, boost::shared_ptr<Route> route)
|
||||
{
|
||||
boost::shared_ptr<CapturingProcessor> processor = route->add_export_point();
|
||||
uint32_t channels = processor->input_streams().n_audio();
|
||||
boost::shared_ptr<CapturingProcessor> processor = route->add_export_point ();
|
||||
uint32_t channels = processor->input_streams ().n_audio ();
|
||||
|
||||
boost::shared_ptr<ProcessorRemover> remover (new ProcessorRemover (route, processor));
|
||||
result.clear();
|
||||
result.clear ();
|
||||
for (uint32_t i = 0; i < channels; ++i) {
|
||||
result.push_back (ExportChannelPtr (new RouteExportChannel (processor, i, remover)));
|
||||
}
|
||||
@ -285,45 +290,45 @@ RouteExportChannel::prepare_export (samplecnt_t max_samples, sampleoffset_t)
|
||||
}
|
||||
|
||||
void
|
||||
RouteExportChannel::read (Sample const *& data, samplecnt_t samples) const
|
||||
RouteExportChannel::read (Sample const*& data, samplecnt_t samples) const
|
||||
{
|
||||
assert(processor);
|
||||
AudioBuffer const & buffer = processor->get_capture_buffers().get_audio (channel);
|
||||
assert (processor);
|
||||
AudioBuffer const& buffer = processor->get_capture_buffers ().get_audio (channel);
|
||||
#ifndef NDEBUG
|
||||
(void) samples;
|
||||
(void)samples;
|
||||
#else
|
||||
assert (samples <= (samplecnt_t) buffer.capacity());
|
||||
assert (samples <= (samplecnt_t)buffer.capacity ());
|
||||
#endif
|
||||
data = buffer.data();
|
||||
data = buffer.data ();
|
||||
}
|
||||
|
||||
void
|
||||
RouteExportChannel::get_state (XMLNode *) const
|
||||
RouteExportChannel::get_state (XMLNode*) const
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void
|
||||
RouteExportChannel::set_state (XMLNode *, Session &)
|
||||
RouteExportChannel::set_state (XMLNode*, Session&)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
bool
|
||||
RouteExportChannel::operator< (ExportChannel const & other) const
|
||||
RouteExportChannel::operator< (ExportChannel const& other) const
|
||||
{
|
||||
RouteExportChannel const * rec;
|
||||
if ((rec = dynamic_cast<RouteExportChannel const *>(&other)) == 0) {
|
||||
RouteExportChannel const* rec;
|
||||
if ((rec = dynamic_cast<RouteExportChannel const*> (&other)) == 0) {
|
||||
return this < &other;
|
||||
}
|
||||
|
||||
if (processor.get() == rec->processor.get()) {
|
||||
if (processor.get () == rec->processor.get ()) {
|
||||
return channel < rec->channel;
|
||||
}
|
||||
return processor.get() < rec->processor.get();
|
||||
return processor.get () < rec->processor.get ();
|
||||
}
|
||||
|
||||
RouteExportChannel::ProcessorRemover::~ProcessorRemover()
|
||||
RouteExportChannel::ProcessorRemover::~ProcessorRemover ()
|
||||
{
|
||||
route->remove_processor (processor);
|
||||
}
|
||||
|
@ -28,25 +28,23 @@ using namespace PBD;
|
||||
|
||||
namespace ARDOUR
|
||||
{
|
||||
|
||||
/* ExportChannelConfiguration */
|
||||
|
||||
ExportChannelConfiguration::ExportChannelConfiguration (Session & session)
|
||||
ExportChannelConfiguration::ExportChannelConfiguration (Session& session)
|
||||
: session (session)
|
||||
, split (false)
|
||||
, region_type (RegionExportChannelFactory::None)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
XMLNode &
|
||||
XMLNode&
|
||||
ExportChannelConfiguration::get_state () const
|
||||
{
|
||||
XMLNode * root = new XMLNode ("ExportChannelConfiguration");
|
||||
XMLNode * channel;
|
||||
XMLNode* root = new XMLNode ("ExportChannelConfiguration");
|
||||
XMLNode* channel;
|
||||
|
||||
root->set_property ("split", get_split());
|
||||
root->set_property ("channels", get_n_chans());
|
||||
root->set_property ("split", get_split ());
|
||||
root->set_property ("channels", get_n_chans ());
|
||||
|
||||
switch (region_type) {
|
||||
case RegionExportChannelFactory::None:
|
||||
@ -58,12 +56,14 @@ ExportChannelConfiguration::get_state () const
|
||||
}
|
||||
|
||||
uint32_t i = 1;
|
||||
for (ExportChannelConfiguration::ChannelList::const_iterator c_it = channels.begin(); c_it != channels.end(); ++c_it) {
|
||||
for (auto const& c : channels) {
|
||||
channel = root->add_child ("Channel");
|
||||
if (!channel) { continue; }
|
||||
if (!channel) {
|
||||
continue;
|
||||
}
|
||||
|
||||
channel->set_property ("number", i);
|
||||
(*c_it)->get_state (channel);
|
||||
c->get_state (channel);
|
||||
|
||||
++i;
|
||||
}
|
||||
@ -72,7 +72,7 @@ ExportChannelConfiguration::get_state () const
|
||||
}
|
||||
|
||||
int
|
||||
ExportChannelConfiguration::set_state (const XMLNode & root)
|
||||
ExportChannelConfiguration::set_state (const XMLNode& root)
|
||||
{
|
||||
bool yn;
|
||||
if (root.get_property ("split", yn)) {
|
||||
@ -81,12 +81,11 @@ ExportChannelConfiguration::set_state (const XMLNode & root)
|
||||
|
||||
std::string str;
|
||||
if (root.get_property ("region-processing", str)) {
|
||||
set_region_processing_type ((RegionExportChannelFactory::Type)
|
||||
string_2_enum (str, RegionExportChannelFactory::Type));
|
||||
set_region_processing_type ((RegionExportChannelFactory::Type) string_2_enum (str, RegionExportChannelFactory::Type));
|
||||
}
|
||||
|
||||
XMLNodeList channels = root.children ("Channel");
|
||||
for (XMLNodeList::iterator it = channels.begin(); it != channels.end(); ++it) {
|
||||
for (XMLNodeList::iterator it = channels.begin (); it != channels.end (); ++it) {
|
||||
ExportChannelPtr channel (new PortExportChannel ());
|
||||
channel->set_state (*it, session);
|
||||
register_channel (channel);
|
||||
@ -98,15 +97,17 @@ ExportChannelConfiguration::set_state (const XMLNode & root)
|
||||
bool
|
||||
ExportChannelConfiguration::all_channels_have_ports () const
|
||||
{
|
||||
for (ChannelList::const_iterator it = channels.begin(); it != channels.end(); ++it) {
|
||||
if ((*it)->empty ()) { return false; }
|
||||
for (auto const& c : channels) {
|
||||
if (c->empty ()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
ExportChannelConfiguration::configurations_for_files (std::list<boost::shared_ptr<ExportChannelConfiguration> > & configs)
|
||||
ExportChannelConfiguration::configurations_for_files (std::list<boost::shared_ptr<ExportChannelConfiguration>>& configs)
|
||||
{
|
||||
configs.clear ();
|
||||
|
||||
@ -115,10 +116,10 @@ ExportChannelConfiguration::configurations_for_files (std::list<boost::shared_pt
|
||||
return;
|
||||
}
|
||||
|
||||
for (ChannelList::const_iterator it = channels.begin (); it != channels.end (); ++it) {
|
||||
for (auto const& c : channels) {
|
||||
boost::shared_ptr<ExportChannelConfiguration> config (new ExportChannelConfiguration (session));
|
||||
config->set_name (_name);
|
||||
config->register_channel (*it);
|
||||
config->register_channel (c);
|
||||
configs.push_back (config);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user