Simple Delay Pedal

I’m trying to modify the ProcessingAudioInputTutorial to make a delay pedal. I found some code for a circular buffer and tested it thoroughly, it’s working. I’ve implemented the code for the delay pedal but it’s not working and I can’t figure out why.

I initilialize the delay line here:

MainContentComponent() : delayLine(44100),
                         spectrogramFFT(fftOrder),
                         spectrogramImage (Image::RGB, 512, 512, true)

and the delay line is implemented inside getNextAudioBlock:

               auto* outBuffer = bufferToFill.buffer->getWritePointer (channel, bufferToFill.startSample);
                                                                      
                for (auto sample = 0; sample < bufferToFill.numSamples; ++sample)
                {
                    auto xn = inBuffer[sample];
                    
                    auto z_out = delayLine.get();
                    
                    auto yn = xn + z_out;

                    delayLine.put(yn);
                    
                    outBuffer[sample] = yn;
                    
                }

Any idea why it won’t work? Is it a problem that the delay line is longer than the audio buffer size?

Thanks

How exactly it isn’t working? No sound at all? Glitchy sound? No delay effect audible? (For stereo sound you of course need 2 instances of your delay object or need to make it support stereo internally…)

It plays the direct sound but no effect. I have the channels set to go mono to mono.

    setAudioChannels (1, 1);

I got it working…small bug. Thanks for the help.