Hopefully a quick question, how can one grab the host’s tempo setting inside a plugin. I’m working on upgrading my delay lines to calculate delay times based on tempo and note values. Thanks a lot in advance for any tips.
You will want to look up AudioPlayHead and CurrentPositionInfo. I am sure there are forum posts around here somewhere to show how they are used as well.
Thank you. I had already looked at AudioPlayHead but only on second read caught that CurrentPositionInfo is being filled. BPM is what I need … thanks again!
Just be aware the host doesn’t need to return any tempo info, or if it does return info the tempo can be 0.
Just went through this a few weeks ago. It’s a bit confusing you need to pass getCurrentPosition() a pre-existing AudioPlayHead::CurrentPositionInfo struct. Sounds like you figured it out though!
Thanks. Just to clarify the statement, this applies to a host in general. e.g. the plugin may not be able to use the feature cross-platform, or at block level, e.g. the info is not supplied consistently? Just to make sure I understand the implications.
Yes, thank you, I missed the struct update part …
Not all hosts have a playhead or the concept of tempo. The juce plugin host or Audacity for example. Most DAWs will give you tempo information, just be aware there are a lot of things other than your typical DAW that can load plugins. It’s ok for your plugin to not work without tempo info, or default to 120. Just make sure you don’t grab the tempo value and divide by it without checking if it’s valid first.
Got it, makes sense. Thanks a lot for for the extra info!