@Christoph-Hart
cannot get it working. Compiles, runs but onController never gets executed.
This is what I did:
Changed HardcodedMidiProcessor to HardcodedScriptProcessor because does not exist.
Changed Modulator for LfoModulator since Modulator does not have setIntensity
class IntensityForwarder: public hise::HardcodedScriptProcessor
{
public:
/** Set the name and default ID of the processor. */
SET_PROCESSOR_NAME("IntensityForwarder", "IntensityForwarder", "IntensityForwarder");
IntensityForwarder(MainController* mc, const String& id, const String& modId):
HardcodedScriptProcessor(mc, id, mc->getMainSynthChain())
{
modToUse = dynamic_cast<LfoModulator*>(ProcessorHelpers::getFirstProcessorWithName(mc->getMainSynthChain(), modId));
jassert(modToUse != nullptr);
// Add one slider that will forward the value to the intensity.
Content.addKnob("modIntensity", 100, 100);
}
// add all callbacks
void onControl(var c, var value)
{
std::cout << "on Control" << std::endl;
modToUse->setIntensity((float)value);
}
private:
WeakReference<LfoModulator> modToUse;
JUCE_DECLARE_WEAK_REFERENCEABLE(IntensityForwarder);
};
then I had to build it using add, instead of create
builder.add<IntensityForwarder>(new IntensityForwarder(mc, "IntensityForwarder1", "LfoGain"), mc->getMainSynthChain(), raw::IDs::Chains::Midi);
and lately conected it using this:
sliderForwarder.connect("IntensityForwarder1");
template <int ParameterIndex>
class StrippedSlider : public hise::HiSlider,
public ControlledObject
{
public:
StrippedSlider(MainController* mc, const String& name) :
HiSlider(name),
ControlledObject(mc)
{
raw::Pool pool(mc, true);
// flaf.setFilmstripImage(pool.loadImage("Strip.png"), 100);
flaf.setFilmstripImage(pool.loadImage("StripBigNew.png"), 64);
flaf.setScaleFactor(0.3);
setName(name);
setSliderStyle(Slider::RotaryHorizontalVerticalDrag);
setLookAndFeel(&flaf);
setTextBoxStyle(Slider::NoTextBox, false, 0, 0);
}
~StrippedSlider()
{
connection = nullptr;
}
void connect(const String& id)
{
auto p = ProcessorHelpers::getFirstProcessorWithName(getMainController()->getMainSynthChain(), id);
setup(p, ParameterIndex, Slider::getName());
connection = new raw::UIConnection::Slider<ParameterIndex>(this, getMainController(), id);
setLookAndFeel(&flaf);
}
bool tempoSyncMode = false;
FilmstripLookAndFeel flaf;
ScopedPointer<raw::UIConnection::Slider<ParameterIndex>> connection;