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


C++ maxiOsc::saw方法代码示例

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


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

示例1: play

void play(double *output) {//this is where the magic happens. Very slow magic.

	currentCount=(int)timer.phasor(9);//this sets up a metronome that ticks every so often

	if (lastCount!=currentCount) {//if we have a new timer int this sample, play the sound
		trigger=1;//play the arpeggiator line
		trigger2=leadLineTrigger[playHead%256];//play the lead line
		if (trigger2==1) {//if we are going to play a note
			leadPitch=mtof.mtof(leadLinePitch[newnote]);//get the next pitch val
			newnote++;//and iterate
			if (newnote>14) {
				newnote=0;//make sure we don't go over the edge of the array
			}
		}
		currentPitch=mtof.mtof(pitch[(playHead%4)]+chord[currentChord%8]);//write the frequency val into currentPitch
		playHead++;//iterate the playhead
		if (playHead%32==0) {//wrap every 4 bars
			currentChord++;//change the chord
		}
		//cout << "tick\n";//the clock ticks
		lastCount=0;//set lastCount to 0
	}

	bassout=filter2.lores(envelope.adsr(bass.saw(currentPitch*0.5)+sound.pulse(currentPitch*0.5,mod.phasor(1)),1,0.9995, 0.25, 0.9995, 1, trigger),9250,2);//new, simple ADSR. 
	leadout=filter.lores(leadenvelope.ar(lead2.saw(leadPitch*4)+lead.pulse(leadPitch+(leadmod.sinebuf(1.9)*1.5), 0.6), 0.00005, 0.999975, 50000, trigger2),5900,10);//leadline

	delayout=(leadout+(delay.dl(leadout, 14000, 0.8)*0.5))/2;//add some delay

	if(trigger!=0)trigger=0;//set the trigger to off if you want it to trigger immediately next time.


	output[0]=(bassout+delayout)/2;//sum output
	output[1]=(bassout+delayout)/2;

}
开发者ID:Clivia,项目名称:Maximilian,代码行数:35,代码来源:16.Replicant.cpp

示例2: play

void play(double *output) {
	
	CurrentCount=myCounter.phasor(1, 1, 9);//phasor can take three arguments; frequency, start value and end value.
	
	if (CurrentCount<5)//simple if statement
		
		myOscOutput=mySwitchableOsc.square(CurrentCount*100);
	
	else if (CurrentCount>=5)//and the 'else' bit.
		
		myOscOutput=mySwitchableOsc.saw(CurrentCount*50);//one osc object can produce whichever waveform you want. 
	
	if (CurrentCount==1) 
		
		myEnvelope.trigger(0,myEnvelopeData[0]); //trigger the envelope
	
	myFilteredOutput=myFilter.lores(myOscOutput,(myEnvelope.line(6, myEnvelopeData)),10);//lores takes an audio input, a frequency and a resonance factor (1-100)
	
	myPanPosition=myAutoPanner.sinewave(1);
	
	myOutputs.stereo(myFilteredOutput,myStereoOutput,myPanPosition);//Stereo, Quad or 8 Channel. Specify the input to be mixed, the output[numberofchannels], and the pan (0-1,equal power).	
	output[0]=myStereoOutput[0];//When working with mixing, you need to specify the outputs explicityly
	output[1]=myStereoOutput[1];//
	
}
开发者ID:Clivia,项目名称:Maximilian,代码行数:25,代码来源:11.Mixing.cpp


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