[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Traverso-commit] traverso/src core/Export.cpp core/Export.h core...
From: |
Nicola Doebelin |
Subject: |
[Traverso-commit] traverso/src core/Export.cpp core/Export.h core... |
Date: |
Sun, 22 Apr 2007 20:05:38 +0000 |
CVSROOT: /sources/traverso
Module name: traverso
Changes by: Nicola Doebelin <n_doebelin> 07/04/22 20:05:38
Modified files:
src/core : Export.cpp Export.h Marker.h Song.cpp Song.h
TimeLine.cpp TimeLine.h
src/traverso : ExportWidget.cpp
Log message:
Export to cdrdao image was completed
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/Export.cpp?cvsroot=traverso&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/Export.h?cvsroot=traverso&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/Marker.h?cvsroot=traverso&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/Song.cpp?cvsroot=traverso&r1=1.80&r2=1.81
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/Song.h?cvsroot=traverso&r1=1.46&r2=1.47
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/TimeLine.cpp?cvsroot=traverso&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/TimeLine.h?cvsroot=traverso&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/ExportWidget.cpp?cvsroot=traverso&r1=1.7&r2=1.8
Patches:
Index: core/Export.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/Export.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- core/Export.cpp 22 Mar 2007 23:16:47 -0000 1.2
+++ core/Export.cpp 22 Apr 2007 20:05:38 -0000 1.3
@@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- $Id: Export.cpp,v 1.2 2007/03/22 23:16:47 r_sijrier Exp $
+ $Id: Export.cpp,v 1.3 2007/04/22 20:05:38 n_doebelin Exp $
*/
#include "Export.h"
@@ -61,7 +61,7 @@
isRecording = -1;
exportdir = "";
name = "";
-
+ writeToc = false;
}
int ExportSpecification::is_valid()
Index: core/Export.h
===================================================================
RCS file: /sources/traverso/traverso/src/core/Export.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- core/Export.h 22 Mar 2007 23:16:47 -0000 1.3
+++ core/Export.h 22 Apr 2007 20:05:38 -0000 1.4
@@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-$Id: Export.h,v 1.3 2007/03/22 23:16:47 r_sijrier Exp $
+$Id: Export.h,v 1.4 2007/04/22 20:05:38 n_doebelin Exp $
*/
#ifndef EXPORT_H
@@ -69,6 +69,7 @@
int isRecording;
QString exportdir;
QString name;
+ bool writeToc;
};
Index: core/Marker.h
===================================================================
RCS file: /sources/traverso/traverso/src/core/Marker.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- core/Marker.h 10 Apr 2007 19:37:57 -0000 1.8
+++ core/Marker.h 22 Apr 2007 20:05:38 -0000 1.9
@@ -64,6 +64,7 @@
QString get_isrc() const {return m_isrc;}
bool get_preemphasis();
bool get_copyprotect();
+ uint get_type() {return m_type;};
private:
TimeLine* m_timeline;
Index: core/Song.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/Song.cpp,v
retrieving revision 1.80
retrieving revision 1.81
diff -u -b -r1.80 -r1.81
--- core/Song.cpp 12 Apr 2007 13:39:12 -0000 1.80
+++ core/Song.cpp 22 Apr 2007 20:05:38 -0000 1.81
@@ -21,6 +21,12 @@
#include <QTextStream>
#include <QString>
+#include <QFile>
+#include <QFileInfo>
+#include <QList>
+#include <QMap>
+#include <QRegExp>
+#include <QDebug>
#include <libtraverso.h>
#include <commands.h>
@@ -46,6 +52,7 @@
#include "Utils.h"
#include "ContextItem.h"
#include "TimeLine.h"
+#include "Marker.h"
#include <Plugin.h>
#include <PluginChain.h>
@@ -304,7 +311,6 @@
int Song::prepare_export(ExportSpecification* spec)
{
PENTER;
-
if (transport) {
stopTransport = true;
}
@@ -335,6 +341,13 @@
}
+ if (m_timeline->get_end_position(endframe)) {
+ PMESG2(" End marker found at %d", endframe);
+ spec->end_frame = endframe;
+ } else {
+ PMESG2(" No end marker found");
+ }
+
spec->total_frames = spec->end_frame - spec->start_frame;
// PWARN("Render length is: %s",frame_to_smpte(spec->total_frames,
m_project->get_rate()).toAscii().data() );
@@ -359,6 +372,10 @@
return -1;
}
+ if (spec->writeToc) {
+ write_cdrdao_toc(spec);
+ }
+
m_exportSource = new WriteSource(spec);
return 1;
@@ -809,6 +826,90 @@
return 1;
}
+void Song::write_cdrdao_toc(ExportSpecification* spec)
+{
+ QString idString = QString::number(m_id);
+ if (m_id < 10) {
+ idString.prepend("0");
+ }
+ QString name = spec->exportdir + "/";
+ QFileInfo fi(spec->name);
+ QString basename = fi.completeBaseName() + ".toc";
+ name += basename;
+
+ QFile file(name);
+
+ // check if the selected file can be opened for writing
+ if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
+ printf("Could not open file for writing.");
+ return;
+ }
+
+ QTextStream out(&file);
+ out << "CD_DA\n\n";
+ out << "CD_TEXT {\n";
+
+ out << " LANGUAGE_MAP {\n 0 : EN\n }\n\n";
+
+ out << " LANGUAGE 0 {\n";
+ out << " TITLE \"" << m_project->get_title() << "\"\n";
+ out << " PERFORMER \"\"\n";
+ out << " DISC_ID \"\"\n";
+ out << " UPC_EAN \"\"\n\n";
+
+ out << " ARRANGER \"\"\n";
+ out << " SONGWRITER \"\"\n";
+ out << " MESSAGE \"\"\n";
+ out << " GENRE \"\"\n }\n}\n\n";
+
+ QList<Marker*> mlist = m_timeline->get_markers();
+
+ // Sort the list according to Marker::get_when() values. This
+ // is the correct way to do it according to the Qt docu.
+ QMap<nframes_t, Marker*> mmap;
+ foreach(Marker *marker, mlist) {
+ mmap.insert(marker->get_when(), marker);
+ }
+ mlist = mmap.values();
+
+ for(int i = 0; i < mlist.size()-1; ++i) {
+ Marker *m_start = mlist.at(i);
+ Marker *m_end = mlist.at(i+1);
+
+ out << "TRACK AUDIO\n";
+
+ if (m_start->get_copyprotect()) {
+ out << " NO COPY\n";
+ } else {
+ out << " COPY\n";
+ }
+
+ if (m_start->get_preemphasis()) {
+ out << " PRE_EMPHASIS\n";
+ }
+
+ out << " CD_TEXT {\n LANGUAGE 0 {\n";
+ out << " TITLE \"" << m_start->get_description() << "\"\n";
+ out << " PERFORMER \"" << m_start->get_performer() <<
"\"\n";
+ out << " ISRC \"" << m_start->get_isrc() << "\"\n";
+ out << " ARRANGER \"" << m_start->get_arranger() << "\"\n";
+ out << " SONGWRITER \"" << m_start->get_songwriter() <<
"\"\n";
+ out << " MESSAGE \"" << m_start->get_message() << "\"\n
}\n }\n";
+
+ nframes_t start = m_start->get_when();
+ nframes_t end = m_end->get_when();
+ nframes_t length = end - start;
+
+ QString s_start = frame_to_smpte(start, m_project->get_rate());
+ QString s_length = frame_to_smpte(length,
m_project->get_rate());
+
+ s_start.replace(QRegExp("[" + QRegExp::escape(",.;") + "]"),
":");
+ s_length.replace(QRegExp("[" + QRegExp::escape(",.;") + "]"),
":");
+
+ out << " FILE \"" << spec->name << "\" " << s_start << " " <<
s_length << "\n\n";
+ }
+}
+
void Song::resize_buffer( )
{
delete [] mixdown;
Index: core/Song.h
===================================================================
RCS file: /sources/traverso/traverso/src/core/Song.h,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -b -r1.46 -r1.47
--- core/Song.h 12 Apr 2007 13:39:12 -0000 1.46
+++ core/Song.h 22 Apr 2007 20:05:38 -0000 1.47
@@ -132,6 +132,7 @@
void disconnect_from_audiodevice();
void connect_to_audiodevice();
void schedule_for_deletion();
+ void write_cdrdao_toc(ExportSpecification* spec);
audio_sample_t* mixdown;
audio_sample_t* gainbuffer;
Index: core/TimeLine.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/TimeLine.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- core/TimeLine.cpp 19 Mar 2007 11:18:05 -0000 1.4
+++ core/TimeLine.cpp 22 Apr 2007 20:05:38 -0000 1.5
@@ -124,6 +124,17 @@
return 0;
}
+bool TimeLine::get_end_position(nframes_t & pos)
+{
+ foreach(Marker* marker, m_markers) {
+ if (marker->get_type() == 10) {
+ pos = marker->get_when();
+ return true;
+ }
+ }
+
+ return false;
+}
//eof
Index: core/TimeLine.h
===================================================================
RCS file: /sources/traverso/traverso/src/core/TimeLine.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- core/TimeLine.h 29 Mar 2007 21:09:42 -0000 1.4
+++ core/TimeLine.h 22 Apr 2007 20:05:38 -0000 1.5
@@ -24,6 +24,7 @@
#include "ContextItem.h"
#include <QDomNode>
+#include "defines.h"
class Song;
class Marker;
@@ -43,6 +44,7 @@
Song *get_song() const {return m_song;}
Marker* get_marker(qint64 id);
+ bool get_end_position(nframes_t &pos);
Command* add_marker(Marker* marker, bool historable=true);
Command* remove_marker(Marker* marker, bool historable=true);
Index: traverso/ExportWidget.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/traverso/ExportWidget.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- traverso/ExportWidget.cpp 22 Mar 2007 23:16:54 -0000 1.7
+++ traverso/ExportWidget.cpp 22 Apr 2007 20:05:38 -0000 1.8
@@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- $Id: ExportWidget.cpp,v 1.7 2007/03/22 23:16:54 r_sijrier Exp $
+ $Id: ExportWidget.cpp,v 1.8 2007/04/22 20:05:38 n_doebelin Exp $
*/
#include "ExportWidget.h"
@@ -82,10 +82,11 @@
audioTypeComboBox->insertItem(0, "WAV");
audioTypeComboBox->insertItem(1, "AIFF");
+ audioTypeComboBox->insertItem(2, "CD image (cdrdao)");
char buffer [128] ;
sf_command (NULL, SFC_GET_LIB_VERSION, buffer, sizeof (buffer));
if (QByteArray(buffer) >= "libsndfile-1.0.12")
- audioTypeComboBox->insertItem(2, "FLAC");
+ audioTypeComboBox->insertItem(3, "FLAC");
switch(audiodevice().get_sample_rate()) {
@@ -137,6 +138,10 @@
spec->extension = ".aiff";
break;
case 2:
+ spec->format = SF_FORMAT_WAV;
+ spec->extension = ".wav";
+ break;
+ case 3:
char buffer [128] ;
sf_command (NULL, SFC_GET_LIB_VERSION, buffer, sizeof
(buffer));
if (QByteArray(buffer) == "libsndfile-1.0.12") {
@@ -146,6 +151,17 @@
break;
}
+ // check if CD-format is required
+ if (audioTypeComboBox->currentIndex() == 2) {
+
+ spec->data_width = 16;
+ spec->format |= SF_FORMAT_PCM_16;
+ spec->channels = 2;
+ spec->sample_rate = 44100;
+ spec->writeToc = true;
+
+ } else {
+
switch (bitdepthComboBox->currentIndex()) {
case 0:
spec->data_width = 16;
@@ -191,6 +207,7 @@
spec->sample_rate = 96000;
break;
}
+ }
//TODO Make a ComboBox for this one too!
spec->dither_type = GDitherTri;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Traverso-commit] traverso/src core/Export.cpp core/Export.h core...,
Nicola Doebelin <=