#include <ardour/ardour.h>
#include <ardour/session.h>
-#include <ardour/diskstream.h>
-#include <ardour/filesource.h>
+#include <ardour/audio_diskstream.h>
+#include <ardour/sndfilesource.h>
#include <ardour/sndfile_helpers.h>
#include <ardour/audioregion.h>
#include "i18n.h"
using namespace ARDOUR;
+using namespace PBD;
#define BLOCKSIZE 4096U
Session::import_audiofile (import_status& status)
{
SNDFILE *in;
- FileSource **newfiles = 0;
- ARDOUR::AudioRegion::SourceList sources;
+ AudioFileSource **newfiles = 0;
+ AudioRegion::SourceList sources;
SF_INFO info;
float *data = 0;
Sample **channel_data = 0;
- char * workbuf = 0;
long nfiles = 0;
long n;
string basepath;
}
}
- newfiles = new FileSource *[info.channels];
+ newfiles = new AudioFileSource *[info.channels];
for (n = 0; n < info.channels; ++n) {
newfiles[n] = 0;
}
try {
- newfiles[n] = new FileSource (buf, frame_rate(), false, Config->get_native_file_data_format());
+ newfiles[n] = new SndFileSource (buf,
+ Config->get_native_file_data_format(),
+ Config->get_native_file_header_format(),
+ frame_rate ());
}
catch (failed_constructor& err) {
data = new float[BLOCKSIZE * info.channels];
channel_data = new Sample * [ info.channels ];
- workbuf = new char[BLOCKSIZE * 4];
for (n = 0; n < info.channels; ++n) {
channel_data[n] = new Sample[BLOCKSIZE];
/* flush to disk */
for (chn = 0; chn < info.channels; ++chn) {
- newfiles[chn]->write (channel_data[chn], nread, workbuf);
+ newfiles[chn]->write (channel_data[chn], nread);
}
so_far += nread;
if (data) {
delete [] data;
}
- if (workbuf) {
- delete [] workbuf;
- }
if (channel_data) {
for (n = 0; n < info.channels; ++n) {
}
if (status.cancel) {
- for (vector<AudioRegion *>::iterator i = status.new_regions.begin(); i != status.new_regions.end(); ++i) {
+ for (vector<Region *>::iterator i = status.new_regions.begin(); i != status.new_regions.end(); ++i) {
delete *i;
}