*/
-#include <ardour/export_channel.h>
-
-#include <ardour/export_failed.h>
-#include <ardour/audioengine.h>
+#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;
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];
}
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();
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
{
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));
}
default:
throw ExportFailed ("Unhandled type in ExportChannelFactory::update_buffers");
}
-
+
position += frames;
}