summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2008-02-27 13:04:48 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2008-02-27 13:04:48 +0000
commita969d639864f7c8d3f19aa4bd8f498b4391fb1d8 (patch)
treed94ede16d87a394d3a62e8d622ca9f75da263289
parentf31e8c3935fa6eed48d805021935cef38622b7ca (diff)
add CAF to list of likely audio file suffixes; use generic AudioFileSource SoundFileInfo rather than SNDFILE_INFO
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@3125 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r--gtk2_ardour/sfdb_ui.cc39
-rw-r--r--libs/ardour/audiofilesource.cc1
2 files changed, 18 insertions, 22 deletions
diff --git a/gtk2_ardour/sfdb_ui.cc b/gtk2_ardour/sfdb_ui.cc
index 2db82f3536..79880ef13a 100644
--- a/gtk2_ardour/sfdb_ui.cc
+++ b/gtk2_ardour/sfdb_ui.cc
@@ -859,10 +859,10 @@ SoundFileOmega::bad_file_message()
bool
SoundFileOmega::check_info (const vector<ustring>& paths, bool& same_size, bool& src_needed, bool& multichannel)
{
- SNDFILE* sf;
- SF_INFO info;
+ SoundFileInfo info;
nframes64_t sz = 0;
bool err = false;
+ string errmsg;
same_size = true;
src_needed = false;
@@ -870,29 +870,24 @@ SoundFileOmega::check_info (const vector<ustring>& paths, bool& same_size, bool&
for (vector<ustring>::const_iterator i = paths.begin(); i != paths.end(); ++i) {
- info.format = 0; // libsndfile says to clear this before sf_open().
+ if (!AudioFileSource::get_soundfile_info (*i, info, errmsg)) {
+ err = true;
+ }
- if ((sf = sf_open ((char*) (*i).c_str(), SFM_READ, &info)) != 0) {
- sf_close (sf);
-
- if (info.channels > 1) {
- multichannel = true;
- }
-
- if (sz == 0) {
- sz = info.frames;
- } else {
- if (sz != info.frames) {
- same_size = false;
- }
- }
-
- if ((nframes_t) info.samplerate != session->frame_rate()) {
- src_needed = true;
+ if (info.channels > 1) {
+ multichannel = true;
+ }
+
+ if (sz == 0) {
+ sz = info.length;
+ } else {
+ if (sz != info.length) {
+ same_size = false;
}
+ }
- } else {
- err = true;
+ if ((nframes_t) info.samplerate != session->frame_rate()) {
+ src_needed = true;
}
}
diff --git a/libs/ardour/audiofilesource.cc b/libs/ardour/audiofilesource.cc
index 2f93498405..a4a75727a9 100644
--- a/libs/ardour/audiofilesource.cc
+++ b/libs/ardour/audiofilesource.cc
@@ -682,6 +682,7 @@ AudioFileSource::safe_file_extension(ustring file)
{
return !(file.rfind(".wav") == ustring::npos &&
file.rfind(".aiff")== ustring::npos &&
+ file.rfind(".caf")== ustring::npos &&
file.rfind(".aif") == ustring::npos &&
file.rfind(".amb") == ustring::npos &&
file.rfind(".snd") == ustring::npos &&