y@0: /* y@0: ============================================================================== y@0: y@0: This file was auto-generated! y@0: y@0: It contains the basic startup code for a Juce application. y@0: y@0: ============================================================================== y@0: */ y@0: y@0: #ifndef __PLUGINPROCESSOR_H_4693CB6E__ y@0: #define __PLUGINPROCESSOR_H_4693CB6E__ y@0: y@0: #include "../JuceLibraryCode/JuceHeader.h" y@0: #include y@0: #include y@0: //============================================================================== y@0: /** y@0: */ y@0: class ADRessAudioProcessor : public AudioProcessor y@0: { y@0: public: y@0: //============================================================================== y@0: ADRessAudioProcessor(); y@0: ~ADRessAudioProcessor(); y@0: y@0: //============================================================================== y@0: void prepareToPlay (double sampleRate, int samplesPerBlock); y@0: void releaseResources(); y@0: y@0: y@0: void processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages); y@0: y@0: //============================================================================== y@0: AudioProcessorEditor* createEditor(); y@0: bool hasEditor() const; y@0: y@0: //============================================================================== y@0: const String getName() const; y@0: y@0: int getNumParameters(); y@0: y@0: float getParameter (int index); y@0: void setParameter (int index, float newValue); y@0: y@0: const String getParameterName (int index); y@0: const String getParameterText (int index); y@0: y@0: const String getInputChannelName (int channelIndex) const; y@0: const String getOutputChannelName (int channelIndex) const; y@0: bool isInputChannelStereoPair (int index) const; y@0: bool isOutputChannelStereoPair (int index) const; y@0: y@0: bool silenceInProducesSilenceOut() const; y@0: bool acceptsMidi() const; y@0: bool producesMidi() const; y@0: y@0: double getTailLengthSeconds() const; y@0: y@0: //============================================================================== y@0: int getNumPrograms(); y@0: int getCurrentProgram(); y@0: void setCurrentProgram (int index); y@0: const String getProgramName (int index); y@0: void changeProgramName (int index, const String& newName); y@0: y@0: //============================================================================== y@0: void getStateInformation (MemoryBlock& destData); y@0: void setStateInformation (const void* data, int sizeInBytes); y@0: y@0: //============================================================================== y@0: y@0: // these are used to persist the UI's size - the values are stored along with the y@0: // filter's other parameters, and the UI component will update them when it gets y@0: // resized. y@0: int lastUIWidth_, lastUIHeight_; y@0: y@0: enum Parameters y@0: { y@0: kFFTSizeParam = 0, y@0: kHopSizeParam, y@0: kWindowTypeParam, y@0: kWidthParam, y@0: kAzimuthParam, y@0: kNumParameters y@0: }; y@0: y@0: enum Window y@0: { y@0: kWindowRectangular = 1, y@0: kWindowBartlett, y@0: kWindowHann, y@0: kWindowHamming y@0: }; y@0: y@0: enum HopSize y@0: { y@0: kHopSize1Window = 1, y@0: kHopSize1_2Window, y@0: kHopSize1_4Window, y@0: kHopSize1_8Window y@0: }; y@0: y@0: // This parameter indicates the FFT size for phase vocoder computation. It is selected y@0: // by the GUI and may temporarily differ from the actual size used in calculations. y@0: int fftSelectedSize_; y@0: int hopSelectedSize_; // Hop size, chosen from one of the options above y@0: int windowType_; // Type of window used y@0: y@0: int /*indL_, indR_,*/ width_, azimuth_, beta_; y@0: int indMinL_,indMinR_,indMaxL_,indMaxR_; y@0: float invGain_; y@0: y@0: bool computeR_, computeL_; y@0: float invBeta_; y@0: std::complex i1; y@0: y@0: private: y@0: y@0: double azr_[2049][11]; y@0: double azl_[2049][11]; y@0: double realR_[2049]; y@0: double imagR_[2049]; y@0: double realL_[2049]; y@0: double imagL_[2049]; y@0: y@0: // Methods to initialise and de-initialise the FFT machinery y@0: void initFFT(int length); y@0: void deinitFFT(); y@0: y@0: // Methods to initialise and de-initialise the window y@0: void initWindow(int length, int windowType); y@0: void deinitWindow(); y@0: y@0: // Methods to update the buffering for the given hop size and the output scaling y@0: void updateHopSize(); y@0: void updateScaleFactor(); y@0: y@0: // Whether the FFT has been initialised and is therefore ready to go y@0: bool fftInitialised_; y@0: y@0: // Variables for calculating the FFT and IFFT: complex data structures and the y@0: // "plan" used by the fftw library to calculate the transforms. y@0: fftw_complex *fftTimeDomain_, *fftFrequencyDomain_; y@0: fftw_plan fftForwardPlan_, fftBackwardPlan_; y@0: y@0: // Size of the FFT (generally a power of two) and the hop size (in samples, generally a fraction of FFT size) y@0: int fftActualTransformSize_; y@0: int hopActualSize_; y@0: y@0: // Amount by which to scale_ the inverse FFT to return to original amplitude: depends on the y@0: // transform size (because of fftw implementation) and the hop size (because of inherent overlap) y@0: double fftScaleFactor_; y@0: y@0: // Circular buffer gathers audio samples from the input until enough are available y@0: // for the FFT calculation y@0: AudioSampleBuffer inputBuffer_; y@0: int inputBufferLength_; y@0: int inputBufferWritePosition_; y@0: y@0: // Circular buffer that collects output samples from the FFT overlap-add process y@0: // before they are ready to be sent to the output stream y@0: AudioSampleBuffer outputBuffer_; y@0: int outputBufferLength_; y@0: int outputBufferReadPosition_, outputBufferWritePosition_; y@0: y@0: // How many samples since the last FFT? y@0: int samplesSinceLastFFT_; y@0: y@0: // Stored window function for pre-processing input frames y@0: double *windowBuffer_; y@0: int windowBufferLength_; y@0: y@0: // Whether or not prepareToPlay() has been called, i.e. that resources are in use y@0: bool preparedToPlay_; y@0: y@0: // Spin lock that prevents the FFT settings from changing in the middle of the audio y@0: // thread. y@0: SpinLock fftSpinLock_; y@0: y@0: void changeParams(); y@0: y@0: //============================================================================== y@0: JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ADRessAudioProcessor); y@0: }; y@0: y@0: #endif // __PLUGINPROCESSOR_H_4693CB6E__