예제 #1
0
    void process(AUAudioFrameCount frameCount, AUAudioFrameCount bufferOffset) override {
        // For each sample.
        for (int frameIndex = 0; frameIndex < frameCount; ++frameIndex) {
            int frameOffset = int(frameIndex + bufferOffset);

            intensity = double(intensityRamper.getStep());
            dampingFactor = double(dampingFactorRamper.getStep());
            energyReturn = double(energyReturnRamper.getStep());
            mainResonantFrequency = double(mainResonantFrequencyRamper.getStep());
            firstResonantFrequency = double(firstResonantFrequencyRamper.getStep());
            secondResonantFrequency = double(secondResonantFrequencyRamper.getStep());
            amplitude = double(amplitudeRamper.getStep());

            drip->num_tubes = intensity;
            drip->damp = dampingFactor;
            drip->shake_max = energyReturn;
            drip->freq = mainResonantFrequency;
            drip->freq1 = firstResonantFrequency;
            drip->freq2 = secondResonantFrequency;
            drip->amp = amplitude;

            for (int channel = 0; channel < channels; ++channel) {
                float *out = (float *)outBufferListPtr->mBuffers[channel].mData + frameOffset;
                if (started) {
                    sp_drip_compute(sp, drip, &internalTrigger, out);
                } else {
                    *out = 0.0;
                }
            }
        }
        if (internalTrigger == 1) {
            internalTrigger = 0;
        }
    }
예제 #2
0
파일: ex_drip.c 프로젝트: eriser/Soundpipe
void write_osc(sp_data *sp, void *ud) {
    UserData *udp = ud;
    SPFLOAT trig, rev1, rev2, drip;
    sp_dust_compute(sp, udp->trig, NULL, &trig);
    sp_drip_compute(sp, udp->drip, &trig, &drip);
    sp_revsc_compute(sp, udp->rev, &drip, &drip, &rev1, &rev2);
    sp->out[0] = drip + rev1 * 0.05;
}
예제 #3
0
void process(sp_data *sp, void *udata)
{
    UserData *ud = udata;
    int i;
    SPFLOAT line = 0, cloud = 0, tmp = 0, revin = 0, rev = 0, dummy, drip = 0;
    SPFLOAT count = 0;
    SPFLOAT bar = 0, clk = 0, delIn = 0, delOut = 0;
    SPFLOAT mode = 0;

    for(i = 0; i < NUMLINE; i++) {
        sp_randi_compute(sp, ud->line[i].randi, NULL, &line);
        chord_cloud_compute(sp, ud->line[i].cc, NULL, &cloud);
        tmp += cloud * line;
    }
    revin += tmp * 0.5;
    sp_metro_compute(sp, ud->clk, NULL, &clk);
    sp_count_compute(sp, ud->meter, &clk, &count);
    bar = (count == 0 && clk);
    sp_drip_compute(sp, ud->drip, &bar, &drip);
    drip *= 0.5;
    revin += drip * 0.1;

    if(sp->pos > 44100 * 3) {
        SPFLOAT mg = 0, nn = 0;
        sp_maygate_compute(sp, ud->mg, &clk, &mg);
        sp_tseq_compute(sp, ud->seq, &mg, &nn);
        *ud->mod->freq = sp_midi2cps(nn + 12);
        modal_compute(sp, ud->mod, &mg, &mode);
        mode *= 0.3;
        revin += mode * 0.8;
        delIn += mode * 0.5;
    }

    delIn += drip * 0.1 + ud->pdel * 0.6;
    sp_vdelay_compute(sp, ud->del, &delIn, &delOut);
    ud->pdel = delOut;
    revin += delOut * 0.1;


    sp_revsc_compute(sp, ud->rev, &revin, &revin, &rev, &dummy);
    sp->out[0] = tmp * 0.2 + rev * 0.6 + drip * 0.1 + delOut * 0.5 + mode;

    /* Master fader */
    SPFLOAT mtick = (sp->pos == 0) ? 1.0 : 0.0;
    SPFLOAT fader = 0;
    sp_tenv_compute(sp, ud->master, &mtick, &fader);
    sp->out[0] *= fader;
    sp_progress_compute(sp, ud->prog, NULL, NULL);

}