Add dialog to allow removal of plugin presets. Should fix #2662.
[ardour.git] / libs / ardour / export_graph_builder.cc
index e7507b7449abfa37d8f636b8821a9f609c55c767..ba7491c9762289496071156147d9971c33939e4e 100644 (file)
@@ -38,11 +38,13 @@ ExportGraphBuilder::~ExportGraphBuilder ()
 }
 
 int
-ExportGraphBuilder::process (nframes_t /* frames */, bool last_cycle)
+ExportGraphBuilder::process (framecnt_t frames, bool last_cycle)
 {
+       assert(frames <= process_buffer_frames);
+       
        for (ChannelMap::iterator it = channels.begin(); it != channels.end(); ++it) {
-               it->first->read (process_buffer, process_buffer_frames);
-               ProcessContext<Sample> context(process_buffer, process_buffer_frames, 1);
+               it->first->read (process_buffer, frames);
+               ProcessContext<Sample> context(process_buffer, frames, 1);
                if (last_cycle) { context.set_flag (ProcessContext<Sample>::EndOfInput); }
                it->second->process (context);
        }
@@ -185,7 +187,7 @@ ExportGraphBuilder::Encoder::copy_files (std::string orig_path)
 
 /* SFC */
 
-ExportGraphBuilder::SFC::SFC (ExportGraphBuilder &, FileSpec const & new_config, nframes_t max_frames)
+ExportGraphBuilder::SFC::SFC (ExportGraphBuilder &, FileSpec const & new_config, framecnt_t max_frames)
   : data_width(0)
 {
        config = new_config;
@@ -201,8 +203,9 @@ ExportGraphBuilder::SFC::SFC (ExportGraphBuilder &, FileSpec const & new_config,
                int_converter->init (max_frames, config.format->dither_type(), data_width);
                add_child (config);
        } else {
+               int actual_data_width = 8 * sizeof(Sample);
                float_converter = FloatConverterPtr (new SampleFormatConverter<Sample> (channels));
-               float_converter->init (max_frames, config.format->dither_type(), data_width);
+               float_converter->init (max_frames, config.format->dither_type(), actual_data_width);
                add_child (config);
        }
 }
@@ -249,7 +252,7 @@ ExportGraphBuilder::SFC::operator== (FileSpec const & other_config) const
 
 /* Normalizer */
 
-ExportGraphBuilder::Normalizer::Normalizer (ExportGraphBuilder & parent, FileSpec const & new_config, nframes_t /*max_frames*/)
+ExportGraphBuilder::Normalizer::Normalizer (ExportGraphBuilder & parent, FileSpec const & new_config, framecnt_t /*max_frames*/)
   : parent (parent)
 {
        config = new_config;
@@ -303,7 +306,7 @@ ExportGraphBuilder::Normalizer::operator== (FileSpec const & other_config) const
 bool
 ExportGraphBuilder::Normalizer::process()
 {
-       nframes_t frames_read = tmp_file->read (*buffer);
+       framecnt_t frames_read = tmp_file->read (*buffer);
        return frames_read != buffer->frames();
 }
 
@@ -318,7 +321,7 @@ ExportGraphBuilder::Normalizer::start_post_processing()
 
 /* SRC */
 
-ExportGraphBuilder::SRC::SRC (ExportGraphBuilder & parent, FileSpec const & new_config, nframes_t max_frames)
+ExportGraphBuilder::SRC::SRC (ExportGraphBuilder & parent, FileSpec const & new_config, framecnt_t max_frames)
   : parent (parent)
 {
        config = new_config;
@@ -368,12 +371,12 @@ ExportGraphBuilder::SRC::operator== (FileSpec const & other_config) const
 }
 
 /* SilenceHandler */
-ExportGraphBuilder::SilenceHandler::SilenceHandler (ExportGraphBuilder & parent, FileSpec const & new_config, nframes_t max_frames)
+ExportGraphBuilder::SilenceHandler::SilenceHandler (ExportGraphBuilder & parent, FileSpec const & new_config, framecnt_t max_frames)
   : parent (parent)
 {
        config = new_config;
        max_frames_in = max_frames;
-       nframes_t sample_rate = parent.session.nominal_frame_rate();
+       framecnt_t sample_rate = parent.session.nominal_frame_rate();
        
        silence_trimmer.reset (new SilenceTrimmer<Sample>(max_frames_in));
        silence_trimmer->set_trim_beginning (config.format->trim_beginning());
@@ -454,7 +457,7 @@ ExportGraphBuilder::ChannelConfig::add_child (FileSpec const & new_config)
                }
        }
        
-       nframes_t max_frames_out = new_config.channel_config->get_n_chans() * max_frames;
+       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 ());
 }