summaryrefslogtreecommitdiff
path: root/libs/ardour/export_profile_manager.cc
diff options
context:
space:
mode:
authorSakari Bergen <sakari.bergen@beatwaves.net>2009-12-27 14:46:23 +0000
committerSakari Bergen <sakari.bergen@beatwaves.net>2009-12-27 14:46:23 +0000
commitdde0848a984e06cbc1d4117d9cffa75c191f3b39 (patch)
tree11f3a5fe94ac792e753297e16e4e80dd7e296aea /libs/ardour/export_profile_manager.cc
parent35c72a53b4c6bbc61b4b86db9de629e18362b48d (diff)
Re-integrate export-optimization branch.
Export now happens directly to file (unless normalizing is required), and can be easily optimized even further. The Session process connection is still broken during export (as it was before this commit also). git-svn-id: svn://localhost/ardour2/branches/3.0@6401 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/export_profile_manager.cc')
-rw-r--r--libs/ardour/export_profile_manager.cc27
1 files changed, 25 insertions, 2 deletions
diff --git a/libs/ardour/export_profile_manager.cc b/libs/ardour/export_profile_manager.cc
index 2b1b15dbce..244ec788ae 100644
--- a/libs/ardour/export_profile_manager.cc
+++ b/libs/ardour/export_profile_manager.cc
@@ -28,13 +28,13 @@
#include "pbd/convert.h"
#include "ardour/export_profile_manager.h"
-#include "ardour/export_file_io.h"
#include "ardour/export_format_specification.h"
#include "ardour/export_timespan.h"
#include "ardour/export_channel_configuration.h"
#include "ardour/export_filename.h"
#include "ardour/export_preset.h"
#include "ardour/export_handler.h"
+#include "ardour/export_failed.h"
#include "ardour/filename_extensions.h"
#include "ardour/session.h"
@@ -724,7 +724,7 @@ ExportProfileManager::check_config (boost::shared_ptr<Warnings> warnings,
warnings->errors.push_back (_("No format selected!"));
} else if (!channel_config->get_n_chans()) {
warnings->errors.push_back (_("All channels are empty!"));
- } else if (!ExportFileFactory::check (format, channel_config->get_n_chans())) {
+ } else if (!check_format (format, channel_config->get_n_chans())) {
warnings->errors.push_back (_("One or more of the selected formats is not compatible with this system!"));
} else if (format->channel_limit() < channel_config->get_n_chans()) {
warnings->errors.push_back
@@ -766,4 +766,27 @@ ExportProfileManager::check_config (boost::shared_ptr<Warnings> warnings,
}
}
+bool
+ExportProfileManager::check_format (FormatPtr format, uint32_t channels)
+{
+ switch (format->type()) {
+ case ExportFormatBase::T_Sndfile:
+ return check_sndfile_format (format, channels);
+
+ default:
+ throw ExportFailed (X_("Invalid format given for ExportFileFactory::check!"));
+ }
+}
+
+bool
+ExportProfileManager::check_sndfile_format (FormatPtr format, unsigned int channels)
+{
+ SF_INFO sf_info;
+ sf_info.channels = channels;
+ sf_info.samplerate = format->sample_rate ();
+ sf_info.format = format->format_id () | format->sample_format ();
+
+ return (sf_format_check (&sf_info) == SF_TRUE ? true : false);
+}
+
}; // namespace ARDOUR