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

    OSCReceiverWrapper.h
    Created: 5 May 2025 2:34:15pm
    Author:  Luigi

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

#pragma once
#include <JuceHeader.h>
#include "PluginProcessor.h"

#define MINEQBANDGAIN -60.0f
#define MAXEQBANDGAIN 20.0f
#define MINDISTORTIONDRIVE 1.0f
#define MAXDISTORTIONDRIVE 15.0f

enum Preset {
    NONE,
    PENCIL,
    CRAYON,
    FOUNTAINPEN,
    PEN,
    MARKER,
    MONOLINE,
    WATERCOLOR
};

class OSCReceiverWrapper : public juce::Component,
                           private juce::OSCReceiver,
                           private juce::OSCReceiver::ListenerWithOSCAddress<juce::OSCReceiver::MessageLoopCallback>
{
    public:
        OSCReceiverWrapper(int port, juce::AudioProcessorValueTreeState* apvts);
        ~OSCReceiverWrapper();

		void oscMessageReceived(const juce::OSCMessage& message) override;
		void oscConnectionError();

        void processMessage();
    private:
        enum Preset currentPreset = NONE;
        float x;
        float y;
        float aspectX;
        float aspectY;
        float pressure;
        float thickness;

        juce::AudioProcessorValueTreeState* apvts;
        
        juce::NormalisableRange<float>* eqGainRange;
        juce::NormalisableRange<float>* distortionDriveRange;
};