A couple of bugs


…that i’ve come across.

JuceVSTWrapper.cpp in tha audio-plugin code is missing this function:

long getProgram () { return filter->getCurrentProgram (); }

I keep forgetting to mention this - i guess because its such a quick fix to make.

and another one, which i’m not so sure about…

When i create a slider with a skew factor, in release mode only, the lower range limit doens’t seem to work. (in my case i have a lower limit of 100.0 but can move the slider to 0.0). It seems to be a compiler optimisation problem, and i can fix it by setting floating point consistency to improved consitency in the optimisation settings. I’ve currently set this for the whole JUCE project, which isn’t ideal, but I haven’t had time to look into what the specific problem is.

btw, this is with VC++ .net v7, and i had to use the VC6 project files because it won’t load v8 files.


Ok, thanks for the VST bug.

I don’t understand why the floating-point stuff would go so wrong. Does it improve if you change Slider::setValue to this:

void Slider::setValue (double newValue,
                       const bool sendUpdateMessage,
                       const bool sendMessageSynchronously)
    if (interval > 0)
        newValue = minimum + interval * floor ((newValue - minimum) / interval + 0.5);

    if (newValue <= minimum || maximum <= minimum)
        newValue = minimum;
    else if (newValue >= maximum)
        newValue = maximum;

    if (currentValue != newValue)
        if (valueBox != 0)
            valueBox->hideEditor (true);

        currentValue = newValue;

        if (popupDisplay != 0)
            ((SliderPopupDisplayComponent*) popupDisplay)->updatePosition();

        if (sendUpdateMessage)
            if (sendMessageSynchronously)
                sendSynchronousChangeMessage (this);
                sendChangeMessage (this);

            valueChanged (currentValue);


no, i still get the same problem :frowning:

I tried to debug it a little, but its difficult since it only seems to happen with optimisations turned on and i can’t see the values of variables in the debugger. I did however, get an assert failure in getLinearSliderPos() - called from the slider’s paint() method - as soon as i dragged the slider to its far left.

This happens on more than one slider, both with skew factors less than 1.0.

fixing this isn’t vital to me - i can just change my compile settings - i just thought i’d let you know. I’ll keep you updated if i do happen to make any progress on getting to the bottom of it.


ok, i think i found it.


[code]double Slider::proportionOfLengthToValue (double proportion)
if (skewFactor != 1.0)
proportion = exp (log (proportion) / skewFactor);

return minimum + (maximum - minimum) * proportion;


you’re potentially doing a log(0.0) …i think…

Which is undefined. I temporarily changed it to:

to check, and it worked. not sure why that’d work differently in release and debug though :?


Ok… I’m not sure why that’d be different either, but we could put some extra checks in there.

How about just changing the first line to:

if (skewFactor != 1.0 && proportion > 0.0)