class SampleRateConverter;
class PeakReader;
class Normalizer;
+ template <typename T> class Chunker;
template <typename T> class SampleFormatConverter;
template <typename T> class Interleaver;
template <typename T> class SndfileWriter;
private:
typedef boost::shared_ptr<AudioGrapher::Interleaver<Sample> > InterleaverPtr;
+ typedef boost::shared_ptr<AudioGrapher::Chunker<Sample> > ChunkerPtr;
ExportGraphBuilder & parent;
FileSpec config;
boost::ptr_list<SilenceHandler> children;
InterleaverPtr interleaver;
- framecnt_t max_frames;
+ ChunkerPtr chunker;
+ framecnt_t max_frames_out;
};
Session const & session;
#include "ardour/export_graph_builder.h"
#include "audiographer/process_context.h"
+#include "audiographer/general/chunker.h"
#include "audiographer/general/interleaver.h"
#include "audiographer/general/normalizer.h"
#include "audiographer/general/peak_reader.h"
typedef ExportChannelConfiguration::ChannelList ChannelList;
config = new_config;
- max_frames = parent.session.engine().frames_per_cycle();
+ framecnt_t max_frames = parent.session.engine().frames_per_cycle();
interleaver.reset (new Interleaver<Sample> ());
interleaver->init (new_config.channel_config->get_n_chans(), max_frames);
+ // Make the chunk size divisible by the channel count
+ int chan_count = new_config.channel_config->get_n_chans();
+ max_frames_out = 8192;
+ max_frames_out -= max_frames_out % chan_count;
+ chunker.reset (new Chunker<Sample> (max_frames_out));
+ interleaver->add_output(chunker);
+
ChannelList const & channel_list = config.channel_config->get_channels();
unsigned chan = 0;
for (ChannelList::const_iterator it = channel_list.begin(); it != channel_list.end(); ++it, ++chan) {
void
ExportGraphBuilder::ChannelConfig::add_child (FileSpec const & new_config)
{
+ assert (*this == new_config);
+
for (boost::ptr_list<SilenceHandler>::iterator it = children.begin(); it != children.end(); ++it) {
if (*it == new_config) {
it->add_child (new_config);
}
}
- framecnt_t const max_frames_out = new_config.channel_config->get_n_chans() * max_frames;
children.push_back (new SilenceHandler (parent, new_config, max_frames_out));
- interleaver->add_output (children.back().sink ());
+ chunker->add_output (children.back().sink ());
}
bool