# A couple of bugs

**URL:** <https://forum.juce.com/t/a-couple-of-bugs/547>\
**Category:** General JUCE discussion\
**Created:** [December 10, 2005, 8:17pm UTC](https://forum.juce.com/t/a-couple-of-bugs/547 "2005-12-10T20:17:10Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![daniel78](https://avatars.discourse-cdn.com/v4/letter/d/e99b99/32.png) [@daniel78](https://forum.juce.com/u/daniel78)\
**Post date:** [December 10, 2005, 8:17pm UTC](https://forum.juce.com/t/a-couple-of-bugs/547/1 "2005-12-10T20:17:10Z")

</div>

…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.

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [December 11, 2005, 10:04am UTC](https://forum.juce.com/t/a-couple-of-bugs/547/2 "2005-12-11T10:04:38Z")

</div>

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:

```auto
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;
        updateText();
        repaint();

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

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

            valueChanged (currentValue);
        }
    }
}
```

---

<div class="post-metadata">

**Author:** ![daniel78](https://avatars.discourse-cdn.com/v4/letter/d/e99b99/32.png) [@daniel78](https://forum.juce.com/u/daniel78)\
**Post date:** [December 11, 2005, 4:45pm UTC](https://forum.juce.com/t/a-couple-of-bugs/547/3 "2005-12-11T16:45:49Z")

</div>

no, i still get the same problem ☹

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.

---

<div class="post-metadata">

**Author:** ![daniel78](https://avatars.discourse-cdn.com/v4/letter/d/e99b99/32.png) [@daniel78](https://forum.juce.com/u/daniel78)\
**Post date:** [December 11, 2005, 8:15pm UTC](https://forum.juce.com/t/a-couple-of-bugs/547/4 "2005-12-11T20:15:47Z")

</div>

ok, i think i found it.

in:

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

```
return minimum + (maximum - minimum) * proportion;

```

}[/code]

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

Which is undefined. I temporarily changed it to:

```auto

```

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

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [December 12, 2005, 9:56am UTC](https://forum.juce.com/t/a-couple-of-bugs/547/5 "2005-12-12T09:56:59Z")

</div>

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:

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

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [May 12, 2017, 9:51am UTC](https://forum.juce.com/t/a-couple-of-bugs/547/6 "2017-05-12T09:51:34Z")

</div>


