本文整理汇总了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;
}
示例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;
}
}
示例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;
}
}
示例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;
}
}
示例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;
}
}
示例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;
}
}
示例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;
}
}