示例#1
0
int main() {
    sp_data *sp;
    sp_create(&sp);
    sp_srand(sp, 12345);
    sp->sr = SR;
    sp->len = sp->sr * LEN;
    uint32_t t, u;
    SPFLOAT in = 0, out = 0;

    sp_jcrev *unit[NUM];

    for(u = 0; u < NUM; u++) { 
        sp_jcrev_create(&unit[u]);
        sp_jcrev_init(sp, unit[u]);
    }

    for(t = 0; t < sp->len; t++) {
        for(u = 0; u < NUM; u++) sp_jcrev_compute(sp, unit[u], &in, &out);
    }

    for(u = 0; u < NUM; u++) sp_jcrev_destroy(&unit[u]);

    sp_destroy(&sp);
    return 0;
}
    void process(AUAudioFrameCount frameCount, AUAudioFrameCount bufferOffset) override {

        for (int frameIndex = 0; frameIndex < frameCount; ++frameIndex) {

            int frameOffset = int(frameIndex + bufferOffset);

            for (int channel = 0; channel < channels; ++channel) {
                float *in  = (float *)inBufferListPtr->mBuffers[channel].mData  + frameOffset;
                float *out = (float *)outBufferListPtr->mBuffers[channel].mData + frameOffset;
                
                if (started) {
                    if (channel == 0) {
                        sp_jcrev_compute(sp, jcrev0, in, out);
                    } else {
                        sp_jcrev_compute(sp, jcrev1, in, out);
                    }
                } else {
                    *out = *in;
                }
            }
        }
    }