NO-OP: re-indent, and cleanup

This commit is contained in:
Robin Gareus 2022-05-14 18:18:33 +02:00
parent 4339e3c729
commit 86597d7e1c
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
4 changed files with 247 additions and 217 deletions

View File

@ -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"
@ -47,13 +47,13 @@ class CapturingProcessor;
class LIBARDOUR_API ExportChannel : public boost::less_than_comparable<ExportChannel>
{
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 read (Sample const*& data, samplecnt_t samples) const = 0;
virtual bool empty () const = 0;
/// Adds state to node passed
@ -79,6 +79,7 @@ class LIBARDOUR_API PortExportChannel : public ExportChannel
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 get_state (XMLNode* node) const;
@ -96,7 +97,6 @@ class LIBARDOUR_API PortExportChannel : public ExportChannel
std::list<boost::shared_ptr<PBD::RingBuffer<Sample>>> _delaylines;
};
/// Handles RegionExportChannels and does actual reading from region
class LIBARDOUR_API RegionExportChannelFactory
{
@ -111,16 +111,21 @@ class LIBARDOUR_API RegionExportChannelFactory
~RegionExportChannelFactory ();
ExportChannelPtr create (uint32_t channel);
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;
Type type;
samplecnt_t samples_per_cycle;
size_t n_channels;
BufferSet buffers;
@ -140,19 +145,28 @@ 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 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)
: factory (factory)
, channel (channel)
{}
{
}
RegionExportChannelFactory& factory;
uint32_t channel;
@ -164,7 +178,8 @@ class LIBARDOUR_API RouteExportChannel : public ExportChannel
class ProcessorRemover; // fwd declaration
public:
RouteExportChannel(boost::shared_ptr<CapturingProcessor> processor, size_t channel,
RouteExportChannel (boost::shared_ptr<CapturingProcessor> processor,
size_t channel,
boost::shared_ptr<ProcessorRemover> remover);
~RouteExportChannel ();
@ -174,6 +189,7 @@ class LIBARDOUR_API RouteExportChannel : public ExportChannel
void prepare_export (samplecnt_t max_samples, sampleoffset_t common_latency);
void read (Sample const*& data, samplecnt_t samples) const;
bool empty () const { return false; }
void get_state (XMLNode* node) const;
@ -182,13 +198,17 @@ class LIBARDOUR_API RouteExportChannel : public ExportChannel
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) {}
: route (route)
, processor (processor)
{
}
~ProcessorRemover ();
private:
boost::shared_ptr<Route> route;
boost::shared_ptr<CapturingProcessor> processor;

View File

@ -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,52 +32,56 @@
#include "pbd/xml++.h"
namespace ARDOUR
{
namespace ARDOUR {
class Session;
class LIBARDOUR_API ExportChannelConfiguration : public boost::enable_shared_from_this<ExportChannelConfiguration>
{
private:
friend class ExportElementFactory;
ExportChannelConfiguration (Session& session);
public:
bool operator== (ExportChannelConfiguration const & other) const { return channels == other.channels; }
bool operator!= (ExportChannelConfiguration const & other) const { return channels != other.channels; }
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&);
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; }
bool get_split () const { return split; }
uint32_t get_n_chans () const { return channels.size(); }
void set_split (bool value) { split = value; }
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) {
void register_channels (ChannelList const& new_channels)
{
std::copy (new_channels.begin (), new_channels.end (), std::back_inserter (channels));
}
void clear_channels () { channels.clear (); }
/** 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);
private:
Session& session;
ChannelList channels;

View File

@ -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) {
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,7 +67,8 @@ 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]);
@ -73,7 +77,9 @@ void PortExportChannel::prepare_export (samplecnt_t max_samples, sampleoffset_t
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) {
@ -250,7 +256,6 @@ RegionExportChannelFactory::update_buffers (samplecnt_t samples)
position += samples;
}
RouteExportChannel::RouteExportChannel (boost::shared_ptr<CapturingProcessor> processor, size_t channel,
boost::shared_ptr<ProcessorRemover> remover)
: processor (processor)

View File

@ -28,7 +28,6 @@ using namespace PBD;
namespace ARDOUR
{
/* ExportChannelConfiguration */
ExportChannelConfiguration::ExportChannelConfiguration (Session& session)
@ -36,7 +35,6 @@ ExportChannelConfiguration::ExportChannelConfiguration (Session & session)
, split (false)
, region_type (RegionExportChannelFactory::None)
{
}
XMLNode&
@ -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;
}
@ -81,8 +81,7 @@ 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");
@ -98,8 +97,10 @@ 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;
@ -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);
}
}