FL Studio GUI and host diff

Hello!

i am making a simple plugin that uses simple physics and generates midi from on screen ball collision inside 4 walls. i update the ball position in the audioProcessor and then paint it in the Editor. The ball speed is calculated using effectiveFrameRate, bpm and wanted tempo(the tempo of the ball hitting the walls):

I get it from the processBlock:

juce::AudioPlayHead::CurrentPositionInfo newPositionInfo;
if (playhead->getCurrentPosition(newPositionInfo))
{
bpm = newPositionInfo.bpm;
effectiveFrameRate = newPositionInfo.frameRate.getEffectiveRate();
}

When testing the plugin and ball movement in the projucer plugin host, everything works fine and the speed matches the bpm and chosen tempo. BUT, when testing it in FL Studio, the speed is not fitting the bpm and generally way faster even though the velocity given to each ball position update is the same value… (for example i do x = x + xVelocity)

Is there any thing i miss?
thx

  • playhead->getCurrentPosition() is old and deprecated. It’s best to avoid it, because there’s no way to tell whether each value in the CurrentPositionInfo is a real value provided by the host, or a default value provided by JUCE. It’s better instead to call playhead->getPosition(), as this allows you to explicitly handle cases where the host doesn’t provide a specific piece of position information.
  • The frameRate information provided by the playhead refers to the video framerate of the DAW project, if any (some DAWs allow scoring to film). It’s unrelated to the framerate of the plugin’s editor. My guess is that the two hosts you’ve tried provide different values for the effectiveFrameRate, although the best way to know for sure is to check in a debugger.
1 Like

Thank you very much!!
I didnt kno2 that there are deprecated functions lying around juce and need to be carefull of… Also mean I lacked my studies and need to follow the documentation better.
I will try and implement it using getPosition() :slight_smile: