projects
/
ardour.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
More solid "fake" recording and serialization
[ardour.git]
/
libs
/
ardour
/
import.cc
diff --git
a/libs/ardour/import.cc
b/libs/ardour/import.cc
index c13816e648d077a23dc4c5752e44f5aeb165d23b..6d98388941b94612f971cbea9daab0392e4be26c 100644
(file)
--- a/
libs/ardour/import.cc
+++ b/
libs/ardour/import.cc
@@
-36,14
+36,15
@@
#include <ardour/ardour.h>
#include <ardour/session.h>
#include <ardour/ardour.h>
#include <ardour/session.h>
-#include <ardour/diskstream.h>
-#include <ardour/filesource.h>
+#include <ardour/
audio_
diskstream.h>
+#include <ardour/
snd
filesource.h>
#include <ardour/sndfile_helpers.h>
#include <ardour/audioregion.h>
#include "i18n.h"
using namespace ARDOUR;
#include <ardour/sndfile_helpers.h>
#include <ardour/audioregion.h>
#include "i18n.h"
using namespace ARDOUR;
+using namespace PBD;
#define BLOCKSIZE 4096U
#define BLOCKSIZE 4096U
@@
-51,12
+52,11
@@
int
Session::import_audiofile (import_status& status)
{
SNDFILE *in;
Session::import_audiofile (import_status& status)
{
SNDFILE *in;
- FileSource **newfiles = 0;
- A
RDOUR::A
udioRegion::SourceList sources;
+
Audio
FileSource **newfiles = 0;
+ AudioRegion::SourceList sources;
SF_INFO info;
float *data = 0;
Sample **channel_data = 0;
SF_INFO info;
float *data = 0;
Sample **channel_data = 0;
- char * workbuf = 0;
long nfiles = 0;
long n;
string basepath;
long nfiles = 0;
long n;
string basepath;
@@
-94,7
+94,7
@@
Session::import_audiofile (import_status& status)
}
}
}
}
- newfiles = new FileSource *[info.channels];
+ newfiles = new
Audio
FileSource *[info.channels];
for (n = 0; n < info.channels; ++n) {
newfiles[n] = 0;
}
for (n = 0; n < info.channels; ++n) {
newfiles[n] = 0;
}
@@
-137,7
+137,10
@@
Session::import_audiofile (import_status& status)
try {
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) {
}
catch (failed_constructor& err) {
@@
-152,7
+155,6
@@
Session::import_audiofile (import_status& status)
data = new float[BLOCKSIZE * info.channels];
channel_data = new Sample * [ info.channels ];
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];
for (n = 0; n < info.channels; ++n) {
channel_data[n] = new Sample[BLOCKSIZE];
@@
-184,7
+186,7
@@
Session::import_audiofile (import_status& status)
/* flush to disk */
for (chn = 0; chn < info.channels; ++chn) {
/* 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;
}
so_far += nread;
@@
-251,9
+253,6
@@
Session::import_audiofile (import_status& status)
if (data) {
delete [] data;
}
if (data) {
delete [] data;
}
- if (workbuf) {
- delete [] workbuf;
- }
if (channel_data) {
for (n = 0; n < info.channels; ++n) {
if (channel_data) {
for (n = 0; n < info.channels; ++n) {
@@
-263,7
+262,7
@@
Session::import_audiofile (import_status& status)
}
if (status.cancel) {
}
if (status.cancel) {
- for (vector<
Audio
Region *>::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;
}
delete *i;
}