[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Traverso-commit] traverso/src audiofileio/decode/FlacAudioReader...
From: |
Remon Sijrier |
Subject: |
[Traverso-commit] traverso/src audiofileio/decode/FlacAudioReader... |
Date: |
Mon, 22 Oct 2007 16:49:44 +0000 |
CVSROOT: /sources/traverso
Module name: traverso
Changes by: Remon Sijrier <r_sijrier> 07/10/22 16:49:44
Modified files:
src/audiofileio/decode: FlacAudioReader.cpp MadAudioReader.cpp
VorbisAudioReader.cpp WPAudioReader.cpp
src/audiofileio/encode: FlacAudioWriter.cpp LameAudioWriter.cpp
VorbisAudioWriter.cpp
src/commands : Import.cpp MoveClip.cpp SplitClip.cpp
src/common : defines.h
src/core : AudioClip.cpp core.pro Export.cpp Peak.cpp
ReadSource.cpp SnapList.cpp Song.cpp Track.cpp
src/traverso/dialogs: ExportDialog.cpp
src/traverso/songcanvas: CurveView.cpp TimeLineView.cpp
Added files:
src/common : Resampler.cpp Resampler.h
Removed files:
src/core : Mixer.cpp Mixer.h
Log message:
* disable implicit conversion for all TimeRef operators. Fixes a number
of bugs.
* add a semicolon after RELAYTOOL_XXX to not confuse kdevelops c++
parser
* Start to extract resample code from ResampleAudioReader into a
dedicated class Resampler (not functional yet)
* Move Mixer.h/cpp to common dir
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/traverso/src/audiofileio/decode/FlacAudioReader.cpp?cvsroot=traverso&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/traverso/src/audiofileio/decode/MadAudioReader.cpp?cvsroot=traverso&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/traverso/src/audiofileio/decode/VorbisAudioReader.cpp?cvsroot=traverso&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/traverso/src/audiofileio/decode/WPAudioReader.cpp?cvsroot=traverso&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/traverso/src/audiofileio/encode/FlacAudioWriter.cpp?cvsroot=traverso&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/traverso/src/audiofileio/encode/LameAudioWriter.cpp?cvsroot=traverso&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/traverso/src/audiofileio/encode/VorbisAudioWriter.cpp?cvsroot=traverso&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/traverso/src/commands/Import.cpp?cvsroot=traverso&r1=1.28&r2=1.29
http://cvs.savannah.gnu.org/viewcvs/traverso/src/commands/MoveClip.cpp?cvsroot=traverso&r1=1.51&r2=1.52
http://cvs.savannah.gnu.org/viewcvs/traverso/src/commands/SplitClip.cpp?cvsroot=traverso&r1=1.32&r2=1.33
http://cvs.savannah.gnu.org/viewcvs/traverso/src/common/defines.h?cvsroot=traverso&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/traverso/src/common/Resampler.cpp?cvsroot=traverso&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/traverso/src/common/Resampler.h?cvsroot=traverso&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/AudioClip.cpp?cvsroot=traverso&r1=1.145&r2=1.146
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/core.pro?cvsroot=traverso&r1=1.42&r2=1.43
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/Export.cpp?cvsroot=traverso&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/Peak.cpp?cvsroot=traverso&r1=1.69&r2=1.70
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/ReadSource.cpp?cvsroot=traverso&r1=1.77&r2=1.78
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/SnapList.cpp?cvsroot=traverso&r1=1.19&r2=1.20
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/Song.cpp?cvsroot=traverso&r1=1.148&r2=1.149
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/Track.cpp?cvsroot=traverso&r1=1.69&r2=1.70
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/Mixer.cpp?cvsroot=traverso&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/Mixer.h?cvsroot=traverso&r1=1.2&r2=0
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/dialogs/ExportDialog.cpp?cvsroot=traverso&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/CurveView.cpp?cvsroot=traverso&r1=1.61&r2=1.62
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/TimeLineView.cpp?cvsroot=traverso&r1=1.50&r2=1.51
Patches:
Index: audiofileio/decode/FlacAudioReader.cpp
===================================================================
RCS file:
/sources/traverso/traverso/src/audiofileio/decode/FlacAudioReader.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- audiofileio/decode/FlacAudioReader.cpp 28 Sep 2007 18:33:43 -0000
1.10
+++ audiofileio/decode/FlacAudioReader.cpp 22 Oct 2007 16:49:42 -0000
1.11
@@ -38,7 +38,7 @@
#include "FLAC/stream_decoder.h"
#endif
-RELAYTOOL_FLAC
+RELAYTOOL_FLAC;
// Always put me below _all_ includes, this is needed
Index: audiofileio/decode/MadAudioReader.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/audiofileio/decode/MadAudioReader.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- audiofileio/decode/MadAudioReader.cpp 24 Sep 2007 00:57:51 -0000
1.8
+++ audiofileio/decode/MadAudioReader.cpp 22 Oct 2007 16:49:42 -0000
1.9
@@ -26,7 +26,7 @@
#include <QString>
#include <QVector>
-RELAYTOOL_MAD
+RELAYTOOL_MAD;
// Always put me below _all_ includes, this is needed
// in case we run with memory leak detection enabled!
Index: audiofileio/decode/VorbisAudioReader.cpp
===================================================================
RCS file:
/sources/traverso/traverso/src/audiofileio/decode/VorbisAudioReader.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- audiofileio/decode/VorbisAudioReader.cpp 10 Sep 2007 21:22:44 -0000
1.5
+++ audiofileio/decode/VorbisAudioReader.cpp 22 Oct 2007 16:49:42 -0000
1.6
@@ -28,7 +28,7 @@
#include <fcntl.h>
#endif
-RELAYTOOL_VORBISFILE
+RELAYTOOL_VORBISFILE;
// Always put me below _all_ includes, this is needed
// in case we run with memory leak detection enabled!
Index: audiofileio/decode/WPAudioReader.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/audiofileio/decode/WPAudioReader.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- audiofileio/decode/WPAudioReader.cpp 10 Sep 2007 21:22:44 -0000
1.10
+++ audiofileio/decode/WPAudioReader.cpp 22 Oct 2007 16:49:42 -0000
1.11
@@ -22,7 +22,7 @@
#include "WPAudioReader.h"
#include <QString>
-RELAYTOOL_WAVPACK
+RELAYTOOL_WAVPACK;
// Always put me below _all_ includes, this is needed
// in case we run with memory leak detection enabled!
Index: audiofileio/encode/FlacAudioWriter.cpp
===================================================================
RCS file:
/sources/traverso/traverso/src/audiofileio/encode/FlacAudioWriter.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- audiofileio/encode/FlacAudioWriter.cpp 24 Sep 2007 16:16:05 -0000
1.3
+++ audiofileio/encode/FlacAudioWriter.cpp 22 Oct 2007 16:49:42 -0000
1.4
@@ -34,7 +34,7 @@
#include "FLAC/stream_encoder.h"
#endif
-RELAYTOOL_FLAC
+RELAYTOOL_FLAC;
#include <QString>
Index: audiofileio/encode/LameAudioWriter.cpp
===================================================================
RCS file:
/sources/traverso/traverso/src/audiofileio/encode/LameAudioWriter.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- audiofileio/encode/LameAudioWriter.cpp 24 Sep 2007 00:57:51 -0000
1.5
+++ audiofileio/encode/LameAudioWriter.cpp 22 Oct 2007 16:49:43 -0000
1.6
@@ -26,7 +26,7 @@
#include <QString>
-RELAYTOOL_MP3LAME
+RELAYTOOL_MP3LAME;
// Always put me below _all_ includes, this is needed
// in case we run with memory leak detection enabled!
Index: audiofileio/encode/VorbisAudioWriter.cpp
===================================================================
RCS file:
/sources/traverso/traverso/src/audiofileio/encode/VorbisAudioWriter.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- audiofileio/encode/VorbisAudioWriter.cpp 24 Sep 2007 01:12:00 -0000
1.5
+++ audiofileio/encode/VorbisAudioWriter.cpp 22 Oct 2007 16:49:43 -0000
1.6
@@ -32,7 +32,7 @@
#include <QString>
-RELAYTOOL_VORBISFILE
+RELAYTOOL_VORBISFILE;
// Always put me below _all_ includes, this is needed
// in case we run with memory leak detection enabled!
Index: commands/Import.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/commands/Import.cpp,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -b -r1.28 -r1.29
--- commands/Import.cpp 6 Oct 2007 14:17:58 -0000 1.28
+++ commands/Import.cpp 22 Oct 2007 16:49:43 -0000 1.29
@@ -147,14 +147,14 @@
TimeRef startLocation;
if (!m_hasPosition) {
if (AudioClip* lastClip = m_track->get_cliplist().get_last()) {
- startLocation = lastClip->get_track_end_location() + 1;
+ startLocation = lastClip->get_track_end_location();
}
} else {
startLocation = m_position;
}
m_clip->set_track_start_location(startLocation);
- if (m_initialLength > 0) {
+ if (m_initialLength > qint64(0)) {
m_clip->set_right_edge(m_initialLength + startLocation);
}
}
Index: commands/MoveClip.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/commands/MoveClip.cpp,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -b -r1.51 -r1.52
--- commands/MoveClip.cpp 28 Sep 2007 18:33:43 -0000 1.51
+++ commands/MoveClip.cpp 22 Oct 2007 16:49:43 -0000 1.52
@@ -211,7 +211,7 @@
Command::process_command(m_originTrack->remove_clip(m_clip,
false));
}
- if (m_originTrack == m_targetTrack && m_posDiff == 0 &&
+ if (m_originTrack == m_targetTrack && m_posDiff == qint64(0) &&
! (m_actionType == "copy" || m_actionType == "move_to_start"
|| m_actionType == "move_to_end") ) {
return -1;
}
@@ -328,7 +328,7 @@
TimeRef newTrackStartLocation;
TimeRef newTrackEndLocation = d->origTrackEndLocation + diff_f;
- if (diff_f < 0 && d->origTrackStartLocation < (-1 * diff_f)) {
+ if (diff_f < TimeRef() && d->origTrackStartLocation < (-1 * diff_f)) {
newTrackStartLocation = qint64(0);
} else {
newTrackStartLocation = d->origTrackStartLocation + diff_f;
Index: commands/SplitClip.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/commands/SplitClip.cpp,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -b -r1.32 -r1.33
--- commands/SplitClip.cpp 10 Sep 2007 18:42:13 -0000 1.32
+++ commands/SplitClip.cpp 22 Oct 2007 16:49:43 -0000 1.33
@@ -49,7 +49,7 @@
int SplitClip::prepare_actions()
{
- if (m_splitPoint == 0) {
+ if (m_splitPoint == qint64(0)) {
m_splitPoint = TimeRef(cpointer().scene_x() *
m_sv->timeref_scalefactor);
}
Index: common/defines.h
===================================================================
RCS file: /sources/traverso/traverso/src/common/defines.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- common/defines.h 20 Oct 2007 12:45:09 -0000 1.1
+++ common/defines.h 22 Oct 2007 16:49:43 -0000 1.2
@@ -86,6 +86,14 @@
return left.m_position != right.m_position;
}
+ friend int operator!=(const TimeRef& left, qint64 right) {
+ return left.m_position != right;
+ }
+
+ friend int operator!=(const TimeRef& left, double right) {
+ return left.m_position != qint64(right);
+ }
+
friend TimeRef operator-(const TimeRef& left, const TimeRef& right) {
return TimeRef(left.m_position - right.m_position);
}
@@ -95,6 +103,11 @@
return location;
}
+ friend TimeRef operator-(const TimeRef& left, double right) {
+ TimeRef location(left.m_position - qint64(right));
+ return location;
+ }
+
friend TimeRef& operator-=(TimeRef& left, const TimeRef& right) {
left.m_position -= right.m_position;
return left;
@@ -105,6 +118,11 @@
return left;
}
+ friend TimeRef& operator-=(TimeRef& left, double right) {
+ left.m_position -= qint64(right);
+ return left;
+ }
+
friend TimeRef operator+(const TimeRef& left, const TimeRef& right) {
return TimeRef(left.m_position + right.m_position);
}
@@ -114,13 +132,24 @@
return location;
}
+ friend TimeRef operator+(const TimeRef& left, double right) {
+ TimeRef location(left.m_position + qint64(right));
+ return location;
+ }
+
friend TimeRef& operator+=(TimeRef& left, const TimeRef& right) {
left.m_position += right.m_position;
return left;
}
- friend qreal operator/(const TimeRef& left, const qint64 right) {
- return (qreal)left.m_position / right;
+ friend TimeRef& operator+=(TimeRef& left, qint64 right) {
+ left.m_position += right;
+ return left;
+ }
+
+ friend TimeRef& operator+=(TimeRef& left, double right) {
+ left.m_position += qint64(right);
+ return left;
}
friend TimeRef operator/(const TimeRef& left, const TimeRef& right) {
@@ -129,16 +158,31 @@
return location;
}
+ friend qreal operator/(const TimeRef& left, const qint64 right) {
+ Q_ASSERT(right != 0);
+ return (qreal)left.m_position / right;
+ }
+
+ friend qreal operator/(const TimeRef& left, double right) {
+ Q_ASSERT(right != 0);
+ return (qreal)left.m_position / qint64(right);
+ }
+
friend TimeRef operator*(const qint64 left, TimeRef& right) {
TimeRef location(left * right.m_position);
return location;
}
- friend TimeRef operator*(const TimeRef& left, TimeRef& right) {
+ friend TimeRef operator*(const TimeRef& left, const TimeRef& right) {
TimeRef location(left.m_position * right.m_position);
return location;
}
+ friend TimeRef operator*(const TimeRef& left, double right) {
+ TimeRef location(left.m_position * qint64(right));
+ return location;
+ }
+
friend int operator<(const TimeRef& left, const TimeRef& right) {
return left.m_position < right.m_position;
}
@@ -147,6 +191,10 @@
return left.m_position < right;
}
+ friend int operator<(const TimeRef& left, double right) {
+ return left.m_position < qint64(right);
+ }
+
friend int operator>(const TimeRef& left, const TimeRef& right) {
return left.m_position > right.m_position;
}
@@ -155,14 +203,34 @@
return left.m_position > right;
}
+ friend int operator>(const TimeRef& left, double right) {
+ return left.m_position > qint64(right);
+ }
+
friend int operator<=(const TimeRef& left, const TimeRef& right) {
return left.m_position <= right.m_position;
}
+ friend int operator<=(const TimeRef& left, qint64 right) {
+ return left.m_position <= right;
+ }
+
+ friend int operator<=(const TimeRef& left, double right) {
+ return left.m_position <= qint64(right);
+ }
+
friend int operator>=(const TimeRef& left, const TimeRef& right) {
return left.m_position >= right.m_position;
}
+ friend int operator>=(const TimeRef& left, qint64 right) {
+ return left.m_position >= right;
+ }
+
+ friend int operator>=(const TimeRef& left, double right) {
+ return left.m_position >= qint64(right);
+ }
+
friend int operator==(const TimeRef& left, const TimeRef& right) {
return left.m_position == right.m_position;
}
@@ -171,6 +239,10 @@
return left.m_position == right;
}
+ friend int operator==(const TimeRef& left, double right) {
+ return left.m_position == qint64(right);
+ }
+
private:
qint64 m_position;
};
Index: core/AudioClip.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/AudioClip.cpp,v
retrieving revision 1.145
retrieving revision 1.146
diff -u -b -r1.145 -r1.146
--- core/AudioClip.cpp 17 Oct 2007 11:48:51 -0000 1.145
+++ core/AudioClip.cpp 22 Oct 2007 16:49:43 -0000 1.146
@@ -658,7 +658,7 @@
// it's a bit weak this way, hopefull I'll get up something better in
the future.
// The positioning-length-offset and such stuff is still a bit weak :(
// NOTE: don't change, audio recording (finish_writesource()) assumes
there is checked for length == 0 !!!
- if (m_length == 0) {
+ if (m_length == TimeRef()) {
m_sourceEndLocation = rs->get_length();
m_length = m_sourceEndLocation;
}
Index: core/core.pro
===================================================================
RCS file: /sources/traverso/traverso/src/core/core.pro,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -b -r1.42 -r1.43
--- core/core.pro 20 Oct 2007 17:38:17 -0000 1.42
+++ core/core.pro 22 Oct 2007 16:49:43 -0000 1.43
@@ -25,6 +25,7 @@
../common/Debugger.cpp \
../common/Mixer.cpp \
../common/RingBuffer.cpp \
+ ../common/Resampler.cpp \
AudioClip.cpp \
AudioClipList.cpp \
AudioClipManager.cpp \
@@ -64,6 +65,7 @@
../common/Mixer.h \
../common/RingBuffer.h \
../common/RingBufferNPT.h \
+ ../common/Resampler.h \
AudioClip.h \
AudioClipList.h \
AudioClipManager.h \
Index: core/Export.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/Export.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- core/Export.cpp 12 Oct 2007 10:06:29 -0000 1.12
+++ core/Export.cpp 22 Oct 2007 16:49:43 -0000 1.13
@@ -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.12 2007/10/12 10:06:29 r_sijrier Exp $
+ $Id: Export.cpp,v 1.13 2007/10/22 16:49:43 r_sijrier Exp $
*/
#include "Export.h"
@@ -85,12 +85,12 @@
return -1;
}
- if (startLocation == -1) {
+ if (startLocation == qint64(-1)) {
printf("ExportSpecification: No start frame configured!\n");
return -1;
}
- if (endLocation == -1) {
+ if (endLocation == qint64(-1)) {
printf("ExportSpecification: No end frame configured!\n");
return -1;
}
@@ -110,7 +110,7 @@
return -1;
}
- if (totalTime == -1) {
+ if (totalTime == qint64(-1)) {
printf("ExportSpecification: No total frames configured!\n");
return -1;
}
@@ -120,7 +120,7 @@
return -1;
}
- if (pos == -1 && isRecording == 0) {
+ if (pos == qint64(-1) && isRecording == 0) {
printf("ExportSpecification: No position configured!\n");
return -1;
}
Index: core/Peak.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/Peak.cpp,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -b -r1.69 -r1.70
--- core/Peak.cpp 18 Oct 2007 17:37:12 -0000 1.69
+++ core/Peak.cpp 22 Oct 2007 16:49:44 -0000 1.70
@@ -613,7 +613,7 @@
int progression = 0;
- if (m_source->get_length() == 0) {
+ if (m_source->get_length() == TimeRef()) {
qWarning("Peak::create_from_scratch() : m_source (%s) has
length 0", m_source->get_name().toAscii().data());
return ret;
}
Index: core/ReadSource.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/ReadSource.cpp,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -b -r1.77 -r1.78
--- core/ReadSource.cpp 17 Oct 2007 15:13:43 -0000 1.77
+++ core/ReadSource.cpp 22 Oct 2007 16:49:44 -0000 1.78
@@ -448,7 +448,7 @@
// check if the clip's start position is within the range
// if not, fill the buffer from the earliest point this clip
// will come into play.
- if (fileposition < 0) {
+ if (fileposition < TimeRef()) {
// printf("not seeking to %ld, but too %d\n\n",
fileposition,m_clip->get_source_start_location());
fileposition = m_clip->get_source_start_location();
}
Index: core/SnapList.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/SnapList.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -b -r1.19 -r1.20
--- core/SnapList.cpp 28 Sep 2007 18:33:44 -0000 1.19
+++ core/SnapList.cpp 22 Oct 2007 16:49:44 -0000 1.20
@@ -71,7 +71,7 @@
SLPRINT("acList size is %d\n", acList->size());
// Be able to snap to trackstart
- if (m_rangeStart == 0) {
+ if (m_rangeStart == qint64(0)) {
m_xposList.append(TimeRef());
}
Index: core/Song.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/Song.cpp,v
retrieving revision 1.148
retrieving revision 1.149
diff -u -b -r1.148 -r1.149
--- core/Song.cpp 12 Oct 2007 19:38:51 -0000 1.148
+++ core/Song.cpp 22 Oct 2007 16:49:44 -0000 1.149
@@ -350,9 +350,15 @@
printf("Invoking Song::start_transport()
failed\n");
return -1;
}
- // wait a number (5) of audiodevice process cycles to
be sure we really stopped transport
- uint msecs = (audiodevice().get_buffer_size() * 5 *
1000) / audiodevice().get_sample_rate();
+ int count = 0;
+ uint msecs = (audiodevice().get_buffer_size() * 1000) /
audiodevice().get_sample_rate();
+ // wait a number (max 10) of process() cycles to be
sure we really stopped transport
+ while (m_transport) {
spec->thread->sleep_for(msecs);
+ if (count > 10) {
+ break;
+ }
+ }
}
m_rendering = true;
Index: core/Track.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/Track.cpp,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -b -r1.69 -r1.70
--- core/Track.cpp 12 Oct 2007 08:52:13 -0000 1.69
+++ core/Track.cpp 22 Oct 2007 16:49:44 -0000 1.70
@@ -106,7 +106,7 @@
QDomNode clips = doc.createElement("Clips");
foreach(AudioClip* clip, audioClipList) {
- if (clip->get_length() == 0) {
+ if (clip->get_length() == qint64(0)) {
PERROR("Clip lenght is 0! This shouldn't
happen!!!!");
continue;
}
Index: traverso/dialogs/ExportDialog.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/traverso/dialogs/ExportDialog.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- traverso/dialogs/ExportDialog.cpp 17 Oct 2007 19:12:29 -0000 1.5
+++ traverso/dialogs/ExportDialog.cpp 22 Oct 2007 16:49:44 -0000 1.6
@@ -34,10 +34,10 @@
#include <AudioDevice.h>
-RELAYTOOL_WAVPACK
-RELAYTOOL_FLAC
-RELAYTOOL_MP3LAME
-RELAYTOOL_VORBISENC
+RELAYTOOL_WAVPACK;
+RELAYTOOL_FLAC;
+RELAYTOOL_MP3LAME;
+RELAYTOOL_VORBISENC;
// Always put me below _all_ includes, this is needed
// in case we run with memory leak detection enabled!
@@ -333,6 +333,11 @@
return;
}
+ connect(m_project, SIGNAL(songExportProgressChanged(int)), this,
SLOT(update_song_progress(int)));
+ connect(m_project, SIGNAL(overallExportProgressChanged(int)), this,
SLOT(update_overall_progress(int)));
+ connect(m_project, SIGNAL(exportFinished()), this,
SLOT(render_finished()));
+ connect(m_project, SIGNAL(exportStartedForSong(Song*)), this, SLOT
(set_exporting_song(Song*)));
+
// clear extraformats, it might be different now from previous runs!
m_exportSpec->extraFormat.clear();
@@ -446,6 +451,11 @@
void ExportDialog::render_finished( )
{
+ disconnect(m_project, SIGNAL(songExportProgressChanged(int)), this,
SLOT(update_song_progress(int)));
+ disconnect(m_project, SIGNAL(overallExportProgressChanged(int)), this,
SLOT(update_overall_progress(int)));
+ disconnect(m_project, SIGNAL(exportFinished()), this,
SLOT(render_finished()));
+ disconnect(m_project, SIGNAL(exportStartedForSong(Song*)), this, SLOT
(set_exporting_song(Song*)));
+
startButton->show();
closeButton->show();
abortButton->hide();
@@ -481,11 +491,6 @@
m_exportSpec->exportdir = m_project->get_root_dir() +
"/Export/";
m_exportSpec->renderfinished = false;
exportDirName->setText(m_exportSpec->exportdir);
-
- connect(m_project, SIGNAL(songExportProgressChanged(int)),
this, SLOT(update_song_progress(int)));
- connect(m_project, SIGNAL(overallExportProgressChanged(int)),
this, SLOT(update_overall_progress(int)));
- connect(m_project, SIGNAL(exportFinished()), this,
SLOT(render_finished()));
- connect(m_project, SIGNAL(exportStartedForSong(Song*)), this,
SLOT (set_exporting_song(Song*)));
}
}
Index: traverso/songcanvas/CurveView.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/traverso/songcanvas/CurveView.cpp,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -b -r1.61 -r1.62
--- traverso/songcanvas/CurveView.cpp 28 Sep 2007 18:33:45 -0000 1.61
+++ traverso/songcanvas/CurveView.cpp 22 Oct 2007 16:49:44 -0000 1.62
@@ -160,10 +160,10 @@
m_newValue = m_newValue - ( dy / d->curveView->boundingRect().height());
TimeRef startoffset = d->curveView->get_start_offset();
- if ( ((TimeRef(m_newWhen) - startoffset) / d->scalefactor) >
d->curveView->boundingRect().width()) {
+ if ( ((TimeRef(m_newWhen) - startoffset) / qint64(d->scalefactor)) >
d->curveView->boundingRect().width()) {
m_newWhen = double(d->curveView->boundingRect().width() *
d->scalefactor + startoffset.universal_frame());
}
- if ((TimeRef(m_newWhen) - startoffset) < 0) {
+ if ((TimeRef(m_newWhen) - startoffset) < TimeRef()) {
m_newWhen = startoffset.universal_frame();
}
Index: traverso/songcanvas/TimeLineView.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/traverso/songcanvas/TimeLineView.cpp,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -b -r1.50 -r1.51
--- traverso/songcanvas/TimeLineView.cpp 28 Sep 2007 18:33:45 -0000
1.50
+++ traverso/songcanvas/TimeLineView.cpp 22 Oct 2007 16:49:44 -0000
1.51
@@ -148,8 +148,8 @@
d->bypassjog = true;
// Move 1 pixel to the left
TimeRef newpos = TimeRef(m_newWhen - d->scalefactor);
- if (newpos < 0) {
- newpos = 0;
+ if (newpos < TimeRef()) {
+ newpos = TimeRef();
}
m_newWhen = newpos;
do_action();
@@ -182,8 +182,8 @@
newpos = slist->get_snap_value(newpos);
}
- if (newpos < 0 ) {
- newpos = 0;
+ if (newpos < TimeRef()) {
+ newpos = TimeRef();
}
m_newWhen = newpos;
@@ -298,7 +298,7 @@
// minor is double so they line up right with the majors,
// despite not always being an even number of frames
// @Ben : is still still the same when using TimeRef based calculations?
- TimeRef minor = TimeRef(major/10);
+ TimeRef minor = TimeRef(major/qint64(10));
TimeRef firstLocation = TimeRef(xstart * m_sv->timeref_scalefactor);
TimeRef lastLocation = TimeRef(xstart * m_sv->timeref_scalefactor +
pixelcount * m_sv->timeref_scalefactor);
@@ -376,7 +376,7 @@
// check if it is the first marker added to the timeline
if (!m_timeline->get_markers().size()) {
- if (when > 0) { // add one at the beginning of the song
+ if (when > TimeRef()) { // add one at the beginning of the song
Marker* m = new Marker(m_timeline, TimeRef(),
Marker::CDTRACK);
m->set_description("");
group->add_command(m_timeline->add_marker(m));
Index: common/Resampler.cpp
===================================================================
RCS file: common/Resampler.cpp
diff -N common/Resampler.cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ common/Resampler.cpp 22 Oct 2007 16:49:43 -0000 1.1
@@ -0,0 +1,178 @@
+/*
+Copyright (C) 2007 Remon Sijrier
+
+This file is part of Traverso
+
+Traverso is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+*/
+
+#include "Resampler.h"
+
+#include "Debugger.h"
+
+#define OVERFLOW_SIZE 512
+
+Resampler::Resampler()
+{
+ m_isResampleAvailable = false;
+ m_overflowBuffer = 0;
+ m_inputBuffer = 0;
+ m_outputBuffer = 0;
+ m_overflowUsed = 0;
+}
+
+Resampler::~ Resampler()
+{
+ src_delete(m_srcState);
+
+ if (m_overflowBuffer) {
+ delete [] m_overflowBuffer;
+ }
+
+}
+
+void Resampler::set_output_rate(uint rate)
+{
+ m_outputRate = rate;
+ reset();
+}
+
+void Resampler::set_input_rate(uint rate)
+{
+ m_inputRate = rate;
+}
+
+void Resampler::reset()
+{
+ src_reset(m_srcState);
+ m_srcData.end_of_input = 0;
+
+ m_overflowUsed = 0;
+
+ // Read extra frames from the child reader on the first read after a
seek.
+ // This keeps the resampler supplied with plenty of samples to produce
the
+ // requested output on each read.
+ m_readExtraFrames = OVERFLOW_SIZE;
+}
+
+void Resampler::clear_buffers()
+{
+ if (m_overflowBuffer) {
+ delete [] m_overflowBuffer;
+ m_overflowBuffer = 0;
+ }
+}
+
+int Resampler::set_converter_type(int converter_type)
+{
+ int error;
+
+ src_delete(m_srcState);
+
+ clear_buffers();
+
+ m_srcState = src_new(converter_type, 1, &error);
+
+ if (!m_srcState) {
+ PERROR("ResampleAudioReader: couldn't create libSampleRate
SRC_STATE");
+ m_isResampleAvailable = false;
+ return -1;
+ } else {
+ m_isResampleAvailable = true;
+ }
+
+ return 1;
+}
+
+int Resampler::prepare_process(nframes_t fileCnt)
+{
+ bufferUsed = m_overflowUsed;
+
+ if (m_overflowUsed) {
+ // Copy pre-existing overflow into the buffer
+ memcpy(m_inputBuffer, m_overflowBuffer, m_overflowUsed *
sizeof(audio_sample_t));
+ m_inputBuffer += m_overflowUsed;
+ }
+
+ return fileCnt + m_readExtraFrames - m_overflowUsed;
+}
+
+int Resampler::process(nframes_t frames)
+{
+
+// bufferUsed += m_reader->read(m_resampleDecodeBuffer, fileCnt +
m_readExtraFrames - m_overflowUsed);
+
+ if (m_overflowUsed) {
+ m_inputBuffer -= m_overflowUsed;
+ }
+ //printf("Resampler: Read %lu of %lu (%lu)\n", bufferUsed, fileCnt +
OVERFLOW_SIZE - m_overflowUsed, m_reader->get_length());
+
+ // Don't read extra frames next time.
+ m_readExtraFrames = 0;
+
+/* if (m_reader->eof()) {
+ m_srcData.end_of_input = 1;
+ }*/
+
+ nframes_t framesToConvert = frames;
+/* if (frameCount > m_nframes - m_readPos) {
+ framesToConvert = m_nframes - m_readPos;
+ }*/
+
+ // Set up sample rate converter struct for s.r.c. processing
+ m_srcData.data_in = m_inputBuffer;
+ m_srcData.input_frames = bufferUsed;
+ m_srcData.data_out = m_outputBuffer;
+ m_srcData.output_frames = framesToConvert;
+ m_srcData.src_ratio = (double) m_outputRate / m_inputRate;
+ src_set_ratio(m_srcState, m_srcData.src_ratio);
+
+ if (src_process(m_srcState, &m_srcData)) {
+ PERROR("Resampler: src_process() error!");
+ return 0;
+ }
+
+ framesRead = m_srcData.output_frames_gen;
+
+ m_overflowUsed = bufferUsed - m_srcData.input_frames_used;
+ if (m_overflowUsed < 0) {
+ m_overflowUsed = 0;
+ }
+ if (m_overflowUsed) {
+ // If there was overflow, save it for the next read.
+ memcpy(m_overflowBuffer, m_inputBuffer +
m_srcData.input_frames_used, m_overflowUsed * sizeof(audio_sample_t));
+ }
+
+/* // Pad end of file with 0s if necessary
+ if (framesRead == 0 && m_readPos < get_nframes()) {
+ int padLength = get_nframes() - m_readPos;
+ printf("Resampler: padding: %d\n", padLength);
+ for (int chan = 0; chan < m_channels; chan++) {
+ memset(buffer->destination[chan] + framesRead, 0,
padLength * sizeof(audio_sample_t));
+ }
+ framesRead += padLength;
+ }*/
+
+/* // Truncate so we don't return too many samples
+ if (m_readPos + framesRead > get_nframes()) {
+ printf("Resampler: truncating: %d\n", framesRead -
(get_nframes() - m_readPos));
+ framesRead = get_nframes() - m_readPos;
+ }*/
+
+// printf("framesRead: %lu of %lu (overflow: %lu) (at: %lu of %lu)\n",
framesRead, frameCount, m_overflowUsed, m_readPos /*+ framesRead*/,
get_nframes());
+
+ return framesRead;
+}
Index: common/Resampler.h
===================================================================
RCS file: common/Resampler.h
diff -N common/Resampler.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ common/Resampler.h 22 Oct 2007 16:49:43 -0000 1.1
@@ -0,0 +1,66 @@
+/*
+Copyright (C) 2007 Remon Sijrier
+
+This file is part of Traverso
+
+Traverso is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+*/
+
+#ifndef RESAMPLER_H
+#define RESAMPLER_H
+
+#include "defines.h"
+#include <samplerate.h>
+
+
+class Resampler : public QObject
+{
+public :
+ Resampler();
+ ~Resampler();
+
+ void set_output_rate(uint rate);
+ void set_input_rate(uint rate);
+
+ void set_input_buffer(audio_sample_t* buffer);
+ void set_output_buffer(audio_sample_t* buffer);
+
+ int set_converter_type(int converter_type);
+ int process(nframes_t frames);
+ int prepare_process(nframes_t fileCnt);
+
+ void reset();
+ void clear_buffers();
+
+private:
+
+ SRC_STATE* m_srcState;
+ SRC_DATA m_srcData;
+ audio_sample_t* m_overflowBuffer;
+ audio_sample_t* m_inputBuffer;
+ audio_sample_t* m_outputBuffer;
+ long m_overflowUsed;
+ uint m_outputRate;
+ uint m_inputRate;
+ bool m_isResampleAvailable;
+ nframes_t m_readExtraFrames;
+ nframes_t bufferUsed;
+ nframes_t framesRead;
+};
+
+
+
+#endif
Index: core/Mixer.cpp
===================================================================
RCS file: core/Mixer.cpp
diff -N core/Mixer.cpp
--- core/Mixer.cpp 20 Apr 2006 14:51:39 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,61 +0,0 @@
-/*
- Copyright (C) 2005-2006 Remon Sijrier
-
- This file is part of Traverso
-
- Traverso is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
- $Id: Mixer.cpp,v 1.1 2006/04/20 14:51:39 r_sijrier Exp $
-*/
-
-#include "Mixer.h"
-#include "defines.h"
-#include <cmath>
-
-Mixer::compute_peak_t Mixer::compute_peak = 0;
-Mixer::apply_gain_to_buffer_t Mixer::apply_gain_to_buffer = 0;
-Mixer::mix_buffers_with_gain_t Mixer::mix_buffers_with_gain = 0;
-Mixer::mix_buffers_no_gain_t Mixer::mix_buffers_no_gain = 0;
-
-
-
-float default_compute_peak (audio_sample_t* buf, nframes_t nsamples, float
current)
-{
- for (nframes_t i = 0; i < nsamples; ++i) {
- current = f_max (current, fabsf (buf[i]));
- }
-
- return current;
-}
-
-void default_apply_gain_to_buffer (audio_sample_t* buf, nframes_t nframes,
float gain)
-{
- for (nframes_t i=0; i<nframes; i++)
- buf[i] *= gain;
-}
-
-void default_mix_buffers_with_gain (audio_sample_t* dst, audio_sample_t* src,
nframes_t nframes, float gain)
-{
- for (nframes_t i = 0; i < nframes; i++) {
- dst[i] += src[i] * gain;
- }
-}
-
-void default_mix_buffers_no_gain (audio_sample_t* dst, audio_sample_t* src,
nframes_t nframes)
-{
- for (nframes_t i=0; i < nframes; i++) {
- dst[i] += src[i];
- }
-}
Index: core/Mixer.h
===================================================================
RCS file: core/Mixer.h
diff -N core/Mixer.h
--- core/Mixer.h 8 Nov 2006 14:49:37 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,99 +0,0 @@
-/*
- Copyright (C) 2005-2006 Remon Sijrier
-
- This file is part of Traverso
-
- Traverso is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
- $Id: Mixer.h,v 1.2 2006/11/08 14:49:37 r_sijrier Exp $
-*/
-
-#ifndef MIXER_H
-#define MIXER_H
-
-#include "defines.h"
-#include <cmath>
-
-
-static inline float f_max(float x, float a)
-{
- x -= a;
- x += fabsf (x);
- x *= 0.5f;
- x += a;
-
- return (x);
-}
-
-// This is for VU : db = 20 * log ( sample / MaxSample )
-static inline float dB_to_scale_factor (float dB)
-{
- // examples :
- // dB = 0 will return 1.0
- // db = -6.0 will return 0.5
- // db = -inf will return 0.0
- return dB > -120.0f ? ::pow(10.0f, dB * 0.05f) : 0.0f;
-}
-
-
-static inline float coefficient_to_dB (float coeff)
-{
- // examples :
- // coeff = 1.0 will return 0 dB
- // coeff = 0.5 will return -6 dB
- // coeff = 0.0 will return -infinite dB
- if (coeff < 0.000001f) //Should be (coeff == 0), but this will
do...
- return (-120.0f); //Should be minus infinity, but it will
do for busMonitor purposes
- return 20.0f * log10 (coeff);
-}
-
-
-float default_compute_peak (audio_sample_t* buf,
nframes_t nsamples, float current);
-void default_apply_gain_to_buffer (audio_sample_t* buf,
nframes_t nframes, float gain);
-void default_mix_buffers_with_gain (audio_sample_t* dst,
audio_sample_t* src, nframes_t nframes, float gain);
-void default_mix_buffers_no_gain (audio_sample_t* dst,
audio_sample_t* src, nframes_t nframes);
-
-#if defined (SSE_OPTIMIZATIONS)
-
-extern "C"
-{
- /* SSE functions */
- float x86_sse_compute_peak (audio_sample_t* buf,
nframes_t nsamples, float current);
- void x86_sse_apply_gain_to_buffer (audio_sample_t* buf,
nframes_t nframes, float gain);
- void x86_sse_mix_buffers_with_gain (audio_sample_t* dst,
audio_sample_t* src, nframes_t nframes, float gain);
- void x86_sse_mix_buffers_no_gain (audio_sample_t* dst,
audio_sample_t* src, nframes_t nframes);
-}
-#endif
-
-
-
-class Mixer
-{
-public:
- typedef float (*compute_peak_t)
(audio_sample_t* , nframes_t, float);
- typedef void (*apply_gain_to_buffer_t)
(audio_sample_t* , nframes_t, float);
- typedef void (*mix_buffers_with_gain_t) (audio_sample_t* ,
audio_sample_t* , nframes_t, float);
- typedef void (*mix_buffers_no_gain_t) (audio_sample_t* ,
audio_sample_t* , nframes_t);
-
- static compute_peak_t compute_peak;
- static apply_gain_to_buffer_t apply_gain_to_buffer;
- static mix_buffers_with_gain_t mix_buffers_with_gain;
- static mix_buffers_no_gain_t mix_buffers_no_gain;
-};
-
-#endif
-
-
-//eof
- [Traverso-commit] traverso/src audiofileio/decode/FlacAudioReader...,
Remon Sijrier <=