@@ -838,31 +838,30 @@ TEST_F (TimeStretchProcessorTests, ChangeParametersDuringProcessing)
838838// ==============================================================================
839839TEST_F (TimeStretchProcessorTests, DifferentTimeRatios)
840840{
841- TimeStretchProcessor processor;
842- ASSERT_TRUE (processor.prepare (spec).wasOk ());
841+ const double ratios[] = { 0.5 , 0.75 , 1.0 , 1.5 , 2.0 , 3.0 };
843842
844- // Set input provider
845- auto provider = [&] (int64 beginFrame, int numFrames, float * const * destChannels, int channelStride, int & muteHead, int & muteTail)
843+ for (auto ratio : ratios)
846844 {
847- muteHead = 0 ;
848- muteTail = 0 ;
849- for (int ch = 0 ; ch < numChannels; ++ch)
845+ TimeStretchProcessor processor;
846+ ASSERT_TRUE (processor.prepare (spec).wasOk ());
847+
848+ // Set input provider
849+ auto provider = [&] (int64 beginFrame, int numFrames, float * const * destChannels, int channelStride, int & muteHead, int & muteTail)
850850 {
851- for (int i = 0 ; i < numFrames; ++i)
851+ muteHead = 0 ;
852+ muteTail = 0 ;
853+ for (int ch = 0 ; ch < numChannels; ++ch)
852854 {
853- const int srcIndex = static_cast <int > ((beginFrame + i) % maximumBlockSize);
854- destChannels[ch][i] = inputBuffer.getReadPointer (ch)[srcIndex];
855+ for (int i = 0 ; i < numFrames; ++i)
856+ {
857+ const int srcIndex = static_cast <int > ((beginFrame + i) % maximumBlockSize);
858+ destChannels[ch][i] = inputBuffer.getReadPointer (ch)[srcIndex];
859+ }
855860 }
856- }
857- };
858- processor.setInputProvider (provider);
859-
860- const double ratios[] = { 0.5 , 0.75 , 1.0 , 1.5 , 2.0 , 3.0 };
861+ };
862+ processor.setInputProvider (provider);
861863
862- for (auto ratio : ratios)
863- {
864864 processor.setTimeRatio (ratio);
865- processor.reset ();
866865
867866 auto result = processor.process (inputBuffer.getArrayOfReadPointers (),
868867 inputBuffer.getNumSamples (),
@@ -875,31 +874,30 @@ TEST_F (TimeStretchProcessorTests, DifferentTimeRatios)
875874
876875TEST_F (TimeStretchProcessorTests, DifferentPitchRatios)
877876{
878- TimeStretchProcessor processor;
879- ASSERT_TRUE (processor.prepare (spec).wasOk ());
877+ const double ratios[] = { 0.5 , 0.75 , 1.0 , 1.5 , 2.0 };
880878
881- // Set input provider
882- auto provider = [&] (int64 beginFrame, int numFrames, float * const * destChannels, int channelStride, int & muteHead, int & muteTail)
879+ for (auto ratio : ratios)
883880 {
884- muteHead = 0 ;
885- muteTail = 0 ;
886- for (int ch = 0 ; ch < numChannels; ++ch)
881+ TimeStretchProcessor processor;
882+ ASSERT_TRUE (processor.prepare (spec).wasOk ());
883+
884+ // Set input provider
885+ auto provider = [&] (int64 beginFrame, int numFrames, float * const * destChannels, int channelStride, int & muteHead, int & muteTail)
887886 {
888- for (int i = 0 ; i < numFrames; ++i)
887+ muteHead = 0 ;
888+ muteTail = 0 ;
889+ for (int ch = 0 ; ch < numChannels; ++ch)
889890 {
890- const int srcIndex = static_cast <int > ((beginFrame + i) % maximumBlockSize);
891- destChannels[ch][i] = inputBuffer.getReadPointer (ch)[srcIndex];
891+ for (int i = 0 ; i < numFrames; ++i)
892+ {
893+ const int srcIndex = static_cast <int > ((beginFrame + i) % maximumBlockSize);
894+ destChannels[ch][i] = inputBuffer.getReadPointer (ch)[srcIndex];
895+ }
892896 }
893- }
894- };
895- processor.setInputProvider (provider);
896-
897- const double ratios[] = { 0.5 , 0.75 , 1.0 , 1.5 , 2.0 };
897+ };
898+ processor.setInputProvider (provider);
898899
899- for (auto ratio : ratios)
900- {
901900 processor.setPitchRatio (ratio);
902- processor.reset ();
903901
904902 auto result = processor.process (inputBuffer.getArrayOfReadPointers (),
905903 inputBuffer.getNumSamples (),
0 commit comments