示例#1
0
int plugin_tex_doit(int stype, Cast *cast, float *texvec, float *dxt, float *dyt, float *result)
{
	float xwave, ywave;
	
	if(stype==1) {
		texvec[0]+= hnoise(cast->noise, texvec[0], texvec[1], texvec[2]);
		texvec[1]+= hnoise(cast->noise, texvec[1], texvec[2], texvec[0]);
	}
	
	if(dxt && dyt) {
		xwave= sample_wave(cast->size, texvec[0], fabs(dxt[0]) + fabs(dyt[0]) );
		ywave= sample_wave(cast->size, texvec[1], fabs(dxt[1]) + fabs(dyt[1]) );

		if(xwave > ywave) result[0]= xwave-ywave;
		else result[0]= ywave-xwave;
	} 
	else {
		xwave= sample_wave(cast->size, texvec[0], 0.0 );
		ywave= sample_wave(cast->size, texvec[1], 0.0 );
		
		if(xwave > ywave) result[0]= xwave-ywave;
		else result[0]= ywave-xwave;
	}

	return TEX_INT;
}
示例#2
0
float sample_note(synth_note * sn, float t)
{
	float sample = 0.0;
	float relative_time = t - sn->start_time;
//	printf("New Sample\n");
	for(int i = 0; i < sn->num_waves; i++)
	{
		sample += sample_wave( &(sn->waves[i]), relative_time);
	}
//	printf("Sample before envelope: %f\n", sample);
	sample = sample * sample_envelope(&(sn->env), relative_time);
//	printf("Sample after  envelope: %f\n", sample);
	return sample;
}