This is my first plugin project with JUCE. For the starting i am trying to make a simple plugin with two textbutton (On/Off). When on is clicked some filtering will occur and when off is clicked the original input will go through the plugin. So the plugin is just used for filtering.
I have assigned two textbuttons and added a listener class for them. I can see them on GUI. I am using the JUCE host for now. Can you please suggest what the next step would be
i am guessing i would need two functions
and a condition to determine which button is clicked. Can you give me an idea where should i put this functions?
thanks daniel. Your suggestions worked. Now they are mutualy exclusive radio buttons.
So now i can just create a buttonClicked function and there decide what happens when each button is clicked and then call this function in the process block right?
I guess i will try the easier way by setting the setFeatureOn (bool) method.
Just one more question, the filter application will be later depended on the frequency. Would be better to use a text box or a slider for the user to chose the desired frequency?
This is my first plugin design project, so my questions might sound a bit dumb, sorry for that
Definitely a slider, as the user can have a play. In a text box you would have to validate yourself, if the user added a number, or invalid text.
PLUS: the slider has a nice feature, which is a TextBox the user can click and enter the value numerically. So with the slider you can have both in one…
could you clarify a bit more about setting up this setFeatureOn (bool) method . Where should i declare this and how can i call it my process block in the PluginProcessor.cpp file
I understand from the tutorial that i have to declare a function on the plugin edition.h class and then use it on the other files, just failing to get them togehter
*Edited the question, because i already found the solution to my last problem
First, a master bypass triggered by the host exists. If bypass is off, the normal processBlock is called. If bypass is on, the processBlockBypassed is called.
But maybe you want to disable only certain features, so it might be still a useful thing to do:
Either if you want this function just to be accessible by your plugin, just add a bool member to your processor and an accessor method to set it (I assume you know how to do that). In you processBlock you can just use this bool value as conditional for your code.
If you want this parameter to be automated by the host, the most convenient way I found was to use the AudioProcessorValueTreeState, I posted the link to the tutorials before.
Side note, you only need one ButtonAttachment, the off button triggers the parameter as well.
to be honest i am completely lost right now. I have trying to figure out since you replied what you exactly meant.
So what i understood from the JUCE the tutorial is the processBlock function in the PluginProcessor.cpp file controls the playing of the audio and i need to put my conditions there.
So as you know i have two buttons ON and OFF. So when ON is clicked some filtering will occur and OFF is clicked no processing occurs and the incoming signal is output signal.
I don’t want my parameters to be automated by the host. The user will manually select the buttons.
I understood that i need a method to find out which button is active, and i think i can do it with the
bool isDown() function from juce button class. But not really sure how to set it up. Could you please provide me a sample code if possible?
thanks a lot for the code. I really appreciate the time you are taking to help me. Just a bit more
In my Audio Processor Editor i added the code you gave me but i get the two errors
if (buttonThatWasClicked == onButton || buttonThatWasClicked == offButton) ---- Invalid operands to binary expression (juce::Button and and juce:: TextBUutton)
processor.setFilteringEnabled (onButton->getToggleState()); — Member reference type juce:: TextButton is not a pointer, did you mean to use ‘.’?
Seems like you use the Buttons as member rather than pointers. Then . instead of -> is correct.
The best would be, post your code, so I can put the real names into my answers instead of making names up.
Sure you have to change the names of the buttons in my example to the names you are using. I don’t know your code.
If you want to compare a Button member pointer in the callback, use the address operator:
An abstract class is a class, that has pure virtual methods, that are not implemented (You googled that, right?)
This means, Button::Listener defines
This means, some class inheriting from Button::Listener shall implement that (otherwise this one is abstract as well and cannot be instanciated.
First thing is, to add the override keyword. That checks, if there exists a method in a base class, that this method would override. In your case, it would give you the error something like overriding a non existing method. That way you know, that your method was defined differently (and therefore will never be called).
NB 1: The name of the argument doesn’t matter
NB2: You can also use buttonStateChanged(Button*), but you have still to implement the buttonClicked. Otherwise your PluginEditor class is still abstract. You can leave it empty.