diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2012-01-18 21:56:06 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2012-01-18 21:56:06 +0000 |
commit | 65c8d673a2f88db61c68bf119f9dccbe82efd9ff (patch) | |
tree | eb68af3e954faeea680de64eb190feac4a63b6a0 /libs | |
parent | 577469a06aa48310ec5cd9a6428f32c35fca5fcb (diff) |
restore ability to create TOC and CUE files during export. this is an option in a given export format, not a per-export choice. so you need export formats with them set (or not) in order to utilize this choice. the resulting CUE/TOC files have not been checked with a burner (e.g. cdrdao) and testing of them would be appreciated - i (paul) have no CD burner h/w
git-svn-id: svn://localhost/ardour2/branches/3.0@11266 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r-- | libs/ardour/ardour/export_format_manager.h | 2 | ||||
-rw-r--r-- | libs/ardour/ardour/export_format_specification.h | 6 | ||||
-rw-r--r-- | libs/ardour/export_format_manager.cc | 12 | ||||
-rw-r--r-- | libs/ardour/export_format_specification.cc | 22 | ||||
-rw-r--r-- | libs/ardour/export_handler.cc | 26 | ||||
-rw-r--r-- | libs/ardour/session_export.cc | 5 | ||||
-rw-r--r-- | libs/ardour/utils.cc | 3 |
7 files changed, 66 insertions, 10 deletions
diff --git a/libs/ardour/ardour/export_format_manager.h b/libs/ardour/ardour/export_format_manager.h index 019a986f35..33a5553203 100644 --- a/libs/ardour/ardour/export_format_manager.h +++ b/libs/ardour/ardour/export_format_manager.h @@ -97,6 +97,8 @@ class ExportFormatManager : public PBD::ScopedConnectionList void set_name (std::string name); + void select_with_cue (bool); + void select_with_toc (bool); void select_src_quality (ExportFormatBase::SRCQuality value); void select_trim_beginning (bool value); void select_silence_beginning (AnyTime const & time); diff --git a/libs/ardour/ardour/export_format_specification.h b/libs/ardour/ardour/export_format_specification.h index 7afb0bc734..4bf3ed4013 100644 --- a/libs/ardour/ardour/export_format_specification.h +++ b/libs/ardour/ardour/export_format_specification.h @@ -93,6 +93,8 @@ class ExportFormatSpecification : public ExportFormatBase { void set_normalize_target (float value) { _normalize_target = value; } void set_tag (bool tag_it) { _tag = tag_it; } + void set_with_cue (bool yn) { _with_cue = yn; } + void set_with_toc (bool yn) { _with_toc = yn; } void set_silence_beginning (AnyTime const & value) { _silence_beginning = value; } void set_silence_end (AnyTime const & value) { _silence_end = value; } @@ -120,6 +122,8 @@ class ExportFormatSpecification : public ExportFormatBase { bool trim_end () const { return _trim_end; } bool normalize () const { return _normalize; } float normalize_target () const { return _normalize_target; } + bool with_toc() const { return _with_toc; } + bool with_cue() const { return _with_cue; } bool tag () const { return _tag && supports_tagging; } @@ -167,6 +171,8 @@ class ExportFormatSpecification : public ExportFormatBase { bool _normalize; float _normalize_target; + bool _with_toc; + bool _with_cue; /* serialization helpers */ diff --git a/libs/ardour/export_format_manager.cc b/libs/ardour/export_format_manager.cc index c77e301a23..f995bc1b0e 100644 --- a/libs/ardour/export_format_manager.cc +++ b/libs/ardour/export_format_manager.cc @@ -265,6 +265,18 @@ ExportFormatManager::select_src_quality (ExportFormatBase::SRCQuality value) } void +ExportFormatManager::select_with_cue (bool value) +{ + current_selection->set_with_cue (value); +} + +void +ExportFormatManager::select_with_toc (bool value) +{ + current_selection->set_with_toc (value); +} + +void ExportFormatManager::select_trim_beginning (bool value) { current_selection->set_trim_beginning (value); diff --git a/libs/ardour/export_format_specification.cc b/libs/ardour/export_format_specification.cc index 619c50b9f9..6fad14d86a 100644 --- a/libs/ardour/export_format_specification.cc +++ b/libs/ardour/export_format_specification.cc @@ -167,6 +167,8 @@ ExportFormatSpecification::ExportFormatSpecification (Session & s) , _normalize (false) , _normalize_target (1.0) + , _with_toc (false) + , _with_cue (false) { format_ids.insert (F_None); endiannesses.insert (E_FileDefault); @@ -235,6 +237,8 @@ ExportFormatSpecification::get_state () root->add_property ("name", _name); root->add_property ("id", _id.to_s()); + root->add_property ("with-cue", _with_cue ? "true" : "false"); + root->add_property ("with-toc", _with_toc ? "true" : "false"); node = root->add_child ("Encoding"); node->add_property ("id", enum_2_string (format_id())); @@ -300,6 +304,18 @@ ExportFormatSpecification::set_state (const XMLNode & root) _id = prop->value(); } + if ((prop = root.property ("with-cue"))) { + _with_cue = string_is_affirmative (prop->value()); + } else { + _with_cue = false; + } + + if ((prop = root.property ("with-toc"))) { + _with_toc = string_is_affirmative (prop->value()); + } else { + _with_toc = false; + } + /* Encoding and SRC */ if ((child = root.child ("Encoding"))) { @@ -320,7 +336,11 @@ ExportFormatSpecification::set_state (const XMLNode & root) } if ((prop = child->property ("has-sample-format"))) { - has_sample_format = !prop->value().compare ("true"); + has_sample_format = string_is_affirmative (prop->value()); + } + + if ((prop = child->property ("has-sample-format"))) { + has_sample_format = string_is_affirmative (prop->value()); } if ((prop = child->property ("channel-limit"))) { diff --git a/libs/ardour/export_handler.cc b/libs/ardour/export_handler.cc index 91b3429bff..f19dfe048c 100644 --- a/libs/ardour/export_handler.cc +++ b/libs/ardour/export_handler.cc @@ -237,6 +237,17 @@ void ExportHandler::finish_timespan () { while (config_map.begin() != timespan_bounds.second) { + + ExportFormatSpecPtr fmt = config_map.begin()->second.format; + + if (fmt->with_cue()) { + export_cd_marker_file (current_timespan, fmt, config_map.begin()->second.filename->get_path(fmt), CDMarkerCUE); + } + + if (fmt->with_toc()) { + export_cd_marker_file (current_timespan, fmt, config_map.begin()->second.filename->get_path(fmt), CDMarkerTOC); + } + config_map.erase (config_map.begin()); } @@ -256,12 +267,11 @@ ExportHandler::export_cd_marker_file (ExportTimespanPtr timespan, ExportFormatSp std::string filename, CDMarkerFormat format) { string filepath; - string basename = Glib::path_get_basename(filename); - size_t ext_pos = basename.rfind('.'); - if (ext_pos != string::npos) { - basename = basename.substr(0, ext_pos); /* strip file extension, if there is one */ - } + /* do not strip file suffix because there may be more than one format, + and we do not want the CD marker file from one format to overwrite + another (e.g. foo.wav.cue > foo.aiff.cue) + */ void (ExportHandler::*header_func) (CDMarkerStatus &); void (ExportHandler::*track_func) (CDMarkerStatus &); @@ -269,13 +279,15 @@ ExportHandler::export_cd_marker_file (ExportTimespanPtr timespan, ExportFormatSp switch (format) { case CDMarkerTOC: - filepath = Glib::build_filename(Glib::path_get_dirname(filename), basename + ".toc"); + filepath = filename; + filepath += ".toc"; header_func = &ExportHandler::write_toc_header; track_func = &ExportHandler::write_track_info_toc; index_func = &ExportHandler::write_index_info_toc; break; case CDMarkerCUE: - filepath = Glib::build_filename(Glib::path_get_dirname(filename), basename + ".cue"); + filepath = filename; + filepath += ".cue"; header_func = &ExportHandler::write_cue_header; track_func = &ExportHandler::write_track_info_cue; index_func = &ExportHandler::write_index_info_cue; diff --git a/libs/ardour/session_export.cc b/libs/ardour/session_export.cc index 7737e95279..4f46535a97 100644 --- a/libs/ardour/session_export.cc +++ b/libs/ardour/session_export.cc @@ -178,7 +178,7 @@ Session::process_export (pframes_t nframes) ProcessExport (nframes); } catch (std::exception & e) { - std::cout << e.what() << std::endl; + error << string_compose (_("Export ended unexpectedly: %1"), e.what()) << endmsg; export_status->abort (true); } } @@ -222,6 +222,9 @@ Session::finalize_audio_export () _engine.freewheel (false); export_freewheel_connection.disconnect(); + + /* maybe write CUE/TOC */ + export_handler.reset(); export_status.reset(); diff --git a/libs/ardour/utils.cc b/libs/ardour/utils.cc index cc02386bf4..1c52a6f638 100644 --- a/libs/ardour/utils.cc +++ b/libs/ardour/utils.cc @@ -643,7 +643,8 @@ string_is_affirmative (const std::string& str) * in the way we desire when doing it in C. */ - return str == "1" || str == "y" || str == "Y" || (!g_strncasecmp(str.c_str(), "yes", str.length())); + return str == "1" || str == "y" || str == "Y" || (!g_strncasecmp(str.c_str(), "yes", str.length())) || + (!g_strncasecmp(str.c_str(), "true", str.length())); } const char* |