sample_format_label (_("Sample Format"), Gtk::ALIGN_LEFT),
dither_label (_("Dithering"), Gtk::ALIGN_LEFT),
+ with_cue (_("Create CUE file for disk-at-once CD/DVD creation")),
+ with_toc (_("Create TOC file for disk-at-once CD/DVD creation")),
+
tag_checkbox (_("Tag file with session's metadata"))
{
get_vbox()->pack_start (silence_table, false, false, 6);
get_vbox()->pack_start (format_table, false, false, 6);
get_vbox()->pack_start (encoding_options_vbox, false, false, 0);
+ get_vbox()->pack_start (cue_toc_vbox, false, false, 0);
/* Name, new and remove */
close_button->signal_clicked().connect (sigc::mem_fun (*this, &ExportFormatDialog::end_dialog));
manager.CompleteChanged.connect (*this, invalidator (*this), ui_bind (&Gtk::Button::set_sensitive, close_button, _1), gui_context());
+ with_cue.signal_toggled().connect (sigc::mem_fun (*this, &ExportFormatDialog::update_with_cue));
+ with_toc.signal_toggled().connect (sigc::mem_fun (*this, &ExportFormatDialog::update_with_toc));
+
+ cue_toc_vbox.pack_start (with_cue, false, false);
+ cue_toc_vbox.pack_start (with_toc, false, false);
+
/* Load state before hooking up the rest of the signals */
load_state (format);
silence_end = spec->silence_end_time();
silence_end_checkbox.set_active (spec->silence_end_time().not_zero());
+ with_cue.set_active (spec->with_cue());
+ with_toc.set_active (spec->with_toc());
+
for (Gtk::ListStore::Children::iterator it = src_quality_list->children().begin(); it != src_quality_list->children().end(); ++it) {
if (it->get_value (src_quality_cols.id) == spec->src_quality()) {
src_quality_combo.set_active (it);
}
}
+void
+ExportFormatDialog::update_with_cue ()
+{
+ manager.select_with_cue (with_cue.get_active());
+}
+
+void
+ExportFormatDialog::update_with_toc ()
+{
+ manager.select_with_toc (with_toc.get_active());
+}
+
void
ExportFormatDialog::update_name ()
{
Gtk::Label sample_format_label;
Gtk::Label dither_label;
+ Gtk::CheckButton with_cue;
+ Gtk::CheckButton with_toc;
+
+ Gtk::VBox cue_toc_vbox;
+
+ void update_with_toc ();
+ void update_with_cue ();
+
Gtk::TreeView sample_format_view;
Gtk::TreeView dither_type_view;
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);
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; }
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; }
bool _normalize;
float _normalize_target;
+ bool _with_toc;
+ bool _with_cue;
/* serialization helpers */
current_selection->set_src_quality (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)
{
, _normalize (false)
, _normalize_target (1.0)
+ , _with_toc (false)
+ , _with_cue (false)
{
format_ids.insert (F_None);
endiannesses.insert (E_FileDefault);
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()));
_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"))) {
}
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"))) {
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());
}
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 &);
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;
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);
}
}
_engine.freewheel (false);
export_freewheel_connection.disconnect();
+
+ /* maybe write CUE/TOC */
+
export_handler.reset();
export_status.reset();
* 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*