当前位置: 首页>>代码示例>>C++>>正文


C++ TTAudioSignalPtr::clear方法代码示例

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


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

示例1: test


//.........这里部分代码省略.........
		6.0970288039494136e-01, 
		6.2400113571077132e-01, 
		6.3817714861353769e-01, 
		6.5221715873890806e-01, 
		6.6610761275455821e-01, 
		6.7983518615301786e-01, 
		6.9338680504450978e-01, 
		7.0674966794979754e-01, 
		7.1991126759302526e-01, 
		7.3285941269456178e-01, 
		7.4558224976384357e-01, 
		7.5806828489221756e-01, 
		7.7030640554578467e-01, 
		7.8228590235824358e-01, 
		7.9399649092373314e-01, 
		8.0542833358967236e-01, 
		8.1657206124960879e-01, 
		8.2741879513605987e-01, 
		8.3796016861335465e-01, 
		8.4818834897047601e-01, 
		8.5809605921390641e-01, 
		8.6767659986047230e-01, 
		8.7692387073018008e-01, 
		8.8583239273906678e-01, 
		8.9439732969204044e-01, 
		9.0261451007572102e-01, 
		9.1048044885128654e-01, 
		9.1799236924731620e-01, 
		9.2514822455263168e-01, 
		9.3194671990913625e-01, 
		9.3838733410466979e-01, 
		9.4447034136584040e-01, 
		9.5019683315087100e-01, 
		9.5556873994244551e-01, 
		9.6058885304054709e-01, 
		9.6526084635530474e-01, 
		9.6958929819983375e-01, 
		9.7357971308308588e-01, 
		9.7723854350267647e-01, 
		9.8057321173774348e-01, 
		9.8359213164178971e-01, 
		9.8630473043551437e-01, 
		9.8872147049965875e-01, 
		9.9085387116786894e-01, 
		9.9271453051950509e-01, 
		9.9431714717251651e-01, 
		9.9567654207626521e-01, 
		9.9680868030437164e-01, 
		9.9773069284756843e-01, 
		9.9846089840652841e-01, 
		9.9901882518472185e-01, 
		9.9942523268124717e-01, 
		9.9970213348368553e-01, 
		9.9987281506093062e-01, 
		9.9996186155604327e-01, 
		9.9999517557909634e-01, 
		1.0000000000000000e+00
		};	
	
	// setup Function 
	this->setAttributeValue(TT("function"), TT("smoothPolynomial"));

	
	// create 1 channel audio signal objects
	TTObjectInstantiate(kTTSym_audiosignal, &input, 1);
	TTObjectInstantiate(kTTSym_audiosignal, &output, 1);
	input->allocWithVectorSize(N);
	output->allocWithVectorSize(N);
	
	// create a signal to be transformed and then process it)
	input->clear();	
	for (int i=0; i<N; i++)
		input->mSampleVectors[0][i] = inputSignal1[i]; 
	
	this->process(input, output);
	
	// now test the output
	for (int n=0; n<N; n++)
	{
		TTBoolean result = !TTTestFloatEquivalence(output->mSampleVectors[0][n], expectedSignal1[n]);
		badSampleCount += result;
		if (result) 
			TTTestLog("BAD SAMPLE @ n=%i ( value=%.10f	expected=%.10f )", n, output->mSampleVectors[0][n], expectedSignal1[n]);
	}
	
	TTTestAssertion("Produces correct function values", 
					badSampleCount == 0,
					testAssertionCount, 
					errorCount);
	if (badSampleCount)
		TTTestLog("badSampleCount is %i", badSampleCount);
	
	
	TTObjectRelease(&input);
	TTObjectRelease(&output);
	
	// wrap up test results and pass back to whoever called test
	return TTTestFinish(testAssertionCount, errorCount, returnedTestInfo);
	
}
开发者ID:RWelsh,项目名称:JamomaDSP,代码行数:101,代码来源:TTSmoothPolynomialFunction.test.cpp

示例2: test


//.........这里部分代码省略.........
	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, 
	6.9291338582677164e-01, 
	7.0078740157480313e-01, 
	7.0866141732283461e-01, 
	7.1653543307086609e-01, 
	7.2440944881889768e-01, 
	7.3228346456692917e-01, 
	7.4015748031496065e-01, 
	7.4803149606299213e-01, 
	7.5590551181102361e-01, 
	7.6377952755905509e-01, 
	7.7165354330708658e-01, 
	7.7952755905511806e-01, 
	7.8740157480314965e-01, 
	7.9527559055118113e-01, 
	8.0314960629921262e-01, 
	8.1102362204724410e-01, 
	8.1889763779527558e-01, 
	8.2677165354330706e-01, 
	8.3464566929133854e-01, 
	8.4251968503937003e-01, 
	8.5039370078740162e-01, 
	8.5826771653543310e-01, 
	8.6614173228346458e-01, 
	8.7401574803149606e-01, 
	8.8188976377952755e-01, 
	8.8976377952755903e-01, 
	8.9763779527559051e-01, 
	9.0551181102362199e-01, 
	9.1338582677165359e-01, 
	9.2125984251968507e-01, 
	9.2913385826771655e-01, 
	9.3700787401574803e-01, 
	9.4488188976377951e-01, 
	9.5275590551181100e-01, 
	9.6062992125984248e-01, 
	9.6850393700787396e-01, 
	9.7637795275590555e-01, 
	9.8425196850393704e-01, 
	9.9212598425196852e-01, 
	1.0000000000000000e+00	
};

	
	// setup Function
	this->setAttributeValue(TT("function"), TT("linear"));
	
	// 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->clear();	
	for (int i=0; i<N; i++)
		input->mSampleVectors[0][i] = expectedSignalTest1[i]; 
	
	this->process(input, output);
	
	// now test the output
	for (int n=0; n<N; n++)
	{
		TTBoolean result = !TTTestFloatEquivalence(output->mSampleVectors[0][n], expectedSignalTest1[n]);
		badSampleCount += result;
		if (result) 
			TTTestLog("BAD SAMPLE @ n=%i ( value=%.10f	expected=%.10f )", n, output->mSampleVectors[0][n], expectedSignalTest1[n]);
	}
	
	TTTestAssertion("Produces correct function values", 
					badSampleCount == 0,
					testAssertionCount, 
					errorCount);
	if (badSampleCount)
		TTTestLog("badSampleCount is %i", badSampleCount);
	
	
	TTObjectBaseRelease(&input);
	TTObjectBaseRelease(&output);
	
	// wrap up test results and pass back to whoever called test
	return TTTestFinish(testAssertionCount, errorCount, returnedTestInfo);
	
}
开发者ID:ChristianFrisson,项目名称:JamomaCore,代码行数:101,代码来源:TTLinearFunction.test.cpp

示例3: 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

示例4: 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

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