Update of /cvsroot/audacity/audacity-src/src In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv31475
Modified Files: AudioIO.cpp AudioIO.h Log Message: Fix for looping bug when sampling rates are different. Index: AudioIO.cpp =================================================================== RCS file: /cvsroot/audacity/audacity-src/src/AudioIO.cpp,v retrieving revision 1.229 retrieving revision 1.230 diff -u -d -r1.229 -r1.230 --- AudioIO.cpp 12 Sep 2009 18:43:01 -0000 1.229 +++ AudioIO.cpp 19 Oct 2009 18:18:16 -0000 1.230 @@ -259,6 +259,8 @@ #ifdef AUTOMATED_INPUT_LEVEL_ADJUSTMENT mAILAActive = false; #endif + mSilentBuf = NULL; + mLastSilentBufSize = 0; mStreamToken = 0; mStopStreamCount = 0; @@ -350,6 +352,9 @@ (Kill is the not-graceful way.) */ wxYield(); mThread->Delete(); + + if(mSilentBuf) + DeleteSamples(mSilentBuf); delete [] mTempFloats; delete mThread; @@ -2071,6 +2076,23 @@ mPlaybackMixers[i]->Process(lrint(deltat * mRate)); samplePtr warpedSamples = mPlaybackMixers[i]->GetBuffer(); mPlaybackBuffers[i]->Put(warpedSamples, floatSample, processed); + //if looping and processed is less than the full chunk/block/buffer that gets pulled from + //other longer tracks, then we still need to advance the ring buffers or + //we'll trip up on ourselves when we start them back up again. + //if not looping we never start them up again, so its okay to not do anything + if(processed < lrint(deltat * mRate) && mPlayLooped) + { + if(mLastSilentBufSize < lrint(deltat * mRate)) + { + //delete old if necessary + if(mSilentBuf) + DeleteSamples(mSilentBuf); + mLastSilentBufSize=lrint(deltat * mRate); + mSilentBuf = NewSamples(mLastSilentBufSize, floatSample); + ClearSamples(mSilentBuf, floatSample, 0, mLastSilentBufSize); + } + mPlaybackBuffers[i]->Put(mSilentBuf, floatSample, lrint(deltat * mRate) - processed); + } } // msmeyer: If playing looped, check if we are at the end of the buffer Index: AudioIO.h =================================================================== RCS file: /cvsroot/audacity/audacity-src/src/AudioIO.h,v retrieving revision 1.78 retrieving revision 1.79 diff -u -d -r1.78 -r1.79 --- AudioIO.h 12 Sep 2009 16:47:36 -0000 1.78 +++ AudioIO.h 19 Oct 2009 18:18:16 -0000 1.79 @@ -489,6 +489,9 @@ double mCutPreviewGapStart; double mCutPreviewGapLen; + samplePtr mSilentBuf; + sampleCount mLastSilentBufSize; + AudioIOListener* mListener; friend class AudioThread; ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Audacity-cvs mailing list Audacity-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/audacity-cvs