本文整理汇总了C++中maxiOsc::pulse方法的典型用法代码示例。如果您正苦于以下问题:C++ maxiOsc::pulse方法的具体用法?C++ maxiOsc::pulse怎么用?C++ maxiOsc::pulse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类maxiOsc
的用法示例。
在下文中一共展示了maxiOsc::pulse方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: play
void play(double *output) {
//so this first bit is just a basic metronome so we can hear what we're doing.
currentCount=(int)timer.phasor(0.5);//this sets up a metronome that ticks every 2 seconds
if (lastCount!=currentCount) {//if we have a new timer int this sample, play the sound
ADSR.trigger=1;
cout << "tick\n";//the clock ticks
lastCount=0;//set lastCount to 0
}
//and this is where we build the synth
ADSRout=ADSR.adsr(1.0,ADSR.trigger);
LFO1out=LFO1.sinebuf(0.2);//this lfo is a sinewave at 0.2 hz
VCO1out=VCO1.pulse(55,0.6);//here's VCO1. it's a pulse wave at 55 hz, with a pulse width of 0.6
VCO2out=VCO2.pulse(110+LFO1out,0.2);//here's VCO2. it's a pulse wave at 110hz with LFO modulation on the frequency, and width of 0.2
VCFout=VCF.lores((VCO1out+VCO2out)*0.5, ADSRout*10000, 10);//now we stick the VCO's into the VCF, using the ADSR as the filter cutoff
double finalSound=VCFout*ADSRout;//finally we add the ADSR as an amplitude modulator
ADSR.trigger=0;
output[0]=finalSound;
output[1]=finalSound;
}
示例3: play
void play(double *output) {
// A pulse wave!!! Yay
out = osc.pulse(90, ramp.phasor(.2));
// Fill our output buffer
output[0]=out;
output[1]=out;
// After we have filled our output array, send the array
// and the size of the array (in this case the amount of
// channels, but in ofx or juce you might need to do
// something like channels*bufferSize).
recorder.passData(output, maxiSettings::channels);
}