summaryrefslogtreecommitdiff
path: root/libs/ardour/export_profile_manager.cc
diff options
context:
space:
mode:
authorSakari Bergen <sakari.bergen@beatwaves.net>2012-01-29 20:55:44 +0000
committerSakari Bergen <sakari.bergen@beatwaves.net>2012-01-29 20:55:44 +0000
commitdba601eeab9054ca4fac811c6c5e414d59fdc460 (patch)
tree247c39f68f793ec0954f916182b206e53913774c /libs/ardour/export_profile_manager.cc
parentb34e9155db41c300c7f92af4d30351bcb98b00df (diff)
Show an example filename in the main export dialog
git-svn-id: svn://localhost/ardour2/branches/3.0@11383 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/export_profile_manager.cc')
-rw-r--r--libs/ardour/export_profile_manager.cc66
1 files changed, 43 insertions, 23 deletions
diff --git a/libs/ardour/export_profile_manager.cc b/libs/ardour/export_profile_manager.cc
index af1209fde3..c644687f59 100644
--- a/libs/ardour/export_profile_manager.cc
+++ b/libs/ardour/export_profile_manager.cc
@@ -711,6 +711,19 @@ ExportProfileManager::remove_filename_state (FilenameStatePtr state)
}
}
+std::string
+ExportProfileManager::get_sample_filename_for_format (ExportFilenamePtr filename, ExportFormatSpecPtr format)
+{
+ if (channel_configs.empty()) { return ""; }
+
+ std::list<string> filenames;
+ build_filenames (filenames, filename, timespans.front()->timespans,
+ channel_configs.front()->config, format);
+
+ if (filenames.empty()) { return ""; }
+ return filenames.front();
+}
+
bool
ExportProfileManager::init_filenames (XMLNodeList nodes)
{
@@ -815,34 +828,17 @@ ExportProfileManager::check_config (boost::shared_ptr<Warnings> warnings,
// filename->include_timespan = (timespans->size() > 1); Disabled for now...
- for (std::list<ExportTimespanPtr>::iterator timespan_it = timespans->begin(); timespan_it != timespans->end(); ++timespan_it) {
- filename->set_timespan (*timespan_it);
-
- if (channel_config->get_split()) {
- filename->include_channel = true;
-
- for (uint32_t chan = 1; chan <= channel_config->get_n_chans(); ++chan) {
- filename->set_channel (chan);
+ std::list<string> paths;
+ build_filenames(paths, filename, timespans, channel_config, format);
- string path = filename->get_path (format);
+ for (std::list<string>::const_iterator path_it = paths.begin(); path_it != paths.end(); ++path_it) {
- if (sys::exists (sys::path (path))) {
- warnings->conflicting_filenames.push_back (path);
- }
- }
+ string path = *path_it;
- } else {
- filename->include_channel = false;
- string path = filename->get_path (format);
-
- if (sys::exists (sys::path (path))) {
- warnings->conflicting_filenames.push_back (path);
- }
+ if (sys::exists (sys::path (path))) {
+ warnings->conflicting_filenames.push_back (path);
}
- // TODO check what happens with split channel configs...
- string path = filename->get_path (format);
-
if (format->with_toc()) {
string marker_file = handler->get_cd_marker_filename(path, CDMarkerTOC);
if (sys::exists (sys::path (marker_file))) {
@@ -882,4 +878,28 @@ ExportProfileManager::check_sndfile_format (ExportFormatSpecPtr format, unsigned
return (sf_format_check (&sf_info) == SF_TRUE ? true : false);
}
+void
+ExportProfileManager::build_filenames(std::list<std::string> & result, ExportFilenamePtr filename,
+ TimespanListPtr timespans, ExportChannelConfigPtr channel_config,
+ ExportFormatSpecPtr format)
+{
+ for (std::list<ExportTimespanPtr>::iterator timespan_it = timespans->begin();
+ timespan_it != timespans->end(); ++timespan_it) {
+ filename->set_timespan (*timespan_it);
+
+ if (channel_config->get_split()) {
+ filename->include_channel = true;
+
+ for (uint32_t chan = 1; chan <= channel_config->get_n_chans(); ++chan) {
+ filename->set_channel (chan);
+ result.push_back(filename->get_path (format));
+ }
+
+ } else {
+ filename->include_channel = false;
+ result.push_back(filename->get_path (format));
+ }
+ }
+}
+
}; // namespace ARDOUR