Audio Input buffer - Trying to access Audio Input on a sample by sample basis



  • Hey everyone.
    I'm new to Qt; trying it out from having previously used JUCE.

    I'm trying to set up a simple audio input buffer of samples that I can access.
    In JUCE you'd set up the audio device, and then access the input buffer via an audio callback:

    void audioDeviceCallback (const float** inputChannelData, int numSamples)
    {
    const float *inL = inputChannelData[0];
    const float *inR = inputChannelData[1];

    while (numSamples --)
    {
    

    doSomething();

        inL++;
        inR++;
    }
    

    }

    I've tried to get Qt set up in a similar fashion, but I've as yet been unsuccessful. The documentation refers only to recording to a file using QAudioInput from what I could see.

    Can anyone offer any advice?


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    QAudioInput returns a pointer to a QIODevice that will provide the audio data. Connect the readyRead signal from that QIODevice object to a slot of your class, there you can read the audio data received and make what you want with it.

    Hope it helps