/*
  ==============================================================================

    This file was auto-generated by the Jucer!

    It contains the basic startup code for a Juce application.

  ==============================================================================
*/

#ifndef __PLUGINPROCESSOR_H_34DAFF0F__
#define __PLUGINPROCESSOR_H_34DAFF0F__

#include "JuceHeader.h"
#include "JucePluginCharacteristics.h"

#include "PluginParameter.h"

//==============================================================================
/**
*/
class ThePilgrimAudioProcessor : public AudioProcessor
{
public:
    //==============================================================================
    ThePilgrimAudioProcessor();
    ~ThePilgrimAudioProcessor() override;

    //==============================================================================
    void prepareToPlay (double sampleRate, int samplesPerBlock) override;
    void releaseResources() override;

    void processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages) override;

    //==============================================================================
#if ! JUCE_AUDIOPROCESSOR_NO_GUI
    AudioProcessorEditor* createEditor() override;
    bool hasEditor() const override;
#endif

    double getTailLengthSeconds() const override { return 0.0; }

    //==============================================================================
    const String getName() const override;

    int getNumParameters() override;

    float getParameter (int index) override;
    void setParameter (int index, float newValue) override;

    const String getParameterName (int index) override;
    const String getParameterText (int index) override;

    const String getInputChannelName (int channelIndex) const override;
    const String getOutputChannelName (int channelIndex) const override;
    bool isInputChannelStereoPair (int index) const override;
    bool isOutputChannelStereoPair (int index) const override;

    bool acceptsMidi() const override;
    bool producesMidi() const override;

    //==============================================================================
    int getNumPrograms() override;
    int getCurrentProgram() override;
    void setCurrentProgram (int index) override;
    const String getProgramName (int index) override;
    void changeProgramName (int index, const String& newName) override;

    //==============================================================================
    void getStateInformation (MemoryBlock& destData) override;
    void setStateInformation (const void* data, int sizeInBytes) override;

    bool silenceInProducesSilenceOut() const override { return true; }

    //==============================================================================
    //	USER FUNCTIONS =============================================================
    //==============================================================================

    void updateFilter();

    PluginParameter filterParameter;
    PluginParameter mixParameter;

    IIRFilterOld highFilterL;
    IIRFilterOld highFilterR;
    IIRFilterOld lowFilterL;
    IIRFilterOld lowFilterR;

    double globalSampleRate;

    enum Parameters
    {
        filterFreqParam = 0,
        mixParam,
        totalNumParams
    };

    AudioSampleBuffer dryBuffer;

    JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ThePilgrimAudioProcessor);
};

#endif  // __PLUGINPROCESSOR_H_34DAFF0F__
