Hi Connor,
I noticed that you are still struggling with implementing the fftw lib.
I did not read all your posts in this thread in detail, but maybe my
implementation of fftw, can be of help to you.
I have recently implemented the fftw in a VST-plugin (using JUCE API).

Here is where I implement the fftw in a pitch estimator plugin:
https://github.com/junilyd/Pitch-Estimator-Plugin/blob/master/Source/PluginProcessor.cpp

In line 191 you can find the signal processing method
and in line 155 I allocate a data buffer for the fft result.

Here is the fftw class I use:
https://github.com/junilyd/Pitch-Estimator-Plugin/blob/master/Builds/MacOSX/FastFourierTransformer.cpp


I used this implementation by GuillaumeLeNost, to get started:
https://github.com/GuillaumeLeNost/SimpleFFT/tree/master/Source

I mainly separated the length of the fft from the buffer size, the rest
of the fftw-class is still the same as the original.

I hope it will be of help.

/Jacob

On 20/06/15 18:15, Connor Gettel wrote:
>> Hey guys,
>>
>> So i’ve used a typedef struct for the FFT stuff, accessing the fftbuffer 
>> with -> notation in the callback (learning lots!).  
>> Can anyone confirm that this makes sense? It’s compiling fine, still 
>> crashing though.
>>
>> typedef struct _FFTW3{
>>      double *fftbuffer;
>>      int buffersize;
>> }FFTW3; 
>>
>> static int audio_callback(   const void                      *inputBuffer, 
>>                              void                            *outputBuffer,
>>                              unsigned long                   framesPerBuffer,
>>                              const PaStreamCallbackTimeInfo* timeInfo,
>>                              PaStreamCallbackFlags           statusFlags,
>>                              void                            *userData )
>> {
>>      
>>      {
>>              int i;
>>              float *inp = (float *) inputBuffer, *outp = (float *) 
>> outputBuffer;
>>              for (i=0;i<framesPerBuffer;i++) *outp++ = *inp++;
>>              
>>      }
>>      
>>      FFTW3 *p = (FFTW3*)userData;
>>      double *fftbuffer = p->fftbuffer;
>>      fftbuffer=*in;
>>      int i;
>>      float *fftbuff = (float*) fftbuffer, *inp=(float*) inputBuffer;
>>      for(i=0;i<framesPerBuffer;i++)*fftbuff++ = *inp++;
>>      
>>              fftw_execute(my_plan);
>>
>>              
>>      return paContinue;
>> }
> --
> 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

Reply via email to