Beispiel #1
0
    void process(AUAudioFrameCount frameCount, AUAudioFrameCount bufferOffset) override {

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

            int frameOffset = int(frameIndex + bufferOffset);

            centerFrequency = centerFrequencyRamper.getAndStep();
            eqfil0->freq = (float)centerFrequency;
            eqfil1->freq = (float)centerFrequency;
            bandwidth = bandwidthRamper.getAndStep();
            eqfil0->bw = (float)bandwidth;
            eqfil1->bw = (float)bandwidth;
            gain = gainRamper.getAndStep();
            eqfil0->gain = (float)gain;
            eqfil1->gain = (float)gain;

            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_eqfil_compute(sp, eqfil0, in, out);
                    } else {
                        sp_eqfil_compute(sp, eqfil1, in, out);
                    }
                } else {
                    *out = *in;
                }
            }
        }
    }
    void process(AUAudioFrameCount frameCount, AUAudioFrameCount bufferOffset) override {
        // For each sample.
        for (int frameIndex = 0; frameIndex < frameCount; ++frameIndex) {
            double centerFrequency = double(centerFrequencyRamper.getStep());
            double bandwidth = double(bandwidthRamper.getStep());
            double gain = double(gainRamper.getStep());

            int frameOffset = int(frameIndex + bufferOffset);

            eqfil->freq = (float)centerFrequency;
            eqfil->bw = (float)bandwidth;
            eqfil->gain = (float)gain;

            if (!started) {
                outBufferListPtr->mBuffers[0] = inBufferListPtr->mBuffers[0];
                outBufferListPtr->mBuffers[1] = inBufferListPtr->mBuffers[1];
                return;
            }
            for (int channel = 0; channel < channels; ++channel) {
                float *in  = (float *)inBufferListPtr->mBuffers[channel].mData  + frameOffset;
                float *out = (float *)outBufferListPtr->mBuffers[channel].mData + frameOffset;

                sp_eqfil_compute(sp, eqfil, in, out);
            }
        }
    }