summaryrefslogtreecommitdiff
path: root/gtk2_ardour/sfdb_ui.cc
diff options
context:
space:
mode:
authorTaybin Rutkin <taybin@taybin.com>2006-03-08 22:24:51 +0000
committerTaybin Rutkin <taybin@taybin.com>2006-03-08 22:24:51 +0000
commit123ec9cb3034dc760194e0e9e73f7d597e5d793f (patch)
tree9798f995f749d46cfc0bc65a034baf0c1ae32915 /gtk2_ardour/sfdb_ui.cc
parente057db8057e77157b3370f9feb8bb4670b1854e7 (diff)
Removed direct libsndfile usage.
git-svn-id: svn://localhost/trunk/ardour2@362 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/sfdb_ui.cc')
-rw-r--r--gtk2_ardour/sfdb_ui.cc31
1 files changed, 7 insertions, 24 deletions
diff --git a/gtk2_ardour/sfdb_ui.cc b/gtk2_ardour/sfdb_ui.cc
index 0ad46946bf..210b7faa05 100644
--- a/gtk2_ardour/sfdb_ui.cc
+++ b/gtk2_ardour/sfdb_ui.cc
@@ -22,8 +22,6 @@
#include <map>
#include <cerrno>
-#include <sndfile.h>
-
#include <pbd/basename.h>
#include <gtkmm/box.h>
@@ -42,7 +40,7 @@
using namespace ARDOUR;
-std::string length2string (const int32_t frames, const int32_t sample_rate);
+std::string length2string (const int32_t frames, const float sample_rate);
SoundFileBox::SoundFileBox ()
:
@@ -121,30 +119,15 @@ SoundFileBox::setup_labels (string filename)
{
path = filename;
- SNDFILE *sf;
-
- sf_info.format = 0; // libsndfile says to clear this before sf_open().
-
- if ((sf = sf_open ((char *) filename.c_str(), SFM_READ, &sf_info)) < 0) {
- return false;
- }
-
- sf_close (sf);
-
- if (sf_info.frames == 0 && sf_info.channels == 0 &&
- sf_info.samplerate == 0 && sf_info.format == 0 &&
- sf_info.sections == 0) {
- /* .. ok, it's not a sound file */
- return false;
+ if(!get_soundfile_info (filename, sf_info)) {
+ return false;
}
length.set_alignment (0.0f, 0.0f);
- length.set_text (string_compose("Length: %1", length2string(sf_info.frames, sf_info.samplerate)));
+ length.set_text (string_compose("Length: %1", length2string(sf_info.length, sf_info.samplerate)));
format.set_alignment (0.0f, 0.0f);
- format.set_text (string_compose("Format: %1, %2",
- sndfile_major_format(sf_info.format),
- sndfile_minor_format(sf_info.format)));
+ format.set_text (sf_info.format_name);
channels.set_alignment (0.0f, 0.0f);
channels.set_text (string_compose("Channels: %1", sf_info.channels));
@@ -363,9 +346,9 @@ SoundFileOmega::import_clicked ()
}
std::string
-length2string (const int32_t frames, const int32_t sample_rate)
+length2string (const int32_t frames, const float sample_rate)
{
- int secs = (int) (frames / (float) sample_rate);
+ int secs = (int) (frames / sample_rate);
int hrs = secs / 3600;
secs -= (hrs * 3600);
int mins = secs / 60;