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

 This file is part of the GIN library.
 Copyright (c) 2019 - Roland Rabien.

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


#pragma once

/**  Stereo Enhancer

     Copyright (c) 2006-2008 and 2012, Michael "LOSER" Gruhn

     Permission to use, copy, modify, and/or distribute this software for any
     purpose with or without fee is hereby granted, provided that the above
     copyright notice and this permission notice appear in all copies.

     THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
     WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
     MERCHANTABILITY, FITNESS AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
     DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
     PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
     ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
     THIS SOFTWARE.
*/

class StereoEnhancer
{
public:
    StereoEnhancer();
    void process (juce::AudioSampleBuffer& buffer);
    void setSampleRate (float sr) { sampleRate = sr; }
    void setParameters (float widthLP, float freqHPFader, float widthHP);

private:
    float sampleRate = 44100.0f;

    float widthLP, widthCoeffLP;
    float freqHP;
    float widthHP, widthCoeffHP;

    float xHP, a0HP, b1HP;

    float tmp1HP, tmp2HP;
};
