[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Traverso-commit] traverso CMakeLists.txt src/core/AudioFileCopyC...
From: |
Remon Sijrier |
Subject: |
[Traverso-commit] traverso CMakeLists.txt src/core/AudioFileCopyC... |
Date: |
Thu, 22 May 2008 12:55:55 +0000 |
CVSROOT: /sources/traverso
Module name: traverso
Changes by: Remon Sijrier <r_sijrier> 08/05/22 12:55:55
Modified files:
. : CMakeLists.txt
src/core : AudioFileCopyConvert.cpp CMakeLists.txt
ReadSource.h ResourcesManager.cpp
ResourcesManager.h
src/traverso/dialogs/project: NewProjectDialog.cpp
NewProjectDialog.h
Log message:
Further improvements on audio file import when creating a new project
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/traverso/CMakeLists.txt?cvsroot=traverso&r1=1.26&r2=1.27
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/AudioFileCopyConvert.cpp?cvsroot=traverso&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/CMakeLists.txt?cvsroot=traverso&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/ReadSource.h?cvsroot=traverso&r1=1.48&r2=1.49
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/ResourcesManager.cpp?cvsroot=traverso&r1=1.24&r2=1.25
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/ResourcesManager.h?cvsroot=traverso&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/dialogs/project/NewProjectDialog.cpp?cvsroot=traverso&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/dialogs/project/NewProjectDialog.h?cvsroot=traverso&r1=1.4&r2=1.5
Patches:
Index: CMakeLists.txt
===================================================================
RCS file: /sources/traverso/traverso/CMakeLists.txt,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -b -r1.26 -r1.27
--- CMakeLists.txt 14 Feb 2008 08:35:06 -0000 1.26
+++ CMakeLists.txt 22 May 2008 12:55:54 -0000 1.27
@@ -434,10 +434,6 @@
LIST(APPEND TRAVERSO_DEFINES -DSSE_OPTIMIZATIONS)
ENDIF(cat_invoke_result MATCHES sse)
- IF(cat_invoke_result MATCHES mmx)
- SET(CMAKE_CXX_FLAGS_RELEASE
"${CMAKE_CXX_FLAGS_RELEASE} -mmmx")
- ENDIF(cat_invoke_result MATCHES mmx)
-
IF(cat_invoke_result MATCHES 3dnow)
SET(CMAKE_CXX_FLAGS_RELEASE
"${CMAKE_CXX_FLAGS_RELEASE} -m3dnow")
ENDIF(cat_invoke_result MATCHES 3dnow)
Index: src/core/AudioFileCopyConvert.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/AudioFileCopyConvert.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- src/core/AudioFileCopyConvert.cpp 22 May 2008 11:28:34 -0000 1.1
+++ src/core/AudioFileCopyConvert.cpp 22 May 2008 12:55:54 -0000 1.2
@@ -26,6 +26,8 @@
#include "Export.h"
#include "AbstractAudioReader.h"
+#include "ProjectManager.h"
+#include "ResourcesManager.h"
#include "ReadSource.h"
#include "WriteSource.h"
#include "Peak.h"
@@ -39,6 +41,15 @@
connect(this, SIGNAL(dequeueTask()), this, SLOT(dequeue_tasks()),
Qt::QueuedConnection);
}
+/**
+ * Queues the ReadSource source to be copied. This function will take
ownership of the ReadSource
+ and takes care of 'deleting' it once the copy is finished!!
+
+ * @param source
+ * @param dir
+ * @param outfilename
+ * @param tracknumber
+ */
void AudioFileCopyConvert::enqueue_task(ReadSource * source, const QString&
dir, const QString & outfilename, int tracknumber)
{
QFileInfo fi(outfilename);
@@ -71,9 +82,8 @@
void AudioFileCopyConvert::process_task(CopyTask task)
{
- QString name = task.readsource->get_name();
- int length = name.length();
- emit taskStarted(name.left(length-28));
+ emit taskStarted(task.readsource->get_name());
+
uint buffersize = 16384;
DecodeBuffer decodebuffer;
@@ -95,17 +105,17 @@
spec->dataF = new audio_sample_t[buffersize * 2];
WriteSource* writesource = new WriteSource(spec);
+ bool failedToPrepareWritesource = false;
+ int oldprogress = 0;
+
if (writesource->prepare_export() == -1) {
- delete writesource;
- delete [] spec->dataF;
- delete spec;
- return;
+ failedToPrepareWritesource = true;
+ goto out;
}
// Enable on the fly generation of peak data to speedup conversion
// (no need to re-read all the audio files to generate peaks)
writesource->set_process_peaks(true);
- int oldprogress = 0;
do {
// if the user asked to stop processing, jump out of this
// loop, and cleanup any resources in use.
@@ -149,10 +159,13 @@
out:
+ if (!failedToPrepareWritesource) {
writesource->finish_export();
+ }
delete writesource;
delete [] spec->dataF;
delete spec;
+ resources_manager()->remove_source(task.readsource);
// The user asked to stop processing, exit the event loop
// and signal we're done.
Index: src/core/CMakeLists.txt
===================================================================
RCS file: /sources/traverso/traverso/src/core/CMakeLists.txt,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- src/core/CMakeLists.txt 22 May 2008 11:28:34 -0000 1.12
+++ src/core/CMakeLists.txt 22 May 2008 12:55:55 -0000 1.13
@@ -20,6 +20,8 @@
AudioClip.cpp
AudioClipGroup.cpp
AudioClipManager.cpp
+AudioFileCopyConvert.cpp
+AudioFileMerger.cpp
AudioSource.cpp
Command.cpp
Config.cpp
@@ -47,8 +49,6 @@
TimeLine.cpp
Marker.cpp
Themer.cpp
-AudioFileMerger.cpp
-AudioFileCopyConvert.cpp
ProjectConverter.cpp
)
Index: src/core/ReadSource.h
===================================================================
RCS file: /sources/traverso/traverso/src/core/ReadSource.h,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -b -r1.48 -r1.49
--- src/core/ReadSource.h 22 May 2008 11:28:34 -0000 1.48
+++ src/core/ReadSource.h 22 May 2008 12:55:55 -0000 1.49
@@ -72,7 +72,6 @@
nframes_t get_nframes() const;
int get_file_rate() const;
int get_output_rate() const {return m_outputRate;}
- int get_channel_cound() const {return m_channelCount;}
const TimeRef& get_length() const {return m_length;}
void sync(DecodeBuffer* buffer);
Index: src/core/ResourcesManager.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/ResourcesManager.cpp,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -b -r1.24 -r1.25
--- src/core/ResourcesManager.cpp 21 Jan 2008 16:22:15 -0000 1.24
+++ src/core/ResourcesManager.cpp 22 May 2008 12:55:55 -0000 1.25
@@ -416,3 +416,24 @@
}
+void ResourcesManager::remove_source(ReadSource * source)
+{
+ SourceData* data = m_sources.value(source->get_id());
+ if (!data) {
+ } else {
+ if (data->clipCount > 0) {
+ info().critical(tr("ResourcesManager: Received request
to remove Audio Source %1"
+ "but it is still in use by %2 AudioClips!!. NOT
removing it!").
+ arg(source->get_name()).arg(data->clipCount));
+ return;
+ }
+
+ m_sources.remove(source->get_id());
+
+ emit sourceRemoved(source);
+
+ delete data;
+ delete source;
+ }
+}
+
Index: src/core/ResourcesManager.h
===================================================================
RCS file: /sources/traverso/traverso/src/core/ResourcesManager.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- src/core/ResourcesManager.h 21 Jan 2008 16:22:15 -0000 1.14
+++ src/core/ResourcesManager.h 22 May 2008 12:55:55 -0000 1.15
@@ -59,6 +59,7 @@
void mark_clip_added(AudioClip* clip);
void set_source_for_clip(AudioClip* clip, ReadSource* source);
void destroy_clip(AudioClip* clip);
+ void remove_source(ReadSource* source);
bool is_clip_in_use(qint64) const;
bool is_source_in_use(qint64 id) const;
Index: src/traverso/dialogs/project/NewProjectDialog.cpp
===================================================================
RCS file:
/sources/traverso/traverso/src/traverso/dialogs/project/NewProjectDialog.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- src/traverso/dialogs/project/NewProjectDialog.cpp 22 May 2008 11:28:35
-0000 1.9
+++ src/traverso/dialogs/project/NewProjectDialog.cpp 22 May 2008 12:55:55
-0000 1.10
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2007 Remon Sijrier
+ Copyright (C) 2007-2008 Remon Sijrier
This file is part of Traverso
@@ -39,8 +39,9 @@
#include <QProgressDialog>
#include <Config.h>
-#include <Information.h>
-#include <ProjectManager.h>
+#include "Information.h"
+#include "ProjectManager.h"
+#include "ResourcesManager.h"
#include <Project.h>
#include <Sheet.h>
#include <Track.h>
@@ -188,7 +189,9 @@
void NewProjectDialog::add_files()
{
- QStringList list = QFileDialog::getOpenFileNames(this, tr("Open Audio
Files"), config().get_property("Project", "directory",
"/directory/unknown").toString(), tr("Audio files (*.wav *.flac *.ogg *.mp3
*.wv *.w64)"));
+ QStringList list = QFileDialog::getOpenFileNames(this, tr("Open Audio
Files"),
+ config().get_property("Project", "directory",
"/directory/unknown").toString(),
+ tr("Audio files (*.wav *.flac *.ogg *.mp3 *.wv
*.w64)"));
for(int i = 0; i < list.size(); ++i)
{
@@ -239,14 +242,16 @@
// TODO: progress dialog for copying files
// TODO: offer file format conversion while copying
- ReadSource* readsource = new
ReadSource(list.at(n).absolutePath() + "/", list.at(n).fileName());
- readsource->init();
+ ReadSource* readsource =
resources_manager()->import_source(list.at(n).absolutePath() + "/",
list.at(n).fileName());
+
+ if (readsource) {
m_converter->enqueue_task(readsource, destination,
list.at(n).fileName(), n);
// copy was successful, thus update the file path
QTreeWidgetItem* item = treeWidgetFiles->topLevelItem(n);
item->setData(0, Qt::ToolTipRole, fn);
}
+ }
}
void NewProjectDialog::load_all_files()
Index: src/traverso/dialogs/project/NewProjectDialog.h
===================================================================
RCS file:
/sources/traverso/traverso/src/traverso/dialogs/project/NewProjectDialog.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- src/traverso/dialogs/project/NewProjectDialog.h 22 May 2008 11:28:35
-0000 1.4
+++ src/traverso/dialogs/project/NewProjectDialog.h 22 May 2008 12:55:55
-0000 1.5
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2007 Remon Sijrier
+ Copyright (C) 2007-2008 Remon Sijrier
This file is part of Traverso
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Traverso-commit] traverso CMakeLists.txt src/core/AudioFileCopyC...,
Remon Sijrier <=