• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ TTAudioSignalPtr类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中TTAudioSignalPtr的典型用法代码示例。如果您正苦于以下问题:C++ TTAudioSignalPtr类的具体用法?C++ TTAudioSignalPtr怎么用?C++ TTAudioSignalPtr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了TTAudioSignalPtr类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: test

TTErr TukeyWindow::test(TTValue& returnedTestInfo)
{
	int					errorCount = 0;
	int					testAssertionCount = 0;
	int					badSampleCount = 0;
	TTAudioObjectBasePtr	windowObject = NULL;
	TTAudioSignalPtr	input = NULL;
	TTAudioSignalPtr	output = NULL;
	int					N = 128;
	TTValue				v;
	TTFloat64			testAlpha = 0.5;
	
	// setup windowObject
	TTObjectBaseInstantiate(TT("WindowFunction"), &windowObject, TTValue(1));
	windowObject->setAttributeValue(TT("function"), TT("tukey"));
	windowObject->setAttributeValue(TT("mode"), TT("apply"));
	
	// set the value for alpha
	windowObject->setAttributeValue(TT("alpha"), testAlpha);
	TTTestLog("alpha was set to %.10f for test", testAlpha);
	
	// create 1 channel audio signal objects
	TTObjectBaseInstantiate(kTTSym_audiosignal, &input, 1);
	TTObjectBaseInstantiate(kTTSym_audiosignal, &output, 1);
	input->allocWithVectorSize(N);
	output->allocWithVectorSize(N);
									
	// create a signal to be transformed and then process it)
	input->fill(1.0);
	windowObject->process(input, output);
	
	// now test the output
	for (int n=0; n<N; n++)
	{
		TTBoolean result = !TTTestFloatEquivalence(output->mSampleVectors[0][n], sTukeyWindowCoefficients128[n]);
		badSampleCount += result;
		if (result) 
			TTTestLog("BAD SAMPLE @ n=%i ( value=%.10f	expected=%.10f )", n, output->mSampleVectors[0][n], sTukeyWindowCoefficients128[n]);
	}
	
	TTTestAssertion("Produces correct window coefficients", 
					badSampleCount == 0,
					testAssertionCount, 
					errorCount);
	if (badSampleCount)
		TTTestLog("badSampleCount is %i", badSampleCount);
	
	
	TTObjectBaseRelease(&input);
	TTObjectBaseRelease(&output);
	TTObjectBaseRelease(&windowObject);

	
	// wrap up test results and pass back to whoever called test
	return TTTestFinish(testAssertionCount, errorCount, returnedTestInfo);

}
开发者ID:ChristianFrisson,项目名称:JamomaCore,代码行数:57,代码来源:TTTukeyWindow.test.cpp


示例2: defaultCalculateMethod

TTErr TTAudioObjectBase::defaultCalculateMethod(const TTFloat64& x, TTFloat64& y, TTPtr data)
{
	TTAudioSignalPtr	in;
	TTAudioSignalPtr	out;
	TTErr				err;
	
	TTObjectBaseInstantiate(kTTSym_audiosignal, &in, 1);
	TTObjectBaseInstantiate(kTTSym_audiosignal, &out, 1);
	
	in->allocWithVectorSize(1);
	out->allocWithVectorSize(1);
	
	in->mSampleVectors[0][0] = x;
	err = process(in, out);
	y = out->mSampleVectors[0][0];
	
	TTObjectBaseRelease(&in);
	TTObjectBaseRelease(&out);

	return err;
}
开发者ID:Cplaton,项目名称:JamomaCore,代码行数:21,代码来源:TTAudioObjectBase.cpp


示例3: TTTestLog

TTErr TTGain::test(TTValue& returnedTestInfo)
{
	// preliminary setup
	
	int	errorCount = 0;
	int testAssertionCount = 0;
	
	TTTestLog("Testing Parameter value conversions");
	
	
	// N test assertions
	
	// Test 1: trival value conversion
	this->setAttributeValue(TT("midiGain"), 100);
	TTTestAssertion("midi gain of 100 == linear gain of 1.", 
					TTTestFloatEquivalence(this->mGain, 1.0), 
					testAssertionCount, 
					errorCount);
	
	// Test 2: trival value conversion
	this->setAttributeValue(TT("midiGain"), 99);
	TTTestAssertion("midi gain of 99 != linear gain of 1.", 
					TTTestFloatEquivalence(this->mGain, 1.0, false), 
					testAssertionCount, 
					errorCount);
	
	// Test 3: audio test
	// set the input signals 1
	// apply -6 dB gain
	// check that the signals are properly scaled
	
	TTAudioSignalPtr input = NULL;
	TTAudioSignalPtr output = NULL;
	
	// create 1 channel audio signal objects
	TTObjectInstantiate(kTTSym_audiosignal, &input, 1);
	TTObjectInstantiate(kTTSym_audiosignal, &output, 1);
	
	input->allocWithVectorSize(64);
	output->allocWithVectorSize(64);
	
	for (int i=0; i<64; i++)
		input->mSampleVectors[0][i] = 1.0;
	
	this->setAttributeValue(TT("gain"), -6.0);
	this->process(input, output);
	
	TTSampleValuePtr samples = output->mSampleVectors[0];
	int validSampleCount = 0;
	
	for (int i=0; i<64; i++) {
		validSampleCount += TTTestFloatEquivalence(0.5011872336272722, samples[i]);
	}
	TTTestAssertion("accumulated audio error at gain = -6 dB", 
					validSampleCount == 64, 
					testAssertionCount, 
					errorCount);
	TTTestLog("Numbe of bad samples: %i", 64-validSampleCount);
	
	TTObjectRelease(&input);
	TTObjectRelease(&output);
	
	
	// Wrap up the test results to pass back to whoever called this test
	return TTTestFinish(testAssertionCount, errorCount, returnedTestInfo);
}
开发者ID:RWelsh,项目名称:JamomaDSP,代码行数:66,代码来源:TTGain.test.cpp


示例4: test

TTErr TTSmoothPolynomialFunction::test(TTValue& returnedTestInfo)
{
	int					errorCount = 0;
	int					testAssertionCount = 0;
	int					badSampleCount = 0;
	TTAudioSignalPtr	input = NULL;
	TTAudioSignalPtr	output = NULL;
	int					N = 128;
	TTValue				v;
	

TTFloat64 inputSignal1[128] = {
	0.0000000000000000e+00, 
	7.8740157480314960e-03, 
	1.5748031496062992e-02, 
	2.3622047244094488e-02, 
	3.1496062992125984e-02, 
	3.9370078740157480e-02, 
	4.7244094488188976e-02, 
	5.5118110236220472e-02, 
	6.2992125984251968e-02, 
	7.0866141732283464e-02, 
	7.8740157480314960e-02, 
	8.6614173228346455e-02, 
	9.4488188976377951e-02, 
	1.0236220472440945e-01, 
	1.1023622047244094e-01, 
	1.1811023622047244e-01, 
	1.2598425196850394e-01, 
	1.3385826771653545e-01, 
	1.4173228346456693e-01, 
	1.4960629921259844e-01, 
	1.5748031496062992e-01, 
	1.6535433070866143e-01, 
	1.7322834645669291e-01, 
	1.8110236220472442e-01, 
	1.8897637795275590e-01, 
	1.9685039370078741e-01, 
	2.0472440944881889e-01, 
	2.1259842519685040e-01, 
	2.2047244094488189e-01, 
	2.2834645669291340e-01, 
	2.3622047244094488e-01, 
	2.4409448818897639e-01, 
	2.5196850393700787e-01, 
	2.5984251968503935e-01, 
	2.6771653543307089e-01, 
	2.7559055118110237e-01, 
	2.8346456692913385e-01, 
	2.9133858267716534e-01, 
	2.9921259842519687e-01, 
	3.0708661417322836e-01, 
	3.1496062992125984e-01, 
	3.2283464566929132e-01, 
	3.3070866141732286e-01, 
	3.3858267716535434e-01, 
	3.4645669291338582e-01, 
	3.5433070866141730e-01, 
	3.6220472440944884e-01, 
	3.7007874015748032e-01, 
	3.7795275590551181e-01, 
	3.8582677165354329e-01, 
	3.9370078740157483e-01, 
	4.0157480314960631e-01, 
	4.0944881889763779e-01, 
	4.1732283464566927e-01, 
	4.2519685039370081e-01, 
	4.3307086614173229e-01, 
	4.4094488188976377e-01, 
	4.4881889763779526e-01, 
	4.5669291338582679e-01, 
	4.6456692913385828e-01, 
	4.7244094488188976e-01, 
	4.8031496062992124e-01, 
	4.8818897637795278e-01, 
	4.9606299212598426e-01, 
	5.0393700787401574e-01, 
	5.1181102362204722e-01, 
	5.1968503937007871e-01, 
	5.2755905511811019e-01, 
	5.3543307086614178e-01, 
	5.4330708661417326e-01, 
	5.5118110236220474e-01, 
	5.5905511811023623e-01, 
	5.6692913385826771e-01, 
	5.7480314960629919e-01, 
	5.8267716535433067e-01, 
	5.9055118110236215e-01, 
	5.9842519685039375e-01, 
	6.0629921259842523e-01, 
	6.1417322834645671e-01, 
	6.2204724409448819e-01, 
	6.2992125984251968e-01, 
	6.3779527559055116e-01, 
	6.4566929133858264e-01, 
	6.5354330708661412e-01, 
	6.6141732283464572e-01, 
	6.6929133858267720e-01, 
	6.7716535433070868e-01, 
	6.8503937007874016e-01, 
//.........这里部分代码省略.........
开发者ID:RWelsh,项目名称:JamomaDSP,代码行数:101,代码来源:TTSmoothPolynomialFunction.test.cpp


示例5: test

TTErr RosenbergGlottalPulseWindow::test(TTValue& returnedTestInfo)
{
	int					errorCount = 0;
	int					testAssertionCount = 0;
	
	TTAudioObjectBasePtr	windowObject = NULL;
	
	TTAudioSignalPtr	input = NULL;
	TTAudioSignalPtr	output = NULL;
	
	int					N = 101;
	TTValue				v, aReturnWeDontCareAbout;
	
	// create the object, keep the default ratio parameter
	TTObjectBaseInstantiate(TT("WindowFunction"), &windowObject, TTValue(1));
	windowObject->setAttributeValue(TT("function"), TT("rosenbergGlottalPulse"));
	windowObject->setAttributeValue(TT("mode"), TT("apply"));
	
	// create 1 channel audio signal objects
	TTObjectBaseInstantiate(kTTSym_audiosignal, &input, 1);
	TTObjectBaseInstantiate(kTTSym_audiosignal, &output, 1);
	input->allocWithVectorSize(N);
	output->allocWithVectorSize(N);
	
	// create a signal to be transformed, and then process it
	input->fill(1.0);
	windowObject->process(input, output);
		
	// now test the output
	int	badSampleCount = 0;
	for (int n=0; n<N; n++) {
		TTBoolean result = !TTTestFloatEquivalence(output->mSampleVectors[0][n], expectedResult1[n]);
		badSampleCount += result;
		if (result)
			TTTestLog("BAD SAMPLE @ n=%i  ( value=%.10f   expected=%.10f )", n, output->mSampleVectors[0][n], expectedResult1[n]);
	}

	TTTestAssertion("Produces correct window shape for with default ratio attribute", 
					badSampleCount == 0, 
					testAssertionCount, 
					errorCount);
	if (badSampleCount)
		TTTestLog("badSampleCount is %i", badSampleCount);
	
	v.resize(2);
	v.set(0, TT("ratio"));
	v.set(1, 0.8);
	windowObject->sendMessage(TT("setParameter"), v, aReturnWeDontCareAbout);
	
	// Again create a signal to be transformed, and then process it
	input->fill(1.0);
	windowObject->process(input, output);
	
	// now test the output
	badSampleCount = 0;
	for (int n=0; n<N; n++) {
		TTBoolean result = !TTTestFloatEquivalence(output->mSampleVectors[0][n], expectedResult2[n]);
		badSampleCount += result;
		if (result)
			TTTestLog("BAD SAMPLE @ n=%i  ( value=%.10f   expected=%.10f )", n, output->mSampleVectors[0][n], expectedResult2[n]);
	}
	
	TTTestAssertion("Produces correct window shape for with ratio set to 0.8",
					badSampleCount == 0,
					testAssertionCount,
					errorCount);
	if (badSampleCount)
		TTTestLog("badSampleCount is %i", badSampleCount);
	
	
	TTObjectBaseRelease(&input);
	TTObjectBaseRelease(&output);
	TTObjectBaseRelease(&windowObject);
	
	// Wrap up the test results to pass back to whoever called this test
	return TTTestFinish(testAssertionCount, errorCount, returnedTestInfo);
}
开发者ID:ChristianFrisson,项目名称:JamomaCore,代码行数:77,代码来源:TTRosenbergGlottalPulseWindow.test.cpp


示例6: testAudioProcessing

TTErr TTSpatSnap::testAudioProcessing(int& aTestAssertionCount, int& anErrorCount, TTValue& aReturnedTestInfo)
{
	TTAudioSignalPtr input = NULL;
	TTAudioSignalPtr output = NULL;
	
	// create audio signal objects
	TTObjectBaseInstantiate(kTTSym_audiosignal, &input, 7);
	TTObjectBaseInstantiate(kTTSym_audiosignal, &output, 5);
	
	input->allocWithVectorSize(64);
	output->allocWithVectorSize(64);
	
	for (TTInt16 sample=0; sample<64; sample++)
		input->mSampleVectors[0][sample] = 1.0;
	
	for (TTInt16 sample=0; sample<64; sample++)
		input->mSampleVectors[1][sample] = 2.0;
	
	for (TTInt16 sample=0; sample<64; sample++)
		input->mSampleVectors[2][sample] = 4.0;
	
	for (TTInt16 sample=0; sample<64; sample++)
		input->mSampleVectors[3][sample] = 8.0;
	
	for (TTInt16 sample=0; sample<64; sample++)
		input->mSampleVectors[4][sample] = 16.0;
	
	for (TTInt16 sample=0; sample<64; sample++)
		input->mSampleVectors[5][sample] = 32.0;
	
	for (TTInt16 sample=0; sample<64; sample++)
		input->mSampleVectors[6][sample] = 64.0;
	
	this->process(input, output);
	
	
	// Test processed audio
	TTTestLog("");
	
	// Sink 1 receieves signal fra source 2, 6 and 7: Expected value equals 2. + 32. +64. = 98.
	
	int validSampleCount = 0;
	TTSampleValuePtr samples = output->mSampleVectors[0];
	
	for (int i=0; i<64; i++) {
		validSampleCount += TTTestFloatEquivalence(98., samples[i]);
	}
	TTTestAssertion("Correct audio signal processed to sink 1",
					validSampleCount == 64,
					aTestAssertionCount,
					anErrorCount);
	TTTestLog("Number of bad samples: %i", 64-validSampleCount);
	
	// Sink 2 receieves signal fra source 3: Expected value equals 4.
	
	validSampleCount = 0;
	samples = output->mSampleVectors[1];
	
	for (int i=0; i<64; i++) {
		validSampleCount += TTTestFloatEquivalence(4., samples[i]);
	}
	TTTestAssertion("Correct audio signal processed to sink 2",
					validSampleCount == 64,
					aTestAssertionCount,
					anErrorCount);
	TTTestLog("Number of bad samples: %i", 64-validSampleCount);
	
	// Sink 3 receieves signal fra source 4: Expected value equals 8.
	
	validSampleCount = 0;
	samples = output->mSampleVectors[2];
	
	for (int i=0; i<64; i++) {
		validSampleCount += TTTestFloatEquivalence(8., samples[i]);
	}
	TTTestAssertion("Correct audio signal processed to sink 3",
					validSampleCount == 64,
					aTestAssertionCount,
					anErrorCount);
	TTTestLog("Number of bad samples: %i", 64-validSampleCount);
	
	// Sink 4 receieves signal fra source 5: Expected value equals 16.
	
	validSampleCount = 0;
	samples = output->mSampleVectors[3];
	
	for (int i=0; i<64; i++) {
		validSampleCount += TTTestFloatEquivalence(16., samples[i]);
	}
	TTTestAssertion("Correct audio signal processed to sink 4",
					validSampleCount == 64,
					aTestAssertionCount,
					anErrorCount);
	TTTestLog("Number of bad samples: %i", 64-validSampleCount);
	
	// Sink 5 receieves signal fra source 1: Expected value equals 1.
	
	validSampleCount = 0;
	samples = output->mSampleVectors[4];
	
//.........这里部分代码省略.........
开发者ID:EQ4,项目名称:JamomaCore,代码行数:101,代码来源:TTSpatSnap.test.cpp


示例7: test

TTErr TTRamp::test(TTValue& returnedTestInfo)
{
	int					errorCount = 0;
	int					testAssertionCount = 0;
	int					badSampleCount = 0;
	int					badSampleCountTotal = 0;
	TTAudioSignalPtr	output = NULL;
	
	// create 1 channel audio signal objects
	TTObjectBaseInstantiate(kTTSym_audiosignal, &output, 1);
	output->allocWithVectorSize(64);
	
	// setup the generator
	this->setAttributeValue(TT("destinationValue"), 1.0);
	this->setAttributeValue(TT("startValue"), 0.0);
	this->setAttributeValue(TT("mode"), TT("sample"));
	this->setAttributeValue(TT("rampTime"), 64000.0/sr);
	this->process(output);
	

	// created with Octave: sig = linspace(0,1,64) 
	TTFloat64 expectedSignalTest1[64] = {
		0.0000000000000000e+00,
		1.5873015873015872e-02,
		3.1746031746031744e-02,
		4.7619047619047616e-02,
		6.3492063492063489e-02,
		7.9365079365079361e-02,
		9.5238095238095233e-02,
		1.1111111111111110e-01,
		1.2698412698412698e-01,
		1.4285714285714285e-01,
		1.5873015873015872e-01,
		1.7460317460317459e-01,
		1.9047619047619047e-01,
		2.0634920634920634e-01,
		2.2222222222222221e-01,
		2.3809523809523808e-01,
		2.5396825396825395e-01,
		2.6984126984126983e-01,
		2.8571428571428570e-01,
		3.0158730158730157e-01,
		3.1746031746031744e-01,
		3.3333333333333331e-01,
		3.4920634920634919e-01,
		3.6507936507936506e-01,
		3.8095238095238093e-01,
		3.9682539682539680e-01,
		4.1269841269841268e-01,
		4.2857142857142855e-01,
		4.4444444444444442e-01,
		4.6031746031746029e-01,
		4.7619047619047616e-01,
		4.9206349206349204e-01,
		5.0793650793650791e-01,
		5.2380952380952384e-01,
		5.3968253968253965e-01,
		5.5555555555555558e-01,
		5.7142857142857140e-01,
		5.8730158730158732e-01,
		6.0317460317460314e-01,
		6.1904761904761907e-01,
		6.3492063492063489e-01,
		6.5079365079365081e-01,
		6.6666666666666663e-01,
		6.8253968253968256e-01,
		6.9841269841269837e-01,
		7.1428571428571430e-01,
		7.3015873015873012e-01,
		7.4603174603174605e-01,
		7.6190476190476186e-01,
		7.7777777777777779e-01,
		7.9365079365079361e-01,
		8.0952380952380953e-01,
		8.2539682539682535e-01,
		8.4126984126984128e-01,
		8.5714285714285710e-01,
		8.7301587301587302e-01,
		8.8888888888888884e-01,
		9.0476190476190477e-01,
		9.2063492063492058e-01,
		9.3650793650793651e-01,
		9.5238095238095233e-01,
		9.6825396825396826e-01,
		9.8412698412698407e-01,
		1.0000000000000000e+00		
	};
	
	for (int i=0; i<64; i++) {
		TTBoolean result = !TTTestFloatEquivalence(output->mSampleVectors[0][i], expectedSignalTest1[i]);
		badSampleCount += result;
		if (result)
			//TTTestLog("BAD SAMPLE @ i=%i  ( value=%.10f   expected=%.10f )", i, output->mSampleVectors[0][i], expectedSignalTest1[i]);
            std::cout << "BAD SAMPLE @ n=" << i << " ( value=" << output->mSampleVectors[0][i] << " expected=" << expectedSignalTest1[i] << " )\n";
	}
    
	TTTestAssertion("Test 1: Produces correct ramp from 0 to 1 when a positive Frequency is defined", 
					badSampleCount == 0, 
					testAssertionCount, 
					errorCount);
//.........这里部分代码省略.........
开发者ID:ChristianFrisson,项目名称:JamomaCore,代码行数:101,代码来源:TTRamp.test.cpp


示例8: test

TTErr KaiserWindow::test(TTValue& returnedTestInfo)
{
	int					errorCount = 0;
	int					testAssertionCount = 0;
	int					badSampleCount = 0;
	TTAudioObjectBasePtr	windowObject = NULL;
	TTAudioSignalPtr	input = NULL;
	TTAudioSignalPtr	output = NULL;
	int					N = 128;
	TTValue				v, aReturnWeDontCareAbout;
	
	// create the object and set the beta parameter
	TTObjectBaseInstantiate(TT("WindowFunction"), &windowObject, TTValue(1));
	windowObject->setAttributeValue(TT("function"), TT("kaiser"));
	windowObject->setAttributeValue(TT("mode"), TT("apply"));
	
	v.resize(2);
	v[0] = TT("beta");
	v[1] = 6.0;
	windowObject->sendMessage(TT("setParameter"), v, aReturnWeDontCareAbout);
	
	TTTestAssertion("Internal intermediate value 1 (zeroth-order bessel fn of the first kind, taken of beta = 6.0) is correct.",
					TTTestFloatEquivalence(((KaiserWindow*)((WindowFunction*)windowObject)->mFunctionObject)->mBesselIOofBeta, 67.2344069764780),
					testAssertionCount,
					errorCount);
	
	// change the alpha parameter and test Bessel function again
	v.resize(2);
	v[0] = TT("alpha");
	v[1] = 2.0;
	windowObject->sendMessage(TT("setParameter"), v, aReturnWeDontCareAbout);
	
	TTTestAssertion("Internal intermediate value 2 (zeroth-order bessel fn of the first kind, taken of alpha = 2) is correct.",
					TTTestFloatEquivalence(((KaiserWindow*)((WindowFunction*)windowObject)->mFunctionObject)->mBesselIOofBeta, 87.10851065339077),
					testAssertionCount,
					errorCount);  // added 4/26 by Wolek
	
	// change the beta parameter and try applying the window
	v.resize(2);
	v[0] = TT("beta");
	v[1] = 3.0 * kTTPi;
	windowObject->sendMessage(TT("setParameter"), v, aReturnWeDontCareAbout);
	
	TTTestAssertion("Internal intermediate value 2 (zeroth-order bessel fn of the first kind, taken of beta = 3 * pi) is correct.",
					TTTestFloatEquivalence(((KaiserWindow*)((WindowFunction*)windowObject)->mFunctionObject)->mBesselIOofBeta, 1633.090522058824),
					testAssertionCount,
					errorCount);  // added 4/26 by Wolek
	
	// create 1 channel audio signal objects
	TTObjectBaseInstantiate(kTTSym_audiosignal, &input, 1);
	TTObjectBaseInstantiate(kTTSym_audiosignal, &output, 1);
	input->allocWithVectorSize(N);
	output->allocWithVectorSize(N);
	
	// create a signal to be transformed, and then process it
	input->fill(1.0);
	windowObject->process(input, output);
		
	// now test the output
	for (int n=0; n<N; n++) {
		TTBoolean result = !TTTestFloatEquivalence(output->mSampleVectors[0][n], sKaiserB3PiWindowCoefficients128[n]);
		badSampleCount += result;
		if (result)
			TTTestLog("BAD SAMPLE @ n=%i  ( value=%.10f   expected=%.10f )", n, output->mSampleVectors[0][n], sKaiserB3PiWindowCoefficients128[n]);
	}

	TTTestAssertion("Produces correct window shape for beta = 3 pi", 
					badSampleCount == 0, 
					testAssertionCount, 
					errorCount);
	if (badSampleCount)
		TTTestLog("badSampleCount is %i", badSampleCount);
	
	
	TTObjectBaseRelease(&input);
	TTObjectBaseRelease(&output);
	TTObjectBaseRelease(&windowObject);
	
	// Wrap up the test results to pass back to whoever called this test
	return TTTestFinish(testAssertionCount, errorCount, returnedTestInfo);
}
开发者ID:EQ4,项目名称:JamomaCore,代码行数:81,代码来源:TTKaiserWindow.test.cpp


示例9: test

TTErr TTLinearFunction::test(TTValue& returnedTestInfo)
{
	int					errorCount = 0;
	int					testAssertionCount = 0;
	int					badSampleCount = 0;
	TTAudioSignalPtr	input = NULL;
	TTAudioSignalPtr	output = NULL;
	int					N = 128;
	TTValue				v;
	

TTFloat64 expectedSignalTest1[128] = {
	0.0000000000000000e+00, 
	7.8740157480314960e-03, 
	1.5748031496062992e-02, 
	2.3622047244094488e-02, 
	3.1496062992125984e-02, 
	3.9370078740157480e-02, 
	4.7244094488188976e-02, 
	5.5118110236220472e-02, 
	6.2992125984251968e-02, 
	7.0866141732283464e-02, 
	7.8740157480314960e-02, 
	8.6614173228346455e-02, 
	9.4488188976377951e-02, 
	1.0236220472440945e-01, 
	1.1023622047244094e-01, 
	1.1811023622047244e-01, 
	1.2598425196850394e-01, 
	1.3385826771653545e-01, 
	1.4173228346456693e-01, 
	1.4960629921259844e-01, 
	1.5748031496062992e-01, 
	1.6535433070866143e-01, 
	1.7322834645669291e-01, 
	1.8110236220472442e-01, 
	1.8897637795275590e-01, 
	1.9685039370078741e-01, 
	2.0472440944881889e-01, 
	2.1259842519685040e-01, 
	2.2047244094488189e-01, 
	2.2834645669291340e-01, 
	2.3622047244094488e-01, 
	2.4409448818897639e-01, 
	2.5196850393700787e-01, 
	2.5984251968503935e-01, 
	2.6771653543307089e-01, 
	2.7559055118110237e-01, 
	2.8346456692913385e-01, 
	2.9133858267716534e-01, 
	2.9921259842519687e-01, 
	3.0708661417322836e-01, 
	3.1496062992125984e-01, 
	3.2283464566929132e-01, 
	3.3070866141732286e-01, 
	3.3858267716535434e-01, 
	3.4645669291338582e-01, 
	3.5433070866141730e-01, 
	3.6220472440944884e-01, 
	3.7007874015748032e-01, 
	3.7795275590551181e-01, 
	3.8582677165354329e-01, 
	3.9370078740157483e-01, 
	4.0157480314960631e-01, 
	4.0944881889763779e-01, 
	4.1732283464566927e-01, 
	4.2519685039370081e-01, 
	4.3307086614173229e-01, 
	4.4094488188976377e-01, 
	4.4881889763779526e-01, 
	4.5669291338582679e-01, 
	4.6456692913385828e-01, 
	4.7244094488188976e-01, 
	4.8031496062992124e-01, 
	4.8818897637795278e-01, 
	4.9606299212598426e-01, 
	5.0393700787401574e-01, 
	5.1181102362204722e-01, 
	5.1968503937007871e-01, 
	5.2755905511811019e-01, 
	5.3543307086614178e-01, 
	5.4330708661417326e-01, 
	5.5118110236220474e-01, 
	5.5905511811023623e-01, 
	5.6692913385826771e-01, 
	5.7480314960629919e-01, 
	5.8267716535433067e-01, 
	5.9055118110236215e-01, 
	5.9842519685039375e-01, 
	6.0629921259842523e-01, 
	6.1417322834645671e-01, 
	6.2204724409448819e-01, 
	6.2992125984251968e-01, 
	6.3779527559055116e-01, 
	6.4566929133858264e-01, 
	6.5354330708661412e-01, 
	6.6141732283464572e-01, 
	6.6929133858267720e-01, 
	6.7716535433070868e-01, 
	6.8503937007874016e-01, 
//.........这里部分代码省略.........
开发者ID:ChristianFrisson,项目名称:JamomaCore,代码行数:101,代码来源:TTLinearFunction.test.cpp


示例10: TTTestFinish

TTErr TTHalfbandLinear33::test(TTValue& returnedTestInfo)
{
	int					errorCount = 0;
	int					testAssertionCount = 0;
	int					badSampleCount = 0;
	TTAudioSignalPtr	input = NULL;
	TTAudioSignalPtr	output = NULL;
	
	// create 1 channel audio signal objects
	TTObjectBaseInstantiate(kTTSym_audiosignal, &input, 1);
	TTObjectBaseInstantiate(kTTSym_audiosignal, &output, 1);
	input->allocWithVectorSize(128);
	output->allocWithVectorSize(128);
	
	// create an impulse
	input->clear();						// set all samples to zero
	input->mSampleVectors[0][0] = 1.0;	// set the first sample to 1
	
	// setup the filter
	//this->setAttributeValue(TT("linearGain"), 0.5);
	//this->setAttributeValue(TT("delayInSamples"), 1);
	this->process(input, output);
	
	/// The following values are not necsessarily to be trusted. They were calculated from this filter unit itself at a time when the filter was assumed to work. As such, if this test fails in the future, it should be considered an indication that something has changed in the code or compiler that causes the calculated impulse response to differ from earlier results, but this test is not able to say anything meaningful about whether the old or new behaviour is to be trusted (or eventually none of them).
	TTFloat64 expectedImpulseResponse[128] = {
		0.0000000000000000e+00,
		-1.4033886144341021e-03,
		0.0000000000000000e+00,
		2.8696648020251339e-03,
		0.0000000000000000e+00,
		-5.7985191818626753e-03,
		0.0000000000000000e+00,
		1.0903029954258413e-02,
		0.0000000000000000e+00,
		-1.9971682303392909e-02,
		0.0000000000000000e+00,
		3.7485281415763530e-02,
		0.0000000000000000e+00,
		-7.9701634061165733e-02,
		0.0000000000000000e+00,
		2.9216925395010418e-01,
		5.0000000000000000e-01,
		3.4369037427197169e-01,
		0.0000000000000000e+00,
		-1.3023893952773802e-01,
		0.0000000000000000e+00,
		8.6104042704043690e-02,
		0.0000000000000000e+00,
		-6.5831676403848585e-02,
		0.0000000000000000e+00,
		5.3364446243041895e-02,
		0.0000000000000000e+00,
		-4.4382106227734967e-02,
		0.0000000000000000e+00,
		3.7295412888824341e-02,
		0.0000000000000000e+00,
		-3.1244797047627053e-02,
		0.0000000000000000e+00,
		2.6798062990289070e-02,
		0.0000000000000000e+00,
		-2.2131648330448058e-02,
		0.0000000000000000e+00,
		1.8346990400433229e-02,
		0.0000000000000000e+00,
		-1.5243355223767449e-02,
		0.0000000000000000e+00,
		1.2680069280636953e-02,
		0.0000000000000000e+00,
		-1.0553809725476822e-02,
		0.0000000000000000e+00,
		8.7857616982298780e-03,
		0.0000000000000000e+00,
		-7.3136670275350379e-03,
		0.0000000000000000e+00,
		6.0882749139391252e-03,
		0.0000000000000000e+00,
		-5.0669324833186669e-03,
		0.0000000000000000e+00,
		4.2169077154520593e-03,
		0.0000000000000000e+00,
		-3.5095610771282738e-03,
		0.0000000000000000e+00,
		2.9209172646183241e-03,
		0.0000000000000000e+00,
		-2.4310262000329379e-03,
		0.0000000000000000e+00,
		2.0233040542710959e-03,
		0.0000000000000000e+00,
		-1.6839620729024551e-03,
		0.0000000000000000e+00,
		1.4015316044449066e-03,
		0.0000000000000000e+00,
		-1.1664674133319290e-03,
		0.0000000000000000e+00,
		9.7082783948693727e-04,
		0.0000000000000000e+00,
		-8.0800107046215914e-04,
		0.0000000000000000e+00,
		6.7248368858447154e-04,
		0.0000000000000000e+00,
//.........这里部分代码省略.........
开发者ID:ChristianFrisson,项目名称:JamomaCore,代码行数:101,代码来源:TTHalfbandLinear33.test.cpp


示例11: test

TTErr TTSvf::test(TTValue& returnedTestInfo)
{
	int					errorCount = 0;
	int					testAssertionCount = 0;
	int					badSampleCount = 0;
	TTAudioSignalPtr	input = NULL;
	TTAudioSignalPtr	output = NULL;
	
	// create 1 channel audio signal objects
	TTObjectBaseInstantiate(kTTSym_audiosignal, &input, 1);
	TTObjectBaseInstantiate(kTTSym_audiosignal, &output, 1);
	input->allocWithVectorSize(128);
	output->allocWithVectorSize(128);
	
	// create an impulse
	input->clear();						// set all samples to zero
	input->mSampleVectors[0][0] = 1.0;	// set the first sample to 1
	
	// setup the filter
	//this->setAttributeValue(TT("linearGain"), 0.5);
	//this->setAttributeValue(TT("delayInSamples"), 1);
	this->process(input, output);
	
	/// The following values are not necsessarily to be trusted. They were calculated from this filter unit itself at a time when the filter was assumed to work. As such, if this test fails in the future, it should be considered an indication that something has changed in the code or compiler that causes the calculated impulse response to differ from earlier results, but this test is not able to say anything meaningful about whether the old or new behaviour is to be trusted (or eventually none of them).
	TTFloat64 expectedImpulseResponse[128] = {
		5.0000000000000000e+05,
		5.0087319869171590e+17,
		5.0174842408388438e+29,
		5.0262517884414260e+41,
		5.0350346564490692e+53,
		5.0438328716326373e+65,
		5.0526464608097724e+77,
		5.0614754508449776e+89,
		5.0703198686496978e+101,
		5.0791797411824051e+113,
		5.0880550954486772e+125,
		5.0969459585012814e+137,
		5.1058523574402592e+149,
		5.1147743194130052e+161,
		5.1237118716143473e+173,
		5.1326650412866394e+185,
		5.1416338557198395e+197,
		5.1506183422515868e+209,
		5.1596185282672929e+221,
		5.1686344412002213e+233,
		5.1776661085315740e+245,
		5.1867135577905743e+257,
		5.1957768165545460e+269,
		5.2048559124490098e+281,
		5.2139508731477499e+293,
		5.2230617263729118e+305,
		5.2230617263729118e+305,
		5.2230617263729118e+305,
		5.2230617263729118e+305,
		5.2230617263729118e+305,
		5.2230617263729118e+305,
		5.2230617263729118e+305,
		5.2230617263729118e+305,
		5.2230617263729118e+305,
		5.2230617263729118e+305,
		5.2230617263729118e+305,
		5.2230617263729118e+305,
		5.2230617263729118e+305,
		5.2230617263729118e+305,
		5.2230617263729118e+305,
		5.2230617263729118e+305,
		5.2230617263729118e+305,
		5.2230617263729118e+305,
		5.2230617263729118e+305,
		5.2230617263729118e+305,
		5.2230617263729118e+305,
		5.2230617263729118e+305,
		5.2230617263729118e+305,
		5.2230617263729118e+305,
		5.2230617263729118e+305,
		5.2230617263729118e+305,
		5.2230617263729118e+305,
		5.2230617263729118e+305,
		5.2230617263729118e+305,
		5.2230617263729118e+305,
		5.2230617263729118e+305,
		5.2230617263729118e+305,
		5.2230617263729118e+305,
		5.2230617263729118e+305,
		5.2230617263729118e+305,
		5.2230617263729118e+305,
		5.2230617263729118e+305,
		5.2230617263729118e+305,
		5.2230617263729118e+305,
		5.2230617263729118e+305,
		5.2230617263729118e+305,
		5.2230617263729118e+305,
		5.2230617263729118e+305,
		5.2230617263729118e+305,
		5.2230617263729118e+305,
		5.2230617263729118e+305,
		5.2230617263729118e+305,
		5.2230617263729118e+305,
		5.2230617263729118e+305,
		5.2230617263729118e+305,
//.........这里部分代码省略.........
开发者ID:ChristianFrisson,项目名称:JamomaCore,代码行数:101,代码来源:TTSvf.test.cpp


示例12: test

TTErr TTAudioGraphGenerator::test(TTValue& returnedTestInfo)
{
	int							errorCount = 0;
	int							testAssertionCount = 0;
	int							badSampleCount = 0;
//	TTAudioSignalPtr			input = NULL;
	TTAudioSignalPtr			output = NULL;
	TTAudioGraphPreprocessData	mInitData;
//	TTAudioSignalPtr			mAudioSignal = NULL;
	TTAudioGraphObjectPtr		obj0 = NULL;
	TTAudioGraphObjectPtr		obj1 = NULL;
	TTAudioGraphObjectPtr		obj2 = NULL;
	TTAudioGraphObjectPtr		obj3 = NULL;
	TTAudioGraphObjectPtr		obj4 = NULL;
	TTAudioGraphObjectPtr		obj5 = NULL;
	TTAudioGraphObjectPtr		obj6 = NULL;
	TTAudioGraphObjectPtr		obj7 = NULL;
//	TTAudioGraphObjectPtr		obj8 = NULL;
	TTAudioGraphObjectPtr		obj9 = NULL;
	TTAudioGraphObjectPtr		obj10 = NULL;
//	TTAudioGraphObjectPtr		obj11 = NULL;
	TTAudioGraphObjectPtr		obj12 = NULL;
	TTAudioGraphObjectPtr		obj13 = NULL;
	TTValue						audioObjectArguments;

	memset(&mInitData, 0, sizeof(mInitData));	
	audioObjectArguments.setSize(3);
		   
	// Create the Graph

	audioObjectArguments.set(0, TT("thru"));	// <<-- THIS IS THE SINK ON WHICH WE WILL PULL
	audioObjectArguments.set(1, 1);				// <<-- NUMBER OF INLETS
	audioObjectArguments.set(2, 1);
	TTObjectInstantiate(TT("audio.object"), (TTObjectPtr*)&obj0, audioObjectArguments);
	obj0->mKernel->setAttributeValue(TT("maxNumChannels"), 0);
	obj0->mKernel->setAttributeValue(TT("mute"), 0);
	obj0->mKernel->setAttributeValue(TT("bypass"), 0);
	obj0->mKernel->setAttributeValue(TT("sampleRate"), 44100u);

	audioObjectArguments.set(0, TT("audio.join"));
	audioObjectArguments.set(1, 2);
	audioObjectArguments.set(2, 1);
	TTObjectInstantiate(TT("audio.object"), (TTObjectPtr*)&obj1, audioObjectArguments);
	obj1->mKernel->setAttributeValue(TT("maxNumChannels"), 1);
	obj1->mKernel->setAttributeValue(TT("mute"), 0);
	obj1->mKernel->setAttributeValue(TT("bypass"), 0);
	obj1->mKernel->setAttributeValue(TT("sampleRate"), 44100u);

	audioObjectArguments.set(0, TT("gain"));
	audioObjectArguments.set(1, 1);
	audioObjectArguments.set(2, 1);
	TTObjectInstantiate(TT("audio.object"), (TTObjectPtr*)&obj2, audioObjectArguments);
	//obj2->mKernel->setAttributeValue(TT("midiGain"), 86.639865);
	obj2->mKernel->setAttributeValue(TT("maxNumChannels"), 0);
	obj2->mKernel->setAttributeValue(TT("interpolated"), 0);
	obj2->mKernel->setAttributeValue(TT("mute"), 0);
	obj2->mKernel->setAttributeValue(TT("bypass"), 0);
	//obj2->mKernel->setAttributeValue(TT("gain"), -6.000000);
	//obj2->mKernel->setAttributeValue(TT("linearGain"), 0.501187);
	obj2->mKernel->setAttributeValue(TT("linearGain"), 0.25);
	obj2->mKernel->setAttributeValue(TT("sampleRate"), 44100u);

	audioObjectArguments.set(0, TT("audio.split"));
	audioObjectArguments.set(1, 1);
	audioObjectArguments.set(2, 2);
	TTObjectInstantiate(TT("audio.object"), (TTObjectPtr*)&obj3, audioObjectArguments);
	obj3->mKernel->setAttributeValue(TT("maxNumChannels"), 1);
	TTValue v(1,1);
	obj3->mKernel->setAttributeValue(TT("groups"), v);
	obj3->mKernel->setAttributeValue(TT("mute"), 0);
	obj3->mKernel->setAttributeValue(TT("bypass"), 0);
	obj3->mKernel->setAttributeValue(TT("sampleRate"), 44100u);

	audioObjectArguments.set(0, TT("audio.generator"));
	audioObjectArguments.set(1, 0);
	audioObjectArguments.set(2, 1);
	TTObjectInstantiate(TT("audio.object"), (TTObjectPtr*)&obj4, audioObjectArguments);
	obj4->mKernel->setAttributeValue(TT("maxNumChannels"), 2);
	obj4->mKernel->setAttributeValue(TT("mute"), 0);
	obj4->mKernel->setAttributeValue(TT("bypass"), 0);
	obj4->mKernel->setAttributeValue(TT("vectorSize"), 64);
	obj4->mKernel->setAttributeValue(TT("sampleRate"), 44100u);
	obj4->addAudioFlag(kTTAudioGraphGenerator);
	obj4->setOutputNumChannels(0, 2);
	
	obj3->connectAudio(obj4, 0, 0);
	obj2->connectAudio(obj3, 0, 0);

//	TTObjectInstantiate(TT("graph.object"), (TTObjectPtr*)&obj8, TTValue(TT("plugtastic.parameter")));
//	((PlugtasticParameter*)obj8->mKernel)->setOwner(obj8);
//	obj8->mKernel->setAttributeValue(TT("rangeTop"), 24.000000);
//	obj8->mKernel->setAttributeValue(TT("bypass"), 0);
//	obj8->mKernel->setAttributeValue(TT("name"), TT("gain"));
//	obj8->mKernel->setAttributeValue(TT("style"), TT("decibels"));
//	obj8->mKernel->setAttributeValue(TT("default"), -6.000000);
//	obj8->mKernel->setAttributeValue(TT("value"), 0.000000);
//	obj8->mKernel->setAttributeValue(TT("rangeBottom"), -96.000000);

//	obj2->connect(obj8);
	obj1->connectAudio(obj2, 0, 0);
//.........这里部分代码省略.........
开发者ID:imclab,项目名称:JamomaAudioGraph,代码行数:101,代码来源:split-gain-join.test.cpp


示例13: TTTestFinish

TTErr TTHalfband9::test(TTValue& returnedTestInfo)
{
	int					errorCount = 0;
	int					testAssertionCount = 0;
	int					badSampleCount = 0;
	TTAudioSignalPtr	input = NULL;
	TTAudioSignalPtr	output = NULL;
	
	// create 1 channel audio signal objects
	TTObjectBaseInstantiate(kTTSym_audiosignal, &input, 1);
	TTObjectBaseInstantiate(kTTSym_audiosignal, &output, 1);
	input->allocWithVectorSize(128);
	output->allocWithVectorSize(128);
	
	// create an impulse
	input->clear();						// set all samples to zero
	input->mSampleVectors[0][0] = 1.0;	// set the first sample to 1
	
	// setup the filter
	//this->setAttributeValue(TT("linearGain"), 0.5);
	//this->setAttributeValue(TT("delayInSamples"), 1);
	this->process(input, output);
	
	/// The following values are not necsessarily to be trusted. They were calculated from this filter unit itself at a time when the filter was assumed to work. As such, if this test fails in the future, it should be considered an indication that something has changed in the code or compiler that causes the calculated impulse response to differ from earlier results, but this test is not able to say anything meaningful about whether the old or new behaviour is to be trusted (or eventually none of them).
	TTFloat64 expectedImpulseResponse[128] = {
		8.7103045030879483e-03,
		6.5442805786156327e-02,
		2.1752960418473016e-01,
		4.0159114675452823e-01,
		4.0353211792457022e-01,
		1.2030853381927020e-01,
		-1.8246245365496197e-01,
		-1.6374428214620290e-01,
		7.3759595434999117e-02,
		1.3557578188789043e-01,
		-2.9480119034157672e-02,
		-1.0385906449486471e-01,
		1.1768051181853019e-02,
		7.8235267984828785e-02,
		-4.6970087126678179e-03,
		-5.8706586396073894e-02,
		1.8747000302069827e-03,
		4.4013161078726402e-02,
		-7.4824100988214021e-04,
		-3.2990420653853873e-02,
		2.9864218340860499e-04,
		2.4727036940893864e-02,
		-1.1919575486409350e-04,
		-1.8533241881956156e-02,
		4.7574082755266522e-05,
		1.3890873825360833e-02,
		-1.8988036545967643e-05,
		-1.0411360218772368e-02,
		7.5786123658265979e-06,
		7.8034260100494678e-03,
		-3.0248185615325640e-06,
		-5.8487511897430174e-03,
		1.2072826644949055e-06,
		4.3837014883001159e-03,
		-4.8185747420545896e-07,
		-3.2856310826633872e-03,
		1.9232167600518332e-07,
		2.4626155853971947e-03,
		-7.6760513308280766e-08,
		-1.8457566806100649e-03,
		3.0637089514506656e-08,
		1.3834143437329480e-03,
		-1.2228048165209913e-08,
		-1.0368838246887998e-03,
		4.8805276317090555e-09,
		7.7715549991975530e-04,
		-1.9479437471995521e-09,
		-5.8248634675791178e-04,
		7.7747430781886294e-10,
		4.3657973750991743e-04,
		-3.1030993589390189e-10,
		-3.2722117568094997e-04,
		1.2385265383832053e-10,
		2.4525576570440455e-04,
		-4.9432770557625903e-11,
		-1.8382181558415425e-04,
		1.9729886516544118e-11,
		1.3777641389022791e-04,
		-7.8747037150572516e-12,
		-1.0326489358256396e-04,
		3.1429962127728598e-12,
		7.7398140549037774e-05,
		-1.2544503959705767e-12,
		-5.8010732908556275e-05,
		5.0068332553363524e-13,
		4.3479663835796007e-05,
		-1.9983555609105167e-13,
		-3.2588472382409617e-05,
		7.9759495556712181e-14,
		2.4425408076516508e-05,
		-3.1834060243826912e-14,
		-1.8307104202478260e-05,
		1.2705789881620152e-14,
		1.3721370108965461e-05,
		-5.0712066032225982e-15,
//.........这里部分代码省略.........
开发者ID:ChristianFrisson,项目名称:JamomaCore,代码行数:101,代码来源:TTHalfband9.test.cpp



注:本文中的TTAudioSignalPtr类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ TTEntry类代码示例发布时间:2022-05-31
下一篇:
C++ TTAudioSignalArrayPtr类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap