When setting up the audio callback for PortAudio you can give it a void* to some data. Set up the fft plan and set the fft object as the void*. In the callback you can use a cast to get the fft object from the void*
Good luck Sent from my iPhone > On 11 Jun 2015, at 16:20, Connor Gettel <connorget...@me.com> wrote: > > Hello Everyone, > > My name’s Connor and I’m new to this mailing list. I was hoping somebody > might be able to help me out with some FFT code. > > I want to do a spectral analysis of the mic input of my sound card. So far in > my program i’ve got my main function initialising portaudio, inputParameters, > outputParameters etc, and a callback function above passing audio through. It > all runs smoothly. > > What I don’t understand at all is how to structure the FFT code in and around > the callback as i’m fairly new to C. I understand all the steps of the FFT > mostly in terms of memory allocation, setting up a plan, and executing the > plan, but I’m still really unclear as how to structure these pieces of code > into the program. What exactly can and can’t go inside the callback? I know > it’s a tricky place because of timing etc… > > Could anybody please explain to me how i could achieve a real to complex 1 > dimensional DFT on my audio input using a callback? > > I cannot even begin to explain how grateful I would be if somebody could walk > me through this process. > > I have attached my callback function code so far with the FFT code > unincorporated at the very bottom below the main function (should anyone wish > to have a look) > > I hope this is all clear enough, if more information is required please let > me know. > > Thanks very much in advance! > > All the best, > > Connor. > > > <Callback_FFT.c> > -- > dupswapdrop -- the music-dsp mailing list and website: > subscription info, FAQ, source code archive, list archive, book reviews, dsp > links > http://music.columbia.edu/cmc/music-dsp > http://music.columbia.edu/mailman/listinfo/music-dsp -- dupswapdrop -- the music-dsp mailing list and website: subscription info, FAQ, source code archive, list archive, book reviews, dsp links http://music.columbia.edu/cmc/music-dsp http://music.columbia.edu/mailman/listinfo/music-dsp