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


C++ Sine::freq方法代码示例

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


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

示例1: play

void play(double &left, double &right) {
	if (count%(int)(SAMPLE_RATE*1.6)==0) {
		kick_freq.reset();
		env_kick.reset();
	}
	if (count%(int)(SAMPLE_RATE*6.4)==0) {
		env_bass.reset();
		bass_freq.reset();
		bass2_freq.reset();
	}
	left += kick.freq(kick_freq.val()).val() * env_kick.val() * 0.3;
	left += fil_bass.io( bass.freq(bass_freq.val()).val() + bass2.freq(bass2_freq.val()).val() ) * env_bass.val() * 0.3;

	if (count%(int)(SAMPLE_RATE*25.6)==0) {
		for (int i = 0; i < 8; i++) {
			s0_freq[i] = rand()%5000+500;
		}
	}
	if (count%(int)(SAMPLE_RATE*3.2)==0) {
		s0_fade.reset();
	}
	if (count%(int)(SAMPLE_RATE*0.1)==0) {
		if (s0_i > 7) s0_i = 0;
		s0.freq(s0_freq[s0_i++]);
		env_s0.reset();

		if (rand()%4==0) {
			env_s1.reset();
		}
	}
	left += s0.val() * env_s0.val() * s0_fade.val() * 0.1;
	left += s1.val() * env_s1.val() * 0.05;

	for (int n = 0; n < num; n++) {
		if (ars[n].done()) {
			sines[n].freq(rand()%1000+100);
			ars[n].set(0, 1, rand()%1000*0.01, 0, rand()%1000*0.01);
		}
	}
	for (int n = 0; n < num; n++) {
		left += sines[n].val() * ars[n].val() * 0.02;
	}
	right = left;
}
开发者ID:ryo-okabayashi,项目名称:pa,代码行数:44,代码来源:pa.cpp

示例2: audioCB

void audioCB(AudioIOData& io){

	while(io()){

		oscM.freq(modFreq.hann() * 110 + 1);	// change modulator frequency

		float s = oscC() * (oscM() * 0.5 + 0.5) * 0.2;
		
		io.out(0) = io.out(1) = s;
	}
}
开发者ID:AlloSphere-Research-Group,项目名称:Gamma,代码行数:11,代码来源:modAmp.cpp

示例3: audioCB

void audioCB(AudioIOData& io){

	while(io()){

		oscM.freq(modFreq.hann() * 110 + 1);	// change modulator frequency
		oscC.freq(ff + oscM()*100);				// modulate frequency of carrier

		float s = oscC() * 0.2;
		
		io.out(0) = io.out(1) = s;
	}
}
开发者ID:AlloSphere-Research-Group,项目名称:Gamma,代码行数:12,代码来源:modFreqTransition.cpp

示例4: audioCB

void audioCB(AudioIOData& io){

	while(io()){
	
		if(tmr()){
			env = fund*2 + rnd::uni(10.0);	// set new target value of envelope
		}
		
		osc2.freq(env());					// modulate frequency of 2nd harmonic
		float s = (osc1() + osc2()) * 0.1;

		io.out(0) = io.out(1) = s;
	}
}
开发者ID:michaeldonovan,项目名称:wdl-md,代码行数:14,代码来源:envSeg.cpp

示例5: audioCB

void audioCB(AudioIOData& io){

	while(io()){
		
		if(tmr()){
			freq = pow(2, rnd::uniS(1.))*440;
		}
		
		src.freq(freq());
		
		float s = src();
			
		io.out(0) = io.out(1) = s * 0.2f;
	}
}
开发者ID:AlloSphere-Research-Group,项目名称:Gamma,代码行数:15,代码来源:onePoleSmooth.cpp

示例6: onAudio

	void onAudio(AudioIOData& io){

		tmr.period(0.25);

		// Set time taken to reach new frequency value
		freq.lag(0.1);

		while(io()){

			if(tmr()){
				// Set new target frequency of one-pole
				freq = pow(2, rnd::uniS(1.))*440;
			}

			// Use smoothed output of one-pole for oscillator frequency
			src.freq(freq());
			
			float s = src();
				
			io.out(0) = io.out(1) = s * 0.2f;
		}
	}
开发者ID:PeterZhouSZ,项目名称:Gamma,代码行数:22,代码来源:portamento.cpp

示例7: onAudio

	void onAudio(AudioIOData& io){
		while(io()){
			src.freq(220);
			float s = src();

			// Input next sample for analysis
			// When this returns true, then we have a new spectral frame
			if(stft(s)){
			
				// Loop through all the bins
				for(unsigned k=0; k<stft.numBins(); ++k){
					// Here we simply scale the complex sample
					stft.bin(k) *= 0.2;
				}
			}
		
			// Get next resynthesized sample
			s = stft();
		
			io.out(0) = s;
			io.out(1) = s;
		}
	}
开发者ID:LancePutnam,项目名称:Gamma,代码行数:23,代码来源:STFT.cpp


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