X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=libs%2Fardour%2Fexport_channel.cc;h=583dc9a843201fda68f660808a1b448e45993eea;hb=e033ac94f08c2963b0dac13020ea6b6a6b99db01;hp=094d6f910409ac783412bddfb4112c1334355bde;hpb=41c892802f75e62e452399f0b1c7319fee61e677;p=ardour.git diff --git a/libs/ardour/export_channel.cc b/libs/ardour/export_channel.cc index 094d6f9104..583dc9a843 100644 --- a/libs/ardour/export_channel.cc +++ b/libs/ardour/export_channel.cc @@ -18,10 +18,13 @@ */ -#include - -#include -#include +#include "ardour/audio_buffer.h" +#include "ardour/audio_port.h" +#include "ardour/audio_track.h" +#include "ardour/audioengine.h" +#include "ardour/export_channel.h" +#include "ardour/export_failed.h" +#include "ardour/session.h" using namespace ARDOUR; @@ -43,7 +46,7 @@ PortExportChannel::read (Sample * data, nframes_t frames) const for (PortSet::const_iterator it = ports.begin(); it != ports.end(); ++it) { if (*it != 0) { Sample* port_buffer = (*it)->get_audio_buffer(frames, 0).data(); - + for (uint32_t i = 0; i < frames; ++i) { data[i] += (float) port_buffer[i]; } @@ -92,11 +95,11 @@ RegionExportChannelFactory::RegionExportChannelFactory (Session * session, Audio break; case Fades: n_channels = region.n_channels(); - + mixdown_buffer = new Sample [frames_per_cycle]; gain_buffer = new Sample [frames_per_cycle]; memset (gain_buffer, 1.0, sizeof (Sample) * frames_per_cycle); - + break; case Processed: n_channels = track.n_outputs().n_audio(); @@ -104,22 +107,17 @@ RegionExportChannelFactory::RegionExportChannelFactory (Session * session, Audio default: throw ExportFailed ("Unhandled type in ExportChannelFactory constructor"); } - + session->ProcessExport.connect (sigc::hide (sigc::mem_fun (*this, &RegionExportChannelFactory::new_cycle_started))); - + buffers.set_count (ChanCount (DataType::AUDIO, n_channels)); buffers.ensure_buffers (DataType::AUDIO, n_channels, frames_per_cycle); } RegionExportChannelFactory::~RegionExportChannelFactory () { - if (mixdown_buffer) { - delete[] mixdown_buffer; - } - - if (gain_buffer) { - delete[] gain_buffer; - } + delete[] mixdown_buffer; + delete[] gain_buffer; } ExportChannelPtr @@ -134,12 +132,12 @@ RegionExportChannelFactory::read (uint32_t channel, Sample * data, nframes_t fra { assert (channel < n_channels); assert (frames_to_read <= frames_per_cycle); - + if (!buffers_up_to_date) { update_buffers(frames_to_read); buffers_up_to_date = true; } - + memcpy (data, buffers.get_audio (channel).data(), frames_to_read * sizeof (Sample)); } @@ -167,6 +165,6 @@ RegionExportChannelFactory::update_buffers (nframes_t frames) default: throw ExportFailed ("Unhandled type in ExportChannelFactory::update_buffers"); } - + position += frames; }