Hey,
So what happens: The visual rendering from Ableton goes laggy if i run a automation.
What my code is doing:
void MyAudioProcessor::setParameter(int index, float newValue)
{
globalDatabase->SetValueFromProc(index, newValue); // Set the value
globalDatabase->ToggleValueFromProc(index); // Set the specific flag which Knob has a new value
globalDatabase->ToggleNewValueFromProc(); // Global flag that the Editor knows there is a new value on a knob
}
In my Editor the code looks like that:
void MyAudioEditor::timerCallback()
{
if (globalDatabase->getToggleNewValueFromProc())
{
for (int i = 0; i < 8; i++)
{
if(globalDatabase->getToggleValueFromProc(i));
{
poti[i]->setValue(globalDatabase->GetValueFromProc(i), dontSendNotification);
}
}
}
}
That is my poti class
Knob::Knob()
{
frameWidth = 0;
frameHeight = 0;
isHorizontal = false;
dragging = false;
}
Knob::~Knob()
{
}
void Knob::SetProcValue(float val)
{
value = val;
}
float Knob::GetProcValue()
{
return value;
}
void Knob::SetImage(Image image, int numFrames_, bool isHorizontal_)
{
filmStripImage = image;
if (filmStripImage.isValid())
{
numFrames = numFrames_;
isHorizontal = isHorizontal_;
if (isHorizontal)
{
frameHeight = filmStripImage.getHeight();
frameWidth = filmStripImage.getWidth() / numFrames;
}
else
{
frameHeight = filmStripImage.getHeight() / numFrames;
frameWidth = filmStripImage.getWidth();
}
}
else
{
numFrames = 0;
}
repaint();
}
bool Knob::isDragging()
{
return dragging;
}
void Knob::startedDragging()
{
dragging = true;
}
void Knob::stoppedDragging()
{
dragging = false;
}
void Knob::paint(Graphics& g)
{
if (filmStripImage.isValid())
{
int value = (int)((getValue() - getMinimum()) / (getMaximum() - getMinimum()) * (numFrames - 1));
int imageHeight;
int imageWidth;
if (getTextBoxPosition() == TextBoxBelow)
{
imageWidth = getWidth() - getTextBoxHeight();
imageHeight = getHeight() - getTextBoxHeight();
}
else
{
imageWidth = getWidth();
imageHeight = getHeight();
}
if (isHorizontal)
{
g.drawImage(filmStripImage, (getWidth() - imageWidth) * 0.5, 0, imageWidth, imageHeight,
value * frameWidth, 0, frameWidth, frameHeight);
}
else
{
g.drawImage(filmStripImage, 0, 0, imageWidth, imageHeight,
0, value * frameHeight, frameWidth, frameHeight);
}
}
}
and thats the header from the slider
class Knob : public juce::Slider
{
public:
Knob();
~Knob();
void startedDragging();
void stoppedDragging();
void SetProcValue(float val);
float GetProcValue();
void SetImage(Image image, int numFrames, bool isHorizontal = false);
int SetFrameWidth() const { return frameWidth; }
int GetFrameWidth() const { return frameHeight; }
bool isDragging();
void paint(Graphics&g);
private:
Image filmStripImage;
float value;
int numFrames, frameWidth, frameHeight;
bool dragging;
bool isHorizontal;
};
That’s it.
If i delete the setValue line, everything is fine.
It doesn’t help if i turnOff “setImage” from the poti that it has no picture to show.
If i set the value to a fix value everything is fine… something like that : globalDatabase->SetValueFromProc(index, 1);
Ah, the sound engine from Ableton works fine, now “knacks” or something like that.
My CPU Usage is with an Automation 8% higher then normaly.
It’s only the rendering engine which is “laggy”…
Hopefully some of u know where i have to look for…