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


C++ LFO::cos方法代码示例

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


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

示例1: onAudio

	void onAudio(AudioIOData& io){

		while(io()){

			// Increment waveform type
			if(tmr()) (++waveform)%=13;

			// Modulate modifier parameter with raised cosine
			osc.mod(mod.cosU());
		
			float s = 0.f;
			
			switch(waveform){ 
					
				// non-modifiable generators ordered from dull to bright:
				case  0: s = osc.cos();		break;		// Cosine approximation: one harmonic
				case  1: s = osc.even3();	break;		// Even harmonic sine-like wave (3rd order)
				case  2: s = osc.even5();	break;		// Even harmonic sine-like wave (5th order)
				case  3: s = osc.tri();		break;		// Triangle wave: 1/f^2 odd harmonics
				case  4: s = osc.para();	break;		// Parabola train: 1/f^2 all harmonics
				case  5: s = osc.sqr()/4;	break;		// Square wave: 1/f odd harmonics
				case  6: s = osc.down()/4;	break;		// Downward saw wave: 1/f all harmonics
				case  7: s = osc.up()/4;	break;		// Upward saw wave: 1/f all harmonics
				case  8: s = osc.imp()/4;	break;		// Impulse train: flat spectrum all harmonics
				
				// modifiable generators ordered from dull to bright:
				case  9: s = osc.stair()/4;	break;		// Mix between a square and impulse
				case 10: s = osc.pulse()/4;	break;		// Mix between up and down
				case 11: s = osc.line2()/4;	break;		// Mix between a saw and a triangle
				case 12: s = osc.up2()/4;	break;		// Mix between two saws
			}
			
			io.out(0) = io.out(1) = s * 0.2f;
		}
	}
开发者ID:LancePutnam,项目名称:Gamma,代码行数:35,代码来源:lfoAudio.cpp

示例2: audioCB

void audioCB(AudioIOData& io){

	while(io()){
		float s	= sineT1()
				+ sineT2.nextL()
				+ sineCS().i
				+ sineC1.cos()
				+ sineC2()
				+ sineRs()
		;

		s = s/6 - sin(sineC3.nextPhase());	// pass only the artifacts
		
		io.out(0) = io.out(1) = s * 0.2f;
	}

}
开发者ID:AlloSphere-Research-Group,项目名称:Gamma,代码行数:17,代码来源:sineTautology.cpp

示例3: audioCB

void audioCB(AudioIOData& io){

	while(io()){
	
		if(tmr()){
			if(cnt()){
				modMode ^= true;			// increment LFO type, switch mod mode when wraps
				printf("\nMod mode: %s modulation\n", modMode? "Amp" : "Freq");
			}
		}
			
		env.mod(mod.cosU());	// modulate modifier parameter with unipolar cosine wave

		float s = 0.f;			// initialize current sample to zero

		switch(cnt.val){			
				
			// non-modifiable generators ordered from smooth to sharp:
			case  0: s = env.cosU();	break;	// unipolar cosine
			case  1: s = env.hann();	break;	// a computed hann window (inverted cosU)
			case  2: s = env.triU();	break;	// unipolar triangle
			case  3: s = env.upU();		break;  // unipolar upward ramp
			case  4: s = env.downU();	break;  // unipolar downward ramp
			case  5: s = env.sqrU();	break;	// unipolar square

			// modifiable generator ordered from smooth to sharp:
			case  6: s = env.pulseU();	break;	// Mix between upward ramp and downward ramp
			case  7: s = env.stairU();	break;	// Mix between a square and impulse. 
			case  8: s = env.line2U();	break;	// Mix between a ramp and a triangle
			case  9: s = env.up2U();	break;  // Mix between two ramps			
		}
		
		if(modMode){			// amplitude modulate noise with envelope
			s *= noise();
		}
		else{					   // frequency modulate oscillator with envelope
			osc.freq(s*400 + 200); // between 100 and 200 hz
			s = osc.cos();
		}
		
		io.out(0) = io.out(1) = s*0.2;
	}
}
开发者ID:AlloSphere-Research-Group,项目名称:Gamma,代码行数:43,代码来源:oscLFO2.cpp


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