juce::AudioParameterFloat default value not reacting same way between xcode (mac os x) and visual studio (windows) ?!

I made a little video to show the “problem”

I try to ask chatgpt the same questions but the answers did not help …

What does your code look like that decides when to draw the label in yellow?

struct ComprendreParametres
{
    float seuil{ 0.0f };
    ...
}

ComprendreParametres obtenirParametres(juce::AudioProcessorValueTreeState& apvts);

ComprendreAudioProcessor::ComprendreAudioProcessor()
    : AudioProcessor(BusesProperties()
      ...
    ),
    ...
    altere {
      {"seuil", false},
      ...
    },
    pardefaut {
        {"seuil", -20.0f},
        ...
    }
{
    ...
    ecoutes();
}

ComprendreParametres obtenirParametres(juce::AudioProcessorValueTreeState& apvts)
{
    ComprendreParametres parametres;
    parametres.seuil = apvts.getRawParameterValue("seuil")->load();
    ...
    return parametres;
}

juce::AudioProcessorValueTreeState::ParameterLayout ComprendreAudioProcessor::creationParametres()
{
    juce::AudioProcessorValueTreeState::ParameterLayout layout;

    layout.add(std::make_unique<juce::AudioParameterFloat>("seuil", "Threshold", juce::NormalisableRange<float>(-60.0f, 0.0f, 0.01f), -20.0f));
    ....
}

void ComprendreAudioProcessor::ecoutes()
{
    apvts.addParameterListener("seuil", this);
    ...
}

void ComprendreAudioProcessor::parameterChanged(const juce::String& idIn, float valueIn)
{
    ...
        rafraichit(false);
    ...
}

void ComprendreAudioProcessor::rafraichit(bool premier)
{

    ...
    ComprendreParametres parametres = obtenirParametres(apvts);
    altere["ratio"] = (pardefaut["ratio"] != parametres.ratio);
    ...
    etat_reonglet = true;
}


void ComprendreAudioProcessorEditor::paint (juce::Graphics& g)
{
    ...
    texte_ratio.setGras(audioProcessor.altere["ratio"]);
    ...
}


void ComprendreAudioProcessorEditor::timerCallback()
{ 
    if (audioProcessor.etat_reonglet)
    {
        repaint();
        ...
    }
    ...
}


	class Texte : public juce::Component
	{
	public:
		void paint(juce::Graphics& g) override
		{
			g.setColour(juce::Colours::white);
			juce::Font font(15.0f);
			if (gras)
			{
				g.setColour(juce::Colours::yellow);
			}
			g.setFont(font);
			g.drawFittedText(texte, getLocalBounds(), aligne, 1);
		}
                ....
        }

One obvious issue is that this code isn’t thread-safe. The etat_reonglet and altere["ratio"] variables are written to by the audio thread and read from by the UI thread. The compiler doesn’t know about this, and so it may have created code that works OK on Windows but not on Mac.

The comparison pardefaut["ratio"] != parametres.ratio is also problematic, since the default is -20.0f but the current value may be something like -19.9999f. So using approximatelyEqual to do the comparison might work better than !=. However, != should still work OK for when the user resets the knob to the default position by Alt-clicking or double-clicking. So I don’t think that’s the issue.

What i find “worrying” is the fact that instead of having “0.00” on parameters, mac version purpose “-0.00” and when i enter “0.00” with keyboard it remains “-0.00”. I have more big suspicion on how clang handles float with arm architecture. Windows version is already clang ('done that to prevent futur incompatibility problem with mac …). I don’t know if there is some “float precision” stuff to give to xcode, that is known by every juce/xcode plugin devs (have i miss a “big thing” ?)