Пример #1
0
 void testInterpolatingDelayZero()
 {
     Jamoma::SampleVector                    input = {0,1,0,0,   0,0,0,0,   2,0,0,0,   0,0,3,0 };
     Jamoma::SampleVector                    output;
     Jamoma::DelayWithLinearInterpolation	delay;
     
     delay.size = 0.;
     
     for (auto& in : input) {
         Jamoma::Sample out = delay(in);
         output.push_back(out);
     }
     
     Jamoma::Sample	temp = 0.0;
     Jamoma::Sample	tempExpected = 0.0;
     int				badSampleCount = 0;
     
     for (int i=0; i < input.size(); i++) {
         temp = output[i];
         tempExpected = input[i];
         
         if (! mTest->compare(temp, tempExpected, true, 8) ) {
             badSampleCount++;
             std::cout << "sample " << i << " had a difference of " << std::fabs(temp - tempExpected) << std::endl;
         }
     }
     
     mTest->TEST_ASSERT("delay.size of 0 produced correct output", badSampleCount == 0);
     
 }
Пример #2
0
	void testDelaySingleSample()
	{
		Jamoma::SampleVector	input = {0,1,0,0,   0,0,0,0,   2,0,0,0,   0,0,3,0 };
		Jamoma::SampleVector	output;
		Jamoma::Delay			delay;
		
		delay.size = 3;
		
		for (auto& in : input) {
			Jamoma::Sample out = delay(in);
			output.push_back(out);
		}
		
		mTest->TEST_ASSERT("First Vector Output Correct",     output[0] == 0 && output[1] == 0 && output[2] == 0 && output[3] == 0
														   && output[4] == 1 && output[5] == 0 && output[6] == 0 && output[7] == 0
														   && output[8] == 0 && output[9] == 0 && output[10] == 0 && output[11] == 2
														   && output[12] == 0 && output[13] == 0 && output[14] == 0 && output[15] == 0
						   );

	}