[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Traverso-commit] traverso/src/core AudioClip.cpp
From: |
Remon Sijrier |
Subject: |
[Traverso-commit] traverso/src/core AudioClip.cpp |
Date: |
Fri, 25 May 2007 10:37:00 +0000 |
CVSROOT: /sources/traverso
Module name: traverso
Changes by: Remon Sijrier <r_sijrier> 07/05/25 10:37:00
Modified files:
src/core : AudioClip.cpp
Log message:
AudioClip::process() : Check if clip start is within the buffer range,
if so,
calculate and apply offset to the mixdown pos and mixdown buffer!
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/AudioClip.cpp?cvsroot=traverso&r1=1.98&r2=1.99
Patches:
Index: AudioClip.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/AudioClip.cpp,v
retrieving revision 1.98
retrieving revision 1.99
diff -u -b -r1.98 -r1.99
--- AudioClip.cpp 24 May 2007 17:45:19 -0000 1.98
+++ AudioClip.cpp 25 May 2007 10:37:00 -0000 1.99
@@ -385,7 +385,7 @@
//
// Function called in RealTime AudioThread processing path
//
-int AudioClip::process(nframes_t nframes, audio_sample_t* mixdown, uint
channel)
+int AudioClip::process(nframes_t nframes, audio_sample_t* buffer, uint channel)
{
Q_ASSERT(m_song);
@@ -400,37 +400,29 @@
return -1;
}
+ if (isMuted || ( (m_gain * m_normfactor) == 0.0f) ) {
+ return 0;
+ }
-// #define debug
-
-#if defined (debug)
- printf("%s\n", m_name.toAscii().data());
- printf("trackStartFrame is %d\n", trackStartFrame);
- printf("trackEndFrame is %d\n", trackEndFrame);
- printf("song->transport is %d\n",
m_song->get_transport_frame());
- printf("diff trackEndFrame, song->transport is %d\n",
(int)trackEndFrame - m_song->get_transport_frame());
- printf("diff trackStartFrame, song->transport is %d\n",
(int)trackStartFrame - m_song->get_transport_frame());
- printf("clip trackEndFrame - song->transport_frame is %d\n",
trackEndFrame - m_song->get_transport_frame());
-#endif
nframes_t mix_pos;
+ audio_sample_t* mixdown;
+
+ nframes_t transportFrame = m_song->get_transport_frame();
+ nframes_t upperRange = transportFrame + nframes;
- if ( (trackStartFrame <= (m_song->get_transport_frame())) &&
(trackEndFrame > (m_song->get_transport_frame())) ) {
- mix_pos = m_song->get_transport_frame() - trackStartFrame +
sourceStartFrame;
-#if defined (debug)
- printf("mix_pos is %d\n", mix_pos);
-#endif
+ if ( (trackStartFrame < upperRange) && (trackEndFrame > transportFrame)
) {
+ if (transportFrame < trackStartFrame) {
+ uint offset = trackStartFrame - transportFrame;
+ mix_pos = sourceStartFrame;
+ mixdown = buffer + offset;
+ nframes = nframes - offset;
} else {
-#if defined (debug)
- printf("Not processing this Clip\n\n");
- printf("END %s\n\n", m_name.toAscii().data());
-#endif
- return 0;
+ mix_pos = transportFrame - trackStartFrame +
sourceStartFrame;
+ mixdown = buffer;
}
-
-
- if (isMuted || ( (m_gain * m_normfactor) == 0.0f) ) {
+ } else {
return 0;
}
@@ -444,12 +436,6 @@
read_frames = m_readSource->file_read(channel, mixdown,
mix_pos, nframes);
}
-#if defined (debug)
- printf("read frames is %d\n", read_frames);
- printf("END %s\n\n", m_name.toAscii().data());
-#endif
-
-
if (read_frames == 0) {
return 0;
}