+ if ((*i)->start() >= last_end_time)
+ {
+ /* this is a track, defined by a cd range marker or a cd location marker outside of a cd range */
+ out << endl << "TRACK AUDIO" << endl;
+
+ if ((*i)->cd_info.find("scms") != (*i)->cd_info.end()) {
+ out << "NO ";
+ }
+ out << "COPY" << endl;
+
+ if ((*i)->cd_info.find("preemph") != (*i)->cd_info.end()) {
+ out << "PRE_EMPHASIS" << endl;
+ } else {
+ out << "NO PRE_EMPHASIS" << endl;
+ }
+
+ if ((*i)->cd_info.find("isrc") != (*i)->cd_info.end()) {
+ out << "ISRC \"" << (*i)->cd_info["isrc"] << "\"" << endl;
+ }
+
+ out << "CD_TEXT {" << endl << " LANGUAGE 0 {" << endl << " TITLE \"" << (*i)->name() << "\"" << endl;
+ if ((*i)->cd_info.find("performer") != (*i)->cd_info.end()) {
+ out << " PERFORMER \"" << (*i)->cd_info["performer"] << "\"" << endl;
+ }
+ if ((*i)->cd_info.find("string_composer") != (*i)->cd_info.end()) {
+ out << " COMPOSER \"" << (*i)->cd_info["string_composer"] << "\"" << endl;
+ }
+
+ if ((*i)->cd_info.find("isrc") != (*i)->cd_info.end()) {
+ out << " ISRC \"";
+ out << (*i)->cd_info["isrc"].substr(0,2) << "-";
+ out << (*i)->cd_info["isrc"].substr(2,3) << "-";
+ out << (*i)->cd_info["isrc"].substr(5,2) << "-";
+ out << (*i)->cd_info["isrc"].substr(7,5) << "\"" << endl;
+ }
+
+ out << " }" << endl << "}" << endl;
+
+ frames_to_cd_frames_string (buf, last_end_time - spec.start_frame, session->frame_rate());
+ out << "FILE \"" << path << "\" " << buf;
+
+ if ((*i)->is_mark()) {
+ // a mark track location needs to look ahead to the next marker's start to determine length
+ nexti = i;
+ ++nexti;
+ if (nexti != temp.end()) {
+ frames_to_cd_frames_string (buf, (*nexti)->start() - last_end_time, session->frame_rate());
+ out << buf << endl;
+
+ frames_to_cd_frames_string (buf, (*i)->start() - last_end_time, session->frame_rate());
+ out << "START" << buf << endl;
+
+ last_start_time = (*i)->start();
+ last_end_time = (*nexti)->start();
+ }
+ else {
+ // this was the last marker, use session end
+ frames_to_cd_frames_string (buf, spec.end_frame - last_end_time, session->frame_rate());
+ out << buf << endl;
+
+ frames_to_cd_frames_string (buf, (*i)->start() - last_end_time, session->frame_rate());
+ out << "START" << buf << endl;
+
+ last_start_time = (*i)->start();
+ last_end_time = spec.end_frame;
+ }